This is the first in a series of elementary tutorials on the UNIX operating system.
Initially, all operating systems were command-line OSs, controlled by commands typed at a command line. For example, CP/M, DOS, and VMS are historically well-known examples of command-line operating systems. Indeed, if you've ever used DOS on a PC, then you're in for a pleasant surprise, since UNIX has a lot in common with DOS. If you've never used a command-line operating system, you're still in for a surprise...but perhaps not a pleasant one. To control a computer running UNIX, you have to remember many command names, some with a rather arcane syntax. I keep a small notebook handy to record new UNIX commands (yes, I'm still learning, even after many years), and you might want to do the same.
So let's try that. At the UNIX command line, type the following commands (but not the percent sign % or the comments at the right):
% script session1 | # begin recording session |
% cd | # change directory to home directory |
% pwd | # display present working directory |
% ls | # list files in the current directory |
% w | # list users currently logged in |
% finger | # list users currently logged in |
% ^d | # end recording session |
% ^d |
% more session1 | # display contents of file session1 |
Username: |
Username: trscavo |
Password: |
freeside:~> |
forbin:/home/u511/depend/trscavo 1 % |
Important note: Throughout this tutorial we will denote the UNIX system prompt as a percent sign % for both convenience and historical reasons. So when you see
% finger |
Okay, good, you've successfully logged in to your UNIX host. Now you need to know how to logout. This is done by typing
% logout | # terminate current UNIX connection |
Okay, enough warnings. Some simple commands that you can try are
% w | # display info about current users |
% finger | # display finger info about current users |
5:35pm up 7 days, 20:11, 11 users, load average: 0.25, 0.16, 0.11 User tty from login@ idle JCPU PCPU what mgjenks ttyp0 ethergate 5:31pm 2 1 pine besolins ttyp6 ethergate 5:08pm 3 1 lynx emho ttyp1 198.36.22.68 11:17am 6:17 3 2 pine pdrake ttyp2 ethergate 5:06pm 9 6 5 lynx cactus ttyp3 ppp68-166.dial.n 5:34pm 1 1 screen -r jlbehr ttyp4 198.36.22.74 5:22pm 1 1 -tcsh beaucham ttyp5 ethergate 4:39pm 1 telnet 128.194.4 lynx ttyp7 198.36.25.75 12:48pm 4:23 10 10 (lynx) trscavo ttyp8 ethergate 5:35pm 1 w djwake ttypb 198.36.23.66 2:33pm 2:30 1 1 -tcsh pmacee ttype 198.36.25.12 8:30am 8:41 1 1 (tcsh)lnetd)while the finger command produces the output
Login Name Tty Idle Login Time Office Office Phone beaucham Beauchame Branch Lib p5 Jan 17 16:39 (ethergate) besolins Bonnie Solinski p6 Jan 17 17:08 (ethergate) cactus Christopher Blizzard p3 2 Jan 17 17:34 (ppp68-166.dial.n) djwake Dan Wake pb 2:32 Jan 17 14:33 (198.36.23.66) emho Em Ho p1 6:19 Jan 17 11:17 (198.36.22.68) jlbehr Jason Behr p4 Jan 17 17:22 (198.36.22.74) lynx p7 4:24 Jan 17 12:48 (198.36.25.75) mgjenks Martha G. Jenks p0 Jan 17 17:31 (ethergate) pdrake Paula Drake p2 10 Jan 17 17:06 (ethergate) pmacee Patricia M. Acee pe 8:42 Jan 17 08:30 (198.36.25.12) trscavo Tom Scavo p8 Jan 17 17:35 (ethergate)You can learn a lot about UNIX just by studying the output of the w and finger commands! The finger command is especially useful since, unlike the w command, it lets you query other UNIX hosts besides the login host. Other examples of the finger command will be found elsewhere in this tutorial.
% script <filename> | # begin recording session |
... | |
% ^d | # end recording session |
% cd | # change directory to home directory |
% pwd | # display present working directory |
% ls | # list files in the current directory |
% more <filename> | # display contents of file <filename> |
% w | # display info about current users |
% finger | # display finger info about current users |
% logout | # terminate current UNIX connection |
The next in this series of tutorial documents is entitled "Navigating Directories with UNIX".