Basic Linux/Unix commands

ls

Lists the ontents of the current directory. If you want to see longer descriptions, write
ls -la

cd dir

Changes the directory into dir. dir can be

  1. the name of a subdirectory in your current directory. Just give the name, no path needed. E.g. cd sciwri /when sciwri is a subdirectory in your home directory (where you are now).
  2. a full path name. This is needed when the directory is not a direct subdirectory of your current location. E.g. if I want to move into web-docs directory from sciwri directory I write write
    cd /staff/whamalai/web-docs/
    You can also use special characters in the path name. E.g. if sciwri is a subdirectory, you can write
    cd ../web-docs
    or
    cd ~/web-docs
    Two dots (..) refers always to the previous level directory and tilde (~) refers to your homedirectory. Notice that you have different home direcotories in Linux and Unix.

    cp oldfile newfile

    Copies oldfile into newfile. If both files are in the same directory you don't need to give full path names. E.g. write
    studyplan.htm studyplan25_09_06.htm
    If you want to copy a file to another directory with a new name, you should write the full name of the new file. E.g.
    cp studyplan.htm ~/web-docs/studyplan25_09_06.htm
    copies the file studyplan into web-docs and gives it name studyplan25_09_06.htm.
    If you want to keep the file name and just copy it to another directory, it is enough to give the address of the new directory. E.g.
    cp studyplan ~/web-docs/

    mv oldfile newfile

    Moves oldfile to newfile. Notice that it destroys the old file! Otherwise similar to cp.

    rm file

    Removes file file.

    mkdir dir

    Creates new directory dir under the current directory. E.g.
    mkdir sciwri
    If you want to create a new directory somewhere else, you should give the full path name. E.g.
    mkdir ~/sciwri
    creates directory sciwri under your home directory.