The UNIX operating system is a very complex and powerful operating system and the backbone of Bucknell's extensive network of computers. In this lab we just introduce you to a few basic UNIX commands. Then, each week, we will introduce a few more commands and/or new options for previously discussed commands.
Once again we refer you to The Guide. This time read section 4.1 and do the examples shown. In the first paragraph of section 4.1, note the words in parentheses:
(possibly a shell window)This refers to the Terminal window that you opened in the previous section. If you don't remember which one this was, look at the title bar for the word ``Terminal''.
Once you have worked through the examples of section 4.1, the date, and you think you have a handle on what you did, try the look command as follows -- be sure to leave a space between `look' and `frus':
look frusLater you will be asked to give a written explanation of what you think look is used for. In your explanation, try to point out the connection between what the word ``look'' means and what the command does. Please Note: this is not a trick question and can be answered in a few short sentences.
The next commands are likely to be among the commands you use the most this semester. It is very important that you pay attention to spacing in these commands -- many of your early problems will stem from putting spaces where they don't belong or leaving spaces out where they do belong.
The first is the cp (copy) command, which is discussed in section 4.3.5 of The Guide. Later in this lab, you will be asked to load an IBM (Itty Bitty Machine) program into the IBM and run it. The filename of this program is lab1.ibm. (The ibm extension doesn't really mean anything except that it serves to remind humans that the file is an IBM program. We could just have well called the file: lab1.eatworms.)
The file lab1.ibm is currently located in the directory named
~cs203/Labs/Lab1
. (We know we haven't told you what a directory
is yet (a ``folder'' in Windows or Mac terms). We're saving that for
next week.) You can copy the file to
your own account by executing the following UNIX command:
cp ~cs203/Labs/Lab1/lab1.ibm .
Beware! There is a space after the command cp. There
is no space between the tilde character ~
and cs203.
The only other space on the line is between the ibm and the
final period `.'. That final period is an important part of
this command line!
The cp command instructs the system to copy the file lab1.ibm from the
~cs203/Labs/Lab1
directory into your account and name the copy
of the file lab1.ibm. Issue this command now; be sure
you include the final period with a space before it.
The last part of this lab requires another file you do not yet have. Issue the following command to put a copy of tutorial-1 in your account:
cp ~cs203/Labs/Lab1/tutorial-1 .
To verify that these files were correctly copied into your directory, we will use the ls (list) command. This command is discussed in section 4.3.6 of The Guide; try out the examples in this section and make sure you have a fair idea of what the command does. You should see the files lab1.ibm and tutorial-1 in your list of files. If either file is not there, look at what you typed and compare it to the appropriate command above. If everything matches and you don't have the file, ask for help. If you typed in the command incorrectly, try it again. Make sure you have these files in your account before you continue.
At this point, we need to make some minor changes to the default settings in your ``log in'' files. The Engineering Computing Support Team has made this easy for us. Simply enter the following command:
new_dotfilesIf it asks to ``overwrite?'', type ``y'' and press Return. Now that your login defaults have been changed, you must log off and log in again in order for the changes to take effect. Do this now.
The final command we discuss is one that allows you to print files. To output the file lab1.ibm to the printer in your lab you would issue the following command (Don't issue this now!):
lpr lab1.ibmIt is convenient that the system is setup so that when you use a command with this form the output will always go to the printer in the lab where your current machine is located.
But if, for some reason, you want to print to a printer in a different room, you must slightly change the form of the print command to include an indication of the printer to use. If you take a look at section 4.6.1 of The Guide you will find a list of the names of printers in various rooms and labs. For example, to output a file to the printer in Dana 231 (from any room) you would issue the following command (don't do it now):
lpr -Plwc lab1.ibmor equivalently
lpr -Pdana231 lab1.ibmIt is convenient that there is a naming scheme which identifies printers by building and room number.
Now, print a copy of lab1.ibm to the printer in your lab by using the first command above:
lpr lab1.ibm
Knowing how to output files to any one of the several printers listed in The Guide is an essential skill. Throughout the semester, there will be times when one or more of these printers is not working; to make matters worse, the room where the only working printer is located may be hosting a class at the time you need to print. Since students have access to so many printers, the line, ``The printer wasn't working.'', is not usually an acceptable excuse for not handing programs in on time.
Make absolutely sure you understand before continuing.