UNIX for Beginners

Learn basic UNIX commands in 5 minutes.


Noteworthy Points

  • UNIX is a multi-user, multi-tasking operating system. (i.e. UNIX can support multiple users, each running mutiple processes simultaneously.)

  • UNIX file and directory names can be composed of the following: letters of the alphabet (A-Z, a-z), numerical digits (0-9), ., - and _.

  • Files beginning with . are hidden files and can only be seen when using the ls -a command.

  • UNIX is case-sensitive. (i.e. MYFILE.C is NOT the same as myfile.c!)

  • The current directory is referenced by the ./ symbol. The parent directory (one directory above the current directory) is referenced with the ../ symbol.

  • Pathnames that start with / are absolute and reference all files and directories with respect to the root directory.

  • Pathnames that do not start with / are relative and reference all files and directories with respect to the current directory.

  • The * symbol can be used as a wildcard. (e.g. ls m*.c will list all files beginning with m and ending with .c.)

  • Deleting a directory that isn't empty can be tricky. Use the rm command with the -r flag. (e.g. rm -r directory)


    Useful Basic Commands

    cd directory
    Change into the specified directory.
    cp old_filename new_filename
    Copy a file named old_filename to a file named new_filename.
    cp -r old_directory new_directory
    Copy a directory named old_directory to a directory named new_directory.
    exit
    Exit UNIX.
    ls
    List the contents of the current directory.
    man command
    Display a manual page containing information about the specified UNIX command.
    mkdir directory
    Make the specified directory.
    mv old_filename new_filename
    Move a file named old_filename to a file named new_filename. Useful for renaming files.
    passwd
    Change your password.
    pwd
    Display the present working directory.
    rm filename
    Remove the specified file.
    rmdir directory
    Remove the specified empty directory.


    Additional Useful Commands

    Some additional commands you might find useful once you become more familiar with UNIX are: bg, cat, chmod, clear, fg, finger, grep, gzip, jobs, kill, mail, more, rlogin and tar.


    Useful Programs

    ftp hostname
    Open a file transfer protocol connection to the specified host.
    gcc filename
    Compile the specified C program file. The executable is automatically named a.out.
    g++ filename
    Compile the specified C++ program file. The executable is automatically named a.out.
    pico [filename]
    An easy-to-use text editor.
    pine
    An easy-to-use email program.
    telnet hostname
    Open a terminal connection to the specified host.
    vi [filename]
    A powerful, but not-so-easy-to-use text editor.


    Last Modified: 06-29-2009

    Copyright © 1999-2009 Jeffer Choudhry