cancel
Showing results for 
Search instead for 
Did you mean: 
Flight Engineer kubeadm Flight Engineer
Flight Engineer
  • 2,040 Views

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)
49 Replies
Highlighted
Flight Engineer Susan Flight Engineer
Flight Engineer
  • 2,029 Views

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...
Highlighted
TeachJohn Cadet
Cadet
  • 1,859 Views

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\}'

Reply
Loading...
Highlighted
Moderator
Moderator
  • 2,010 Views

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

Hah, easye one: man

Reply
Loading...
Highlighted
Flight Engineer fuadar Flight Engineer
Flight Engineer
  • 2,005 Views

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...
Highlighted
Bishop Cadet
Cadet
  • 1,741 Views

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.

Reply
Loading...
Highlighted
JAC Cadet
Cadet
  • 1,674 Views

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

I recently discovered kill -15.

0 Kudos
Reply
Loading...
Highlighted
mattikbk Cadet
Cadet
  • 1,992 Views

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...
Highlighted
Flight Engineer Scudder Flight Engineer
Flight Engineer
  • 1,772 Views

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

Apparently my own favorite is dnf. Lol.

25L/43U
0 Kudos
Reply
Loading...
Highlighted
JamesM Cadet
Cadet
  • 1,990 Views

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 discussion
You must log in to join this conversation.