aphid cricket hippo macaw rattlesnake tiger bumblebee frog hornet monkey rhino tucan cardinal gator jaguar newt scorpion turtle chameleon giraffe koala peacock swan viper cicada grizzly ladybug perch termite zebra cobra hare lion python tickThe server of these PPCs is named powered.
If you do the remote login, use the command telnet or rlogin, for example,
telnet monkeywill get you into the machine named monkey. The terminal will be displaying a message like
AIX Version 4 (C) Copyrights by IBM and by others 1982, 1994. login:UNIX systems are case sensitive; upper and lower case characters are treated as different. UNIX systems generally use lowercase characters.
All commands should be typed in lowercase characters. All users on a UNIX system are assigned their own usernames. When they logon to the system, they are placed in a HOME directory, which is a portion of the disk space reserved just for them.
Now type in your allocated username.
UNIX asks for your password. Now type in your allocated password. Note that the password is not displayed on the screen as you enter it.
login: shao shao's Password:UNIX checks the username and password you typed, and if correct, will run the shell program for you. The shell program is your interface to the system. It presents the following messages,
******************************************************************* * * * Welcome to AIX Version 4.1.3 * * * * * * * * * ******************************************************************* # 8-02-95 Still in the experimental stages, but we are moving ahead... man -k ( and whatis db ) exported to clients -- please report any missing man pages or whatis entries to email@example.com or firstname.lastname@example.org Do NOT reboot the zoo nodes by using the power switch try a dsac member or mail to requests from another machine if the machine is locked up for more than a couple minutes Suned file systems --> powered early AM 8/22/95 ( powered back up late 8:22 AM -- early PM?? with new links ) Last login: Fri Aug 25 10:02:08 1995 on /dev/pts/4 TERM = (xterm)If the line
TERM = (xterm)is displayed, and you are logging in from the console whose type is xterm, just type return. Otherwise, you need to enter the correct terminal type. Parameters can be
vt100 vt102 vt200 ansi sun ......The parameter must match that of the telnet configuration file. Enter the appropriate terminal type for your system (should be vt100 most of the time).
UNIX is ready to interpret and execute your commands.
When a user logs in to a UNIX system, they are located in their own directory space. Users are generally located off the /server/homes/classes/cs210/class directory. The pwd (print working directory) command displays the pathname of the current directory you are in. This is helpful when you want to know exactly where you are.
* manipulate files - create, delete, append, concatenate, display, move - count the number of lines, words, characters - extract lines - sort - change permissions on files - print files - search for text strings within files * manipulate directories - create, delete - display contents * change your password * use basic commands - display a list of users - display messages and news - time commands - obtain help on command usage - run programs in the background - display the shell environment variables
This command locates and prints the reference page for a specified item. Now type the command,
man lswill list the online manual for the command ls. The : represents a prompt. Pressing enter will continue the display. To quit from the manual, type q. If you want to print some oneline manual pages on a printer, check out the piping commands.
This command is similar to DIR in DOS; it displays a list of all the files in the directory. New users don't have many files in their home directory.
Now type in the command
lsYou will note that the shell prompt reappears, and there is no file listing of the directory contents. This does not mean that there are no files stored there. Just like DOS, UNIX systems support hidden files.
UNIX systems extend the power of commands by using special flags or switches. These switches are one of the most powerful features of UNIX systems. Switches are preceded with a - symbol.
Now try the command (to illustrate the use of switches)
ls -laThe switch l stands for long listing, and the a switch is for all files, including directories and hidden files. UNIX responds with the following listing of the directory
ls -la total 6 -rwxr--r-- 1 xtest cs210 240 Aug 28 10:40 .loginLets explain what all this means.
permission settings | | number of links to file | | | | owner of file | | | | | | group | | | | | | | | size of file in bytes | | | | | | | | | | date/time of last modification | | | | | | | | | | | | filename | | | | | | | -rwxr--r-- 1 xtest cs210 240 Aug 28 10:40 .loginThe first part reveals the permission settings of the files (-rw-r--r--). These have the codes as follows
d directory r read w write x execute - no accessNote that there are three sets of permission settings.
specifies whether a directory entry | permissions for the owner of the file | | permissions for group members | | | permissions for others | | | | - rw- --- ---WHAT are the permission settings for the file .cshrc in the current directory?
owner = ........... group = ........... others= ...........
Is a utility used to combine files or typing files to the screen. The cat command sends its output to the console screen (in UNIX we call this standard out or stdout for short).
Now try the following command to view the file .login on the screen.
cat .loginThe format of this command specifies that the cat utility is to use the file .login as its input, and send the output to the console screen.
Now try the command
cat - > tempThis specifies that the input is from stdin (- means the keyboard), and writes the output to the file called temp (> means dump into).
Now try the following lines of text (ignore any typing mistakes, and do not use the cursor arrow keys).
Small change got rained on by his own 38 down by the arcade, The marquees weren't weeping, they went stark staring mad, and the cabbies were the old ones who really had it madePress CTRL d to terminate text entry, and the shell prompt returns. What is the command used to view the file temp on the screen.
The cat utility can also be used to join many files together into a single file. The command,
cat temp .login > temp1copies the two files (temp and .login) to a file called temp1. What is the command you would type to copy the file temp to a new file called temp1 using the cat utility.
The > > is used for appending to an existing file,
cat temp >> temp1
This command is like cat; it also displays the file, but instead , it displays the file screen by screen. This is extremely useful if you are reading the source code in a terminal.
For example, to read the file named README, try the following:
more READMEAlternatively, you can always read a file by openning it inside emacs.
This command stands for copy, and is used for copying one file to another.
Now try the command
cp .login temp2This copies the file .login to another called temp2. If temp2 had already existed, its previous contents would've been erased.
Files can also be copied to another directory. The command
cp * /usr/tmpwould copy all the files in the current directory to the directory /usr/tmp.
What is the command you would type to copy the file temp to a new file called temp1 using the cp utility.
The mv command is used for moving or renaming files. Now try the command
mv temp temp2This renames the file temp to temp2.
As an example (do not type this), the command
mv temp2 /usr/tmpwould move the file temp2 into the directory /usr/tmp (it would no longer appear in your home directory).
The rm utility is used for erasing files and directories.
Now try the command
rm temp2This removes the file. Once a file is removed, it cannot be restored. To cover situations where mistakes might occur, a switch -i appended to this command will request a Yes or No response before deleting the file.
Now try the command
rm -i temp1NOTE that switches are written before the filenames. Answer Y to the prompt so that temp1 is removed (Normally, people like to set the -i switch as the default).
This is used to view the first few lines of a file. It accepts a switch specifying the number of lines to view. The command
head -2 tempwould list the first 2 lines of the file temp on the console.
What is the command to view the first 10 lines of the file .login.
This is used to view the last few lines of a file. It accepts a switch specifying the number of lines to view. The command
tail -2 tempwould list the last 2 lines of the file temp on the console.
What is the command to view the last 10 lines of the file .login.
This command is used to obtain a hardcopy printout of a file. ONLY type this command IF a printer is attached to the computer system.
lpr tempTo use a particular printer named pname, type
lpr -Ppname temp
This command is also used to print out a file, but the printout looks much better than lpr.
enscript tempThe switches enscript accepts are
-r printing in the landscape mode -2r two column printing -G add a nice header (good for printing source code) -Ppname printing on the printer named pnameOften, people prefer to use the following options to print a REAL NICE looking listing for the C code:
enscript -2r -G hello.cCertainly, you can still specify a particular printer
enscript -2r -G -Ppname hello.c
pwd print current working directory cd change directory mkdir make a subdirectory rmdir remove a subdirectory
Prints the current working directory on the console screen. In UNIX, the hard disk area is divided into directories, much like abook is sub-divided into chapters and paragraphs. The directories form a hierarcherical level, which simplifies the organisation of the files on the system. The top most directory in UNIX is called root, and consists of a number of subdirectories grouped according to function.
bin system binary executables boot file for UNIX boot code dev file names for system devices, terminals, disks etc etc system administration files and tools, system scripts lib library routines lost+found unreferenced files are placed here by fsck tmp scratch pad directory for temporary files. users must have read/write access unix unix kernel usr application and system specific informationAs you can see from the previous directory tree, there are lots of sub-directories underneath root.
In the space provided below, enter your current directory (use the pwd command).
........................................When you use the ls command to list the file contents of a directory, those entries which are directories are preceeded with a 'd' character. The sample screen below shows this.
ls -la total 19 files drwxr-sr-x 3 xtest 512 Nov 24 12:05 . drwxr-sr-x 46 root 1024 Nov 23 16:46 .. -rw-r--r-- 1 xtest 2501 Mar 3 1992 .login drwxr-s--- 2 xtest 512 Nov 24 12:05 datafiles -rw-r----- 1 xtest 0 Nov 24 12:05 dirlist -rw-r----- 1 xtest 24 Nov 5 08:59 tmpNote that datafiles is a sub-directory. There are two other subdirectory entries in the listing.
. the current directory .. the parent directory (upwards towards /)
This command is used to change the current directory. For each of the following commands, enter the current working directory after the command is executed.
cd . ................................... cd .. ................................... cd / ................................... cd $HOME ...................................
This command makes a sub-directory under the current directory. In the space provided below, enter the command you would use to create a sub-directory called junk.
This command removes (deletes) a sub-directory under the current directory. In the space provided below, enter the command you would use to delete a sub-directory called junk.
To illustrate how this works, consider the following command.
ls -l | wc -lThis creates a pipe between the output of the ls utility and the input of the utility wc. The command runs ls, which lists the contents of the current directory, feeding the output into wc which prints the line count on the standard output.
Similarly, we can use the piping commands to send the online unix help files to a printer, the command
man ls | enscript -2rwill print the manual in two column using the enscript command described above. A pipe inter-connects two programs together.
All users in UNIX are assigned passwords. Currently, there is a password assigned to the user. This is changed using the passwd utility. The user would type the command
passwdThe utility asks for the new password (twice, to make sure you didn't misspell it). The user types in the new password, but notice that it will not displayed on the screen when typed (for security reasons).
The new password would then be in effect. If the user were to log in again, the system would ask for this password to be typed before allowing access.
This is handy for such things as printing documents, as it allows you to continue doing something else instead of waiting for the document to be finished printing.
Each process in UNIX is identified by a PID (process identification number). When a background process is started off, UNIX will print its PID number in square brackets.
Now try to type the command
ls -l > dirlist&NOTE that the shell prompt immediately returns, and a number in brackets is printed. The & character signals to the shell that the command is to run in the background.
2868This is the PID number of the background task. You can have more than one background task.
Sometimes, you may want to shut down a background task. The kill command is used to shutdown a task, and it accepts the PID number of the task to shutdown.
This utility displays a count of the number of characters, words and lines in a file. Now try the command
wc tempThis prints out a list of the number of lines, words, and characters respectively.
The switches for this utility are
-l print line count -c print character count -w print word count
This command displays a list of the users of the system. Using the -u switch displays a list of those users currently logged into the UNIX server.
Now try the command,
The grep command searches a file for a pattern. The following command
grep 'change' tempsearches the file temp in the current directory for the text string change. Using the * wildcard specifies all files, and using the switch -n will display on which line the text string is found.
This command times how long it takes to execute a given command. Now try the command,
time ls -laThe command responds with the elapsed time during the command, the time spent in the system, and the time spent in execution of the command.
Exercise: How long does it take to execute the who command?
This command reports on the active processes being run.
Now try the command,
psYou may even see the sleep process listed if it is still running in the background.
gcc hello.cThis will produce a file named a.out, which can be executed by just typing:
If a program contains multiple files, you should use the make facility. Alternatively, you can do it in the command line by typing
gcc main.c foo.c bar.h bar.cassuming your program contains four files main.c, foo.c, bar.h, and bar.c.
If you want the resulting executable to be named by names other than a.out, use the option "-o"
gcc -o main main.c foo.c bar.h bar.cthe first string following "-o" is the file name for the resulting executable. Alternatively, you can always rename the a.out file to the file name you want (using the mv command).
Sometimes, even though your program contains multiple files (e.g., main.c, foo.c, bar.h, and bar.c), you still want to compile one at a time; with this, you can debug syntactic errors file by file. This is done via the "-c" option, typing
gcc -c main.c gcc -c foo.c gcc -c bar.cThe resulting binary from the above compilations will be three object files called maino, foo.o and bar.o. You can then link them together by typing
gcc -o main main.o foo.o bar.o
You can access this home page by using netscape; just type
netscape http://zoo.cs.yale.edu/classes/cs210If you are working on character-based terminals, you can use lynx; type
Also, yale.cs.cs210 is a local newsgroup specifically for CS 210. Announcements and such will mostly show up on the course web page, but you may find the newsgroup handy for interacting with your fellow students, commiserating over the unreasonableness of the latest homework, and so forth.
You can also use netscape to browse yale.cs.cs210, or you can use rn to read unread news. To view unread articles in yale.cs.cs210 using rn, just type "rn yale.cs.cs210".
"man rn" will display the (very long) man page for rn. (The first time you use rn, it will display a brief introduction to its use.)
If you add the line "rn -c yale.cs.cs210" to your .login file, you'll be advised of unread articles in yale.cs.cs210 every time you log in.
Updated for Fall '98 by Jim Aspnes