CSU Long Beach
CECS 274
Programming and Problem Solving II


Syllabus
Schedule
Grading
Project 1
Project 2
Solution to Project 2
Project 3
Solution to Project 3
Project 4
Solution to Project 4
Project 5
Set Solution to Project 5
Map Solution to Project 5
Lecture Notes
Basic Unix Commands
Basic vi Commands
More vi Commands
Using Eclipse
Compiling and Running Java on Unix


Mimi Opkins Home

Basic Unix Commands

    We will be working on the Unix operating system.  Here are some basic commands (and hints) to help you get started.

    When you login to your account you are located in your home directory. You can always specify your home directory by the symbol ~.  All files and directories within Unix are uniquely defined by their path. Imagine the following structure of files and directories:

     

    Suppose we are  interested in using an Ada program that is stored in a file test.a located in directory ada_files.  The full pathname which uniquely describes test.a from the home directory is: ~/ada_files/test.a.  If we are already located in ~, we could specify the file as: ada_files/test.a.  If we are located in ada_files, we need only specify test.a.

    For the commands listed below, the <dir> and <file> arguments are expected to be pathnames describing directories or files, respectively.

     

    What

    Command

    Description

    list contents of a directory

    ls <dir>

    List the contents of the specified directory; if none is specified, list the contents of the current directory.

    change directory

    cd <dir>

    Move to the specified directory; if none is specified, go to the home directory.

    copy

    cp <file1> <file2>

    Copy the contents of file1 into file2.  (Note: the contents of file2 are overwritten.)

    rename

    mv <file1> <file2>

    Rename file1 as file2.

    logout

    logout

    Exit your account.

    change password

    passwd

    Allows you to change your password.  This should be done the first time you login.

    display file on screen

    cat <file>

    Display the contents of the specified file on the screen.

    display file on screen

    more <file>

    Display the contents of the specified file on the screen one page at a time.

    create a directory

    mkdir <dir>

    Create a new directory called name.  A path may be specified for the location of the directory; if not, name is created within the current directory.

    remove a file

    rm <file>

    Remove the file specified.