Office of Information Technology
Home

Calendar

Map
Home
Computing

Library

Search

Commands

Users communicate with the Unix operating system by entering commands. Each command is the name of a program to be executed.

Format

The format of a Unix command is

<command> <-options> <arguments> 

Options are represented by letters of the alphabet and are preceded by a hyphen (or minus sign). There should be no spaces between the option letters and the hyphen. If the command takes an argument- --a filename, for example---then the argument is placed after the specification of the option(s). This order is important. Commands will not necessarily have options or arguments, but may have either or both. Remember that Unix commands, options and arguments are all case-sensitive. Unix commands themselves nearly always appear in lower case, as do their options. However, there ARE some upper case options to some commands. Therefore you should follow the format shown exactly. In later sections of this document you will find examples of commands with multiple options and multiple arguments.

Some Fundamental Commands

    date

    Runs the date program, which displays the time and date on the screen.

    who

    Lists current users.

    w

    Displays system user activity.

    wc plants

    Counts lines, words and characters in the file plants.

    write smith

    Allows you to start a "conversation" with another current user, in this instance, Smith. Enter <CTRL/d> to end the conversation.

    talk smith

    Full screen method for sending messages to another user's (here, Smith's) workstation.

    script

    Makes a record of everything printed on your screen during a session. The default name for this file is typescript. Use <CTRL/c> to exit from your script session.

    history

    Displays in order the last 20 commands you have executed. Should you want to re-enter a command, you can do so by typing an exclamation point (known in Unix as bang), followed by the command number. This can save a lot of typing if the command line is long. Bang bang (two exclamation points) will find and re-execute the last command entered.

    man date

    Accesses the "man page" entry for the command date. This is Unix's on-line help system, which mimics printed manual pages. Using man followed by the name of the command you want help on will produce first a depiction of the command's syntax, then a description of its usage, then a listing of its options and their functions, and then a notation of restrictions, if any, on the command. Finally, man produces a cross-reference to other related commands. Press the space bar to advance through man page entries, or the character Q to quit before you have reached the end.

    apropos copy

    Followed by a keyword (here, copy), this command prints out a one-line synopsis of manual sections containing that keyword. You can then turn to those manual sections for full information. This is a means of determining which commands are associated with which functions, and is a good way of broadening your knowledge of Unix.

    man -k copy

    H as the same effect as apropos.

    passwd

    Enables you to change your system password. Its usage is fully described under Introduction.

    exit

    Entered at the system prompt, this command severs your connection to Unix. The key combination <CTRL/d> will also log you out, as will logout.

Control Sequences---Another Type of "Command"

Commands are not the only means of directing processing under Unix- --control sequences are also available to generate a variety of interrupts in a working environment. You will note that entering a control sequence and executing it are simultaneous occurrences, as there is no need to press <RETURN>. To use a control sequence, press <CTRL>, and while you are holding it down, press the character key for the sequence you need.

Among the most common Unix control sequences are:

    <CTRL/d>

    Most useful of all---logs you out if you are at the system prompt, signals end of input, marks end of file.

    <CTRL/c>

    Interrupt sequence which aborts the current job and returns you to the system level.

    <CTRL/z>

    Suspends the current job. Does not abort it, as on VMS systems.

    <CTRL/r>

    Rewrites the current input line.

    <CTRL/u> 

    Erases the contents of the current input line, allowing you to start over.

    <CTRL/s> 

    Freezes the screen.

    <CTRL/q>

    Allows scrolling to resume.

    <CTRL/w>

    Erases one word.

    <CTRL/o>

    Flush or discard output.

 
Office of Information Technology • Main Office: ECS 125 • Phone: 410-455-3838 • Email: oit@umbc.edu