Top Linux commands every linux user should know

Getting to the Essential ones…

Strings

  • grep
  • awk
  • uniq, sort, sort -n
  • seq
  • cut
  • wc

Files

  • rsync
  • lsof
  • find | xargs
  • locate
  • df -H
  • du -cks * | sort -n
  • scp
  • strings
  • file
  • touch
  • z* (zgrep, zcat, etc)
  • tail -f, head

Administration

  • man
  • ps auxf (f only on GNU)
  • kill, -HUP, -9
  • sudo
  • screen
  • /etc/init.d/ scripts
  • id
  • Z, fg, jobs, &

Networking

Operators

  • The knowledge that bash is a programming language that provides all your basic constructs (ifs, loops, variables, functions), but instead of having a library of functions, you execute simple programs instead
  • |
  • <, >, >>
  • - as stdin, e.g. “cat somefile.txt | vi -”
  • for i in a b c d; do echo $i; something_else $i; done
  • alias

>> screen is an excellent command (won’t have to use nohup again), if you don’t have it you should install it and try it.
If you’re on a Red Hat based distro, yum and rpm are good to know. If it’s Debian based, apt-get and dpkg for installing stuff.

>> ping, traceroute, ifconfig are all handy for networking stuff.
>> grep for searching, top and ps for process monitoring (definitely look into htop its a much nicer version of top but you may need to enable additional 3rd party repositories if using yum or apt-get). There are tons, I guess those are some of the more common ones I use (not including the basic ones like cd, pwd, cp, mv, ls, etc).

Also i’d like to mention few (Not a command,) but there are loads of handy bash (well, readline) key sequences that make editing commands much easier. You’ll also feel right at home if you’re an Emacs user. A few of the more common ones:

C-a - Start of line
C-e - End of line
C-k - Kill to end of line
C-u - Kill to start of line
Alt-d - Kill word forwards
C-w - Kill word backwards
C-/ - Undo
C-t - transpose characters

(C-x means CTRL-x, btw)

>> netstat -tulp # what is listening on which port

>> tmux # screen alternative, probably superior(and nicer looking)

>> lsof somefile/folder # which process is using this file/folder/device

>> top -b | grep processname # continuous info about a process, you have to Ctrl+C out of it though

>> nmap -sS -sV -O localhost # local listening ports and what versions of daemons are running, much more I can’t think of right now :)

About these ads

About Kanthala Raghu

I am from Hyderabad, so I love to drink coke. I also love to explore Internet, which conflicts with love #1. I'm currently pursuing my Graduation in Electronics & Communications. I mostly blog about Tech, News, Open Source, whatever I'm learning about and shout down people who I disagree with - because I can't go to bed until people stop being wrong on the Internet.