Navigation Bar


Linux Commands:
An introduction
to the
basic uses
and options
of 19 commands.







Linux Commands

By Chad Miller

This article outlines and explains a few of Linux's many different commands. For new users, it will provide a comprehensive introduction to 19 commands/programs that are essential to effective use of the OS. For experienced users, the list offers a quick review of the basics. The 19 commands are:

cat  cp  date  df  du  free  ftp  gzip  gunzip  ls  man  mkdir  more  mv  ps  rm  rmdir  su  telnet 

Each of these commands, I have found, are commonly used by anyone who computes with Linux. Many of you who aren't Linux friendly yet might need a reference to them.

Most of the information contained in my document can also be viewed in the command's man page. A "man page" is the manual page for that program. To use man, just type "man [ command name here ]" and this will bring up the command's manual page. What I try to do is to present these commands in a easy-to-read format so that anyone can use them.


cat - Similar to "type" in MS-DOS, cat allows the user to print the contents of a text file to the screen. The cat command also can be used to put text files together (hence conCATenate).


      For example:

      cat file.one

           // this is text in
           // file one.

      cat file.two

           // this is text in
           // file two.

      If you wanted to put these files together...
      cat file.one file.two > combofile

      cat combofile

           // this is text in
           // file one.
           // this is text in
           // file two.

As you see demonstrated above, cat can be useful in combining source codes, log files, etc.


      SYNTAX - cat [ filename ]
                   or for combining files:
                   cat [ filename1 ] [ filename2 ] > [ target file name ]


cp - This program is similar to an MS-DOS program called "copy". The basic function of cp is to copy files from point A to point B on your computer. copy also offers several options, many more than its bretheren in DOS. You can refer to the man page for a list of all of the options.


     SYNTAX - cp [ target file ] [ destination ]
                  or when using options
                  cp [ option ] [ target file ] [ destination ]


date - This program displays the date and system time on your computer. It is very configurable. The user is able to reconfigure the way the program outputs the date and time. To see a more detailed list, type:

$ date --help


     SYNTAX - date [ option ] [ +format ]


df - This program displays the amount of free disk space on your computer's drives. The user can change the output of the program in several ways. One way is by using the [ -H ] option which will show all output in "human readable" format, i.e. 5k, 300M, and 5G ( kilobytes, megabytes, and gigabytes... not bytes ). Another option is the [ -l ] option, which will only list files on local drives. To see the rest of the options, access the man page.


     SYNTAX - df [ option ]


du - This program lists all files in a directory and its subdirectories and displays the amount of disk space for each item. By default, du displays all disk usage in one-kilobyte blocks, unless the environmental variable is set to POSIXLY_CORRECT, which will then display disk usage in 512-byte blocks. As with many other *NIX commands, du features a rich set of options. Read the man page for further information.


     SYNTAX - du [ option ]


free - This program displays a configurable set of statistics about system memory. It displays how much memory is used, how much is free, how much is in the buffer, and how much is available for swap. By default, the program shows memory information in kilobytes, but can be set to bytes [ -b ], kilobytes [ -k ](default setting), and megabytes [ -m ]. You can also set the program to check the memory continuously with the [ -s DELAY ] command. The program will re-check the memory at intervals in seconds; the interval is set by the user. For example, to have the program recheck memory every ten seconds:

$ free -s 10

This would give me a memory reading every ten seconds.


     SYNTAX - free [ option ]


ftp - ftp is a communications program which allows the user to upload and download files from a remote network. I would love to elaborate more upon this program, but there is a 608-line man page for this program, just waiting for the eager user to read. To find a list of commands to use with ftp, type "?" at the ftp prompt and the appropriate list will be presented. To find information about these commands, type "help [command]" at the ftp command prompt.


gzip - This is a very useful archiving tool for the *NIX operating system. The program will compress a file using the LZ77 coding system and will usually put the .gz extension at the end of any file that is compressed with this program. Like ftp, there is an extremely detailed man page for gzip. But the basic usage of the tool is as follows:


     SYNTAX - gzip [ filename ]


gunzip - gunzip is a decompression tool that can decompress archives created from gzip, zip, compress, compress -h, and pack.


     SYNTAX - gunzip [ filename ]


ls - This is the *NIX command for a directory listing. By itself (no options used) the command will list all non-hidden directories and non-hidden files. If you wish to see everything in a directory, just add the [ -a ] option to the ls for a complete listing. To see the full list of options for ls, read the help file by opening a command prompt and typing "ls --help".


     SYNTAX - ls [ option ]


man - This is a program that allows the user to access a large database of manual pages for programs on your computer. If you have a program on your computer, the chance of there being an entry for it in man is high. All you have to do is type "man" at the command prompt and the program you want info on after that. Example:

$ man mkdir

This will bring up a man page for mkdir. Anytime you have a question on how to use a program, this is what you should refer to.


     SYNTAX - man [ program name ]


mkdir - This command allows the user to create a directory. Much like the the DOS command, all you have to do is add the name of the directory you want to create after the command.


     SYNTAX - mkdir [ directory name ]


more - This command allows the user to view a document page-by-page while at their prompt. more is implemented by using the pipe followed by the "more" command.


     SYNTAX - [ any command that will produce more than a page ] | more


mv - This command allows the user to move contents from one directory to another. There are three key options:
interactive [ -i ],
backup [ -b ],
and force [ -f ] .

The interactive option prompts the user for every file that is being moved and asks if it should be moved or not. The backup option makes a backup of each file being moved in its original directory. The force option overwrites and replaces every file in the directory that is also being moved into it.


     SYNTAX - mv [ option ] [ sourcefile ] [ destination ]


ps - This command shows a list of all processes running at the time of command process. If you want to see a running list of running processes, use top. There is a giant man page (330 lines of text). You should read it. ps is an excellent command, one I use quite frequently. I personally would suggest using the command/option mix of :

ps aux

Note the lack of a "-" at the begining of the options. This will show all processes running, display their owners, and show what time the process was started.


     SYNTAX - ps [ option ]


rm - This command allows users to remove files from their directories. The command is much like DEL in MS-DOS and is used in the same fashion.


     SYNTAX - rm [ file name/file location ]


rmdir - This command will remove a directory from your system. To use it, just provide the path name. Remember that the directory must be empty, so move or trash the contents before invoking the command.


     SYNTAX - rmdir [ directory to be removed ]


su - This program allows the user to change identities so to speak, to switch to a different user's identity/profile while logged in to the terminal. You can either log in as the other user, or use the other user's identity to preform a certain command. For example:

$ su root This will give me root access if I have the correct password.

$ su root -c wvdial This will use the root user to execute the command following the -c.


    SYNTAX - su [ user ] [ option[command] ]


Telnet - Telnet is a program used to establish a connection to a network through the internet. While using telnet, the user is placed in a unix/linux shell and has control over that account remotely. By doing this, the user can execute programs on that machine and do anything else he or she might do just as if he or she were at that computer in person. This program, like ftp, has a very extensive man page that will provide you with much more detailed information. I use telnet quite often; in fact, I think it is an essential tool for any power user.



Developmental Level: Partial Draft
Page Launch:
August 25, 2000
Last Updated:
August 28, 2000