cancel
Showing results for 
Search instead for 
Did you mean: 
kubeadm
Flight Engineer Flight Engineer
Flight Engineer
  • 11.6K 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
Susan
Flight Engineer Flight Engineer
Flight Engineer
  • 6,074 Views

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.

 

TeachJohn
Cadet
Cadet
  • 5,903 Views

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

flozano
Moderator
Moderator
  • 6,055 Views

Hah, easye one: man

fuadar
Flight Engineer Flight Engineer
Flight Engineer
  • 6,050 Views

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
Bishop
Cadet
Cadet
  • 5,786 Views


@fuadar wrote:

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


pgrep and pkill are going to rock your world.

JAC
Cadet
Cadet
  • 5,718 Views

I recently discovered kill -15.

0 Kudos
mattikbk
Mission Specialist
Mission Specialist
  • 6,037 Views

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
Scudder
Flight Engineer Flight Engineer
Flight Engineer
  • 5,817 Views

Apparently my own favorite is dnf. Lol.

25L/43U
0 Kudos
JamesM
Cadet
Cadet
  • 6,035 Views

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.

Join the discussion
You must log in to join this conversation.