University of Minnesota Duluth People | Departments | Search UMD
ITSS
Search ITSS:

UNIX commands

Following is a list of commonly used UNIX commands used on UMD central system computers such bulldog. Of special interest is the umenu command, which displays a menu of frequently used UNIX programs and utilities; the gopher command, which connects you to UMD's on-line information system; and the man command, which displays the UNIX on-line documentation about a specific command.

cat filename
displays the file called filename on your terminal screen (see more for displaying a file one screen at a time).

cc -o filename filename.c
compiles the c program in filename.c and creates an executable program (if there are no errors) in filename. Note that the .c suffix is required for the c source filename.

cd dirname
changes the current directory path to include dirname. For example, if you have used mkdir dirname to create a new directory, you could then use cd dirname to "move into" that directory. Any files created after the cd will be stored in this directory.

diff filename1 filename2
checks the two files to see if there are any differences between them. Very useful for comparing an old version of a program to a new version.

cp old-filename new-filename
makes a copy of old-filename in a file called new-filename. If new-filename already exists it will be replaced.

enscript filename
sends the contents of filename to the default laser printer is for your account.

  • To print to the printer in MWAH 177: enscript -Pmwah177 filename
  • To to print to the general lab queue: enscript -Plaptop filename

    The enscript command has many options. For details enter: man enscript

    One nice feature for reducing the number of pages is to print 2 reduced pages across the width of each page (known as landscape mode). The enscript option to do this is -2r, e.g. enscript -2r -Plaptop filename

    f77 -o filename filename.f
    compiles the FORTRAN 77 program in filename.f and creates an executable program (if there are no errors) in filename. Note that the .f suffix is required for the FORTRAN source filename.

    grep pattern filename1 filename2
    searches for all lines matching the pattern specified in all of the files specified. grep

    history
    prints out the last n (usually 20) commands you have entered. You can re-execute any command listed by entering a ! followed by the number associated with the command on the history (for example: !10 would re-execute command #10).

    lpq
    displays a list of the files waiting to print on your default printer. To see a list of files waiting to print on the laser printer in MWAH 177 enter lpq -Pmwah177

    ls
    lists the names of the files in your current directory.

    ls -l
    lists the names of the files in your current directory giving more information such as when the files were last modified, what protections they have, and how many characters long each file is.

    man command
    displays the manual page(s) for a specific command on your screen. For example, you can find out more about man by entering man man, or find out man ls.

    mkdir dirname
    creates a directory called dirname. A directory can be thought of as a folder containing other files and directories. Usually, directories are used to organize the way files are stored on UNIX. For example, you might have a source program directory, an executable file directory, and a documentation directory (see cd).

    more filename
    displays the file called filename on your terminal one screen at a time. After displaying a screen, more prompts you with a line like "--more--" at the bottom of your screen. Press the space bar to obtain the next screenfull, or type a "q" to quit displaying the file.

    mv old-filename new-filename
    renames the file old-filename to new-filename. If new-filename already exists it will be replaced. mv can also be used to do other things (enter man mv for details).

    pico
    a simple, easy-to-use, text editor. pico provides on screen menus and on-line help. pico is the editor used within the rm filename
    deletes the file called filename. Usually the system will ask you if you are sure, and you must reply by entering a "y" to remove a file. Note that the removal of a file is permanent - do not rm a file that you might need.

    rmdir dirname
    removes the directory dirname. Note that all files that exist in dirname must be removed (see rm) before you can use rmdir.

    script
    makes a copy of your terminal session in a file named "typescript". script must be stopped by entering a "CTRL D" (hold down the CTRL key while typing a "d"). script writes the terminal session (including everything you type and everything the computer types) into the file named "typescript". After you stop script, you can print the file typescript by entering: print typescript. script must be stopped before UNIX will allow you to log off, so if you see the message "Not login shell", try entering a "CTRL D".

    tin
    tin is a program for reading and posting to Usenet newsgroups. It is also available from umenu (see below). See IS handout U10: Using tin.

    umenu
    an easy-to-use menuing system that presents you with most of the commonly used options people use the UNIX systems for, including electronic mail, reading campus announcements and other Usenet news groups, changing your default printer, connecting to gopher, and working with your central system files.

    vi filename
    edits the file filename using the vi editor. vi is a powerful, although somewhat complicated editor useful for writing and editing computer programs. A handout containing commonly used vi commands is available in the UMD computer labs or from the Information Services Help Desk. The following sequence of characters will always get you out of vi (type them carefully, and ignore whatever you see on your terminal): ESC : w q (the Escape key, the : key, the w key, the q key,) and then press <return>. Upper/lower case matters - do not use the capital W or Q keys.

    who
    prints out a list of users currently logged onto the system.

    w
    prints out a list of users currently logged onto the system, and includes what they are currently doing.




    Did you find what you were looking for? YES NO
    ©2003 Regents of the University of Minnesota. All rights reserved.
    The University of Minnesota is an equal opportunity educator and employer.
    Last modified on 10/06/05
    Contact ITSS | Privacy