Linux Commands – Top 20 Most Used

Installing linux on ps3

The history file is a log file of your last used commands on the Linux server,
It can be found in your home directory and is called .bash_history (with the “.” in the start).
You can either read the file itself to see its content, or use the command history which will do the same thing.

When looking at my history files on my Linux servers,
I can see maybe 20 Linux commands which I keep using over and over,
They are the most important tools of my work, and I recommend learning them well to any starting Linux sysadmin.

Files and Directories Management

  • ls – Lists files and directories content, I usually use “ls -la” to have a long listing with all the details and hidden files
  • cd – move from the current directory to a different folder
  • pwd – lists your current location
  • mv – this command can either change the name of a file, or move it to a different location.
  • locate – find any file on the Linux server, to get an updated index of files (if for example you just installed a whole bunch of RPM’s) run the command updatedb
  • ln – create a shortcut to a file or folder
  • tar – create or extract files out of a storage file. with the correct arguments it will also compress the files

Editing and Viewing

  • tail – lists the last 10 lines of a file, but you tell tell it to show any number of last lines
  • vi – the best command line editing software :)¬† a little hard to learn how to work this one at first, buts its worth the effort
  • cat – list the content of the file. better know how long is the file you are running this command on, or you will get a very long scrolling of lines that will fill up your screen

A Very Good Linux Administration Book

Network

  • nslookup – very important networking tool – this will show you where a DNS name is pointing – to which IP or to another DNS
  • wget – get a file from the web from the command line – if you need to download some RPM directly to the command line without a browser, this is the command you need
  • ping – I think its one of the most used commands, you can check the time it takes you to get via the network to a remote server, whether that server is available, how many packets are getting to the server, etc

Installing linux on ps3

General

  • history – lists the last used commands on your Linux server
  • make – when compiling a software from source, this command will create the binaries
  • id – who am I right now? besides the philosophical angle, this command will show you as which user you will be running commands, I use this to check what is my status, and then sudo to the user I need
  • sudo – execute a command as another user – although¬† usually use it to change to root
  • ps – list the running processes on the server, it give more info like the process id, the parent process id, running time and much more
  • man – displays a manual page, whenever you are not sure about a specific command or config file, you should run “man command” to get info about it. to search the man database use “whatis command” to find which man file has the info you need
  • df – report file system disk space usage, use “df -h” to get a human formatted listing

Installing linux on ps3

Technorati Tags: , , ,

6 thoughts on “Linux Commands – Top 20 Most Used”

  1. For anyone who’s interested in seeing their own top twenty you can run the following:

    cat ~/.bash_history | tr “\|\;\&” “\n” | sed -e “s/^ //g” | cut -d ” ” -f 1 | sort | uniq -c | sort -n | tail -n 20

    It’s not perfect but will give you a rough idea.

    On my own computer I get:
    timp@shammah:~$ cat ~/.bash_history | tr “\|\;\&” “\n” | sed -e “s/^ //g” | cut -d ” ” -f 1 | sort | uniq -c | sort -n | tail -n 20
    8 dig
    8 fbsetbg
    8 make
    9 cvs
    10 do
    10 done
    10 for
    11 pwsafe
    11 wget
    12 rm
    13 ./test.sh
    13 vim
    15 cat
    15 svnadmin
    16 grep
    19 su
    25 ssh
    55 svn
    83 ls
    96 cd

    A couple of things of note:

    dig is similar to nslookup
    You can also see that I often work with version control: svn, svnadmin, and cvs; I like VIm over vi; I use ssh a lot; and that it’s not unusual for me to use Bash’s builtin “for” loops (do, done, and for)

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>