Basic Commands - Linux


The Basic Unix commands required to navigate through Unix are:

  • ls
  • pwd
  • mkdir
  • rmdir
  • cat
  • cp
  • mv
  • rm
  • cd

ls

ls stands for list directory. It is the equivalent of DOS's dir command. Available options are:

-a lists all files including hidden files
-l gives a long listing including rights

"ls" by itself will not display hidden files. There are many other options available but these are the most commonly used ones.

Ex.  ls
 . .. readme.txt Krustys_revenge more_stuff

Ex. ls -a
 . .. readme.txt Krustys_revenge more_stuff
 .signature .profile

Ex. ls -l
 total 956
 drwxr-xr-x 6 arh other 1024 Dec 16 09:44 .
 drwxrwxr--x 5 root sys 96 Dec 12 09:05 ..
 -rw-r--r-- 1 arh other 681 Jan 28 04:56 .profile
 etc...

pwd

pwd stands for Print Working Directory. pwd displays on the screen the current directory that you are in. Before CRTs, all communication with mainframes was printed out on "teletype" style terminals thus the origins of the name pwd.

ex  pwd

  /home/bart

mkdir

mkdir stands for make directory. It is similar to DOS's "md" command. In actual fact, originally DOS's make directory command was mkdir for pre-DOS 3.x.

ex. mkdir homer  makes the directory "homer"
    in the current working directory.

rmdir

rmdir stands for remove directory. It is similar to DOS's "rd" command. In actual fact, originally DOS's remove directory command was rmdir for pre-DOS 3.x.

ex.  rmdir homer  removes or erases the directory "homer"
    from the current directory.

cat

cat stands for catalog and is used for displaying files to the screen similar to DOS's "type" command. "cat" allows single screen paging, it waits for a response before displaying the next screen of information.

Ex.  cat readme.txt   this will display the file readme.txt onto the
     screen one page at a time.

cp

cp stands for copy. It is used to copy files similar to DOS's "copy" command.

Ex.  cp readme.txt springfield.txt copies the file readme.txt and
     names the new file springfield.txt

mv

mv stands for move. It is used to move files from one directory to another and it is also used to rename files.

Ex.  mv readme.txt /home/x-files moves readme.txt from current
     directory to directory called /home/x-files

Ex. mv agent.sculley agent.muldar renames file agent.sculley to new
     name agent.muldar

rm

rm stands for remove. It is used to delete files similar to the DOS "del" command. It will verify that you want to delete the file. Wildcards can be used with rm.

Ex. rm dana.sculley   deletes file named dana.sculley

cd

cd stands for change directory. It is used to change the current directory similar to DOS's "cd" command. Note: to use the double dots requires a space - cd ..

Ex.  cd /x-files/fox.muldar  Makes /x-files/fox.muldar the
       current directory

If this page has helped you, please consider donating $1.00 to support the cost of hosting this site, thanks.

Return to

TelecomWorld 101

Copyright July 2013 Eugene Blanchard