This page introduces other useful commands that we have not discussed so far. Commands such as clear, exit, wc, whoami, and [Ctrl-c] will make working in Unix easier. The reader interested in additional Unix commands, can browse them using xman or see Unix Online Help for other options on getting help.

The clear Command

This command clears the xterm window for us. When the window is cleared, the xterm prompt appears at the top of the window. To execute this command, we simply type:

% clear

The exit Command

The exit command kills the xterm from which it is executed. Note that exit only kills the xterm, it doesn't kill any programs that are called from that window.

The wc Command

wc displays the count of lines, words and bytes in one or more files. If we execute wc on more than one file, then it also gives a total count. The command has the form:

% wc [option] filename [filename]
where option is an optional list of options, filename is the name of a file, and [filename] is an optional list of filenames.

To execute wc on the files hello.txt and example.txt, we would type:

% wc hello.txt example.txt
and the output would look like:
39      84     975    hello.txt 
37      37     75     example.txt 
76      121    1050   total 

Starting from the left, the number of lines, words, bytes and the filenames are shown in the first, second, third and last column respectively. The third line displays a total for each type of counts.

If we find that wc produces too much information, then we can use the options -c, -m, -l, and -w to extract out a particular piece of information. These options have the following meaning:

Option Function
-c Count Bytes
-m Count Characters
-l Count Lines
-w Count Words

To count the words in the file hello.txt, we would enter:

% wc -w hello.txt
and the output would be:
84 hello.txt

The whoami Command

This command shows the name of the user(s) who is/are currently logged into the system.

The Key [Ctrl-c]

We can type [Ctrl-c] in the xterm window to kill a program started from this window, and that is currently running. This is usually done when we have a program that goes into an infinite loop.

The finger Command

To learn who else is logged on a particular machine, we can use the finger command. This command has the form:

% finger [username]

where username is the name of a user. When the finger command is run without any argument, it simply lists the people who are currently logged in. For instance:

valdes<1> finger
Login       Name               TTY         Idle    When    Where
godel    Sean Godel            pts/1         3d Fri 16:44  cider.cs.ubc.ca     
cs219    CS 219 course accoun  pts/2            Mon 22:23  patrice.home.cs.ubc.

If we supply a user name to the finger command, then it displays information about that specific user. For instance,

Login name: a1a1                   In real life: Joe Smith 
Directory: /home/a1a1              Shell: /bin/csh 
On since Jun  8 09:11:50 on pts/93 from xt000a.cs.ubc.ca 
20 minutes Idle Time 
Mail last read Wed Jun  7 12:03:24 2000 
No Plan.