cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Flight Engineer kubeadm Flight Engineer
Flight Engineer

What's your favorite tool/cmd in Linux?

The command "find" is one of my favorites -

Search for files in /search/path/  which are older than 5 days.

(if you want to search for directories, then use:   -type d )

find /search/path/ -type f -mtime +5 -print

find /search/path/ -type d -mtime +5 -print

If you want to do something with those files after you've found them, use:  -exec <somecmd> '{}' \; 

Example, delete files older than 50 days in the /search/path directory

find /search/path/ -type f -mtime +50 -exec rm '{}' \;

 

If only there is a 'find' equivalent in the real world ... now, where did I put my keys? 

Tags (2)
48 Replies
Flight Engineer Susan Flight Engineer
Flight Engineer

Re: What's your favorite tool/cmd in Linux?

I get more use out of grep either directly or in a pipe. The color option has really helped me identify my find and I am also a fan of the -A and -B options to show context. These display the matching line and the specfied number of lines After or Before. 

grep -i '^<directory' -A5 /etc/httpd/conf/httpd.conf

 

I also use a lot of cd - to flip back and forth between directories and CTR-r to search history.

 

Reply
Loading...
TeachJohn Cadet
Cadet

Re: What's your favorite tool/cmd in Linux?

I agree with you. I love grep, especially  when filtering through a large amount of data using grep piped to grep with regular expressions. The -v option is great for eliminating lines that contain strings that are NOT included in the lines you are looking for. 

grep '^Apr 1 15:5[34].*ERROR' /var/log/messages | grep -v '[az0-9]\{32\}'

0 Kudos
Reply
Loading...
Moderator
Moderator

Re: What's your favorite tool/cmd in Linux?

Hah, easye one: man

Reply
Loading...
fuadar Cadet
Cadet

Re: What's your favorite tool/cmd in Linux?

love man and how you can look up help anywhere with or without internet , Also  ps -ef has been by far my favorite followed by a kill -9

0 Kudos
Reply
Loading...
Bishop Cadet
Cadet

Re: What's your favorite tool/cmd in Linux?


@fuadar wrote:

 ps -ef has been by far my favorite followed by a kill -9


pgrep and pkill are going to rock your world.

0 Kudos
Reply
Loading...
JAC Cadet
Cadet

Re: What's your favorite tool/cmd in Linux?

I recently discovered kill -15.

RHCSA Enthusiast
0 Kudos
Reply
Loading...
mattikbk Cadet
Cadet

Re: What's your favorite tool/cmd in Linux?

Don't know about favorite, byt here's my most used commands from my bash history: ssh, nmcli, ls, sudo, cd, ansible, rm, rsync, cat, man, less, mv, curl, dnf, echo, scp, python, top, perl

0 Kudos
Reply
Loading...
Flight Engineer Scudder Flight Engineer
Flight Engineer

Re: What's your favorite tool/cmd in Linux?

Apparently my own favorite is dnf. Lol.

25L/43U
0 Kudos
Reply
Loading...
JamesM Cadet
Cadet

Re: What's your favorite tool/cmd in Linux?

Mine is not a command per se (at least not in the normal sense) but is the capabilities enabled by the pipe character. I've lost count how many ways I've been able to construct complex one-liners using the pipe character, to enormously beneficial effect.

Reply
Loading...
Join the conversation
You must log in to join this conversation.