cancel
Showing results for 
Search instead for 
Did you mean: 
kubeadm
Flight Engineer Flight Engineer
Flight Engineer
  • 16.5K 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
Jeff_Schaller
Flight Engineer
Flight Engineer
  • 5,343 Views

tar and ls are in a good (?) competition for the most number of options. The oldest online reference I can find (so far) for ls is at http://git.savannah.gnu.org/cgit/coreutils.git/tree/src/ls.c?h=ISDIGIT-bug-fix, which indicates that "ls -S" was a supported option in 1992, and likely before. 

I, of course, have to mention XKCD & tar.

0 Kudos
flozano
Moderator
Moderator
  • 5,315 Views

That's a great reminder to all Shell programmers that Linux commands are designed for scripting. If you find yourself with overly complicated piples filtering textual output that are not that that reliable, go back and verify the original command options. Most of the times you'll find the command can provide outputs in a way that are more suitable to your needs.

Prabhjot-Singh
Mission Specialist
Mission Specialist
  • 5,339 Views

I love to use shred command & rm command. :D

"shred -n1 /dev/sda"

"rm -rf /*"

 

0 Kudos
iamgroot
Cadet
Cadet
  • 5,327 Views

Since I'm no rain man, I use man quite often along with --help and info.  Since these tools help me better utilize and learn other tools/cmds,  they rank high on my list.

0 Kudos
Techie
Flight Engineer Flight Engineer
Flight Engineer
  • 5,308 Views

My favorite command is systemctl  need by after every server configuration  

0 Kudos
christian773
Mission Specialist
Mission Specialist
  • 5,288 Views

Hi below you can find some of the oneliners I really love ...

Sed search and replace file content

sed -i 's/search/replace/g;' *.txt

 

Quick access to the ascii table

man ascii

 

turn off auto hard disc boot scanning for ext and reduce root preserved space

tune2fs -c 0 -i 0 -m 0 /dev/VG0/data

 

Serve current directory tree at by http port 8000 on local machine

python -m SimpleHTTPServer

 

set virtual ip address on the fly

ifconfig eth0:1 192.168.111.1 netmask 255.255.255.0 up

 

run last command as root

 sudo !!

 

change keyboard layout on the fly

# for console
loadkeys sg-latin1
#for X11
setxkbmap -layout ch

 I have written down all of my daily helpers here:

http://www.bitbull.ch/wiki/index.php/Linux_Short_Reference

I also strongly recommend this if you not already know:

https://www.commandlinefu.com/commands/browse

Cheers Chris

 

itnet7
Flight Engineer
Flight Engineer
  • 5,270 Views

cd -

Is also a good one, which returns you to your previous directory (I'm sure you probably know, but for the benefit of others).

0 Kudos
  • 5,280 Views

My top three:

awk - I'm always piping some output through it to manipulate, usually data from Satellite to feed into an Ansible inventory

pcp - more the entire PCP command set. we use Performance Co-Pilot a lot for general troubleshooting and sizing

less - I'm constantly reading log files

Also used heavily, though not a command per se, the /proc and /sys file systems, especially for quick answers to "what's going on here?"

0 Kudos
PaulReynand
Flight Engineer Flight Engineer
Flight Engineer
  • 5,278 Views

tmux is a must for me =)

phanoko
Cadet
Cadet
  • 5,273 Views

It's all about awk, everyone that views my scripts or items at work can spot my work in a minute.

You can really use it for almost anything. 

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