Indispensible Unix commands

The first lab session of my Computer Science course consisted primarily of learning the following Unix commands: pwd, ls, cd, cp, mv, rm, mkdir, chmod, more, man. Although I’ve been using nothing but Windows throughout my career – from Windows 95 to 2000 to XP – these commands have proven to be indispensible for those occasions when I need to remotely administer a Linux box.

Let’s go through them one by one.

You log in to a Linux server and all you get is a dollar sign and a cursor. The first thing you want to know is: where am I? So you want to print the working directory:


Then you want to list all the contents of the current directory in a long listing format:

ls -al

To get around, you change directory:

cd /another/directory

Then, to copy a file from one directory to another:

cp /some/directory/somefile.txt /another/directory

To move it instead:

mv /some/directory/somefile.txt /another/directory

There is no command to rename, you just move it:

mv oldname.txt newname.txt

To remove a file:

rm filename.txt

To remove a directory and its contents recursively:

rm -r dirname (use with extreme caution!)

To make a directory:

mkdir dirname

To change the mode of a file or directory to make it writeable by everyone:

chmod ugo+rwx file_or_directory

ugo+rwx means, for (user, group, others), add (read, write, execute) permissions. Use the minus sign instead of the plus sign to remove permissions. ugo and rwx can be used in any combination, e.g., go-w.

Finally, to get to know more about the contents of a file:

more filename.txt

Press space to scroll to the next page, and q to quit. (Note: less is better than more. With less, you could go both backwards and forwards.)

Finally: when in doubt, consult the manual!

man command

Update 13 February 2009

See also Commands that you must know in Linux… by

Related Posts:

  • No Related Posts



and i want to add about vi’s a must !! as well as other commands such as ps, grep, netstat, ping, traceroute, sudo, scp, ifconfig, who and other commands


Nice Blog, Thanks for the simple Unix commands… I all of a sudden got some interest in learning some unix commands on my MAC after i went through your above post… 🙂

Leave a Reply

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