Skip to main content

4. Linux utilities

1. who and w

To find out which users are logged into the machine as well as yourself, type who. This command comes with many options. Read the man pages to find out more. The output of who comprises several columns. The first column gives the userid's of all users logged in, the second column lists the terminal where each user is logged in, the next few columns give the date and time when each user logged in, and the final column gives the network address of each user. Below is typical output for the who command:

cudcu      pts/5        Aug  2 10:22    (mimosa)
eosbab     pts/43       Jan 27 07:48    (curiousyellow)
phrjf      pts/9        Aug 12 15:18    (
eosbab     pts/10       Aug 30 07:54    (lorretta)
marxaj     pts/11       Aug 24 09:04    (
phsday     pts/90       Jul 14 08:10    (
stsbm      pts/58       Aug 30 09:57    (kiki)
cudau      pts/113      Jul 14 10:17    (flaky)

You can go further than this and use another command, w, to find out what current process each user is running on a given machine. Again, just type w at the terminal and hit return. The output is similar, except now there are some columns giving CPU time used, as well as the name and arguments of each current process (under the heading what. Below is typical output for the w command:

User     tty           login@  idle   JCPU   PCPU  what
aosaaf   pts/31       10Mar05 2days  13:38  13:38  ssh primrose
ccscab   pts/36       11:39pm 11:42      2      2  pine -i
cudcu    pts/27        2Aug0528days   2:03   2:03  mutt -f /home/unit/cu/dcu/Mail/r
phsday   pts/46       14Jul05  1:47   2:27      1  -tcsh
mssbal   pts/50        8:47am           24     12  w
helpdesk pts/51        8:48am           12      1  pine -i
cudcu    pts/34       19Jul0525days   5:53         -tcsh
cusbae   pts/56       20Aug05 10:51   1:09     25  pine -f MAILBOX -i
helpdesk pts/64        8:19am    19      8         pine -i
pssbx    pts/67       11:14am    12                pine
cudbu    pts/52        8:55am     9     34     30  /package/StarOffice/sparc/Office

Back to top

2. Getting the time and date

To get the current time and date as set for your machine, just type date and hit return.

Back to top

3. Displaying a calendar

You can display the calendar for the current month this year (or at least according to the date your machine is set for), by typing cal and hitting return.

cal comes with a few options. Typing cal -y outputs the calendar for the entire current year. Typing cal year, you can display the calendar for any given year.

Back to top

4. Setting job priorities

When you launch a job from the command line, you can set the priority by using the command nice . the basic syntax of this command is:

nice priority number command

where priority number can range between 1 and 19 (see Section 1.10.3 to remind yourself about job priority).