Unformatted text preview:

Astronomy 350: Unix Lab• Go to the Moxie Lab. Logon using your Oswego email username and pass-word. Find the command to logout and execute it.• Login again and then type the following: ssh -X -l guest 129.3.17.53.• The system will ask you for a password. Type abc123 and hit enter. Nowyou are logged into one of my Linux machines. Type Logout and describ ewhat happens. Type logout and describe what happens. What do youconclude?• Log back in to my machine - with the IP number 129.3.17.53 as given above.• Type ls. What do you see? These are the files in your home directory. Thehome directory is located a t /home/guest.• Type cd .. and then type ls. What do you see? You have gone one level upinto the home directory.• Type cd guest. What happens.• Type pwd and describ e what happens. Type cd .. and then type pwd.What does the pwd command do?• G o back to your home directory. A quick way to do this is to type cd• Verify you are in your home directory by using pwd.• Use ls again to examine the files in your home directory.• Type ls -al and describe what happens. The extra information displayedoccurs because of the options -al used on the ls command. Type man lsand describe what you see.• man is a Unix/Linux command to help you learn about other unix/linuxcommands. Type man man and describe what happens.• Find o ut about the commands cp, df, more, mkdir.• Type to uch a and then do an ls. What do you see and hence describe whatthe command to uch does.• Now type rm a and then do an ls. What happens? Thus you need to usethis command very carefully.• Now cd back to your home directory.• Now we are going to tackle editing files.1– I like to edit files using the editor vi. There are other more powerfuleditors but this is the one I know. It has the advantage that it can beused in most situations.– Type vi a and press return.– You should see a black cursor at the top left hand of your screen andlots of twiddles.– Hit o and the cursor moves down one line. Now type This is the firstline. Hit enter. Then press the escape key. The hit the shift key andthe colon button simultaneously folaowed by wq and then enter.– You should leave the editor vi and get ba ck to the original Unixprompt.– Type ls and you will see your file a is still there.– Type more a and you will see that the file a contains the line you typedin.– Start up the editor vi again. Use the cursor arrow keys to move aroundthis line. You wont be able to move down a line because there is onlyone line in the file.– Position the black cursor using the arr ow keys at the first character inthe file.– Hit o again and type in the line This is the second line press enter andthen type This is the third line.– The hit escape and do the shift control wq command to exit vi.– Look at the file using more and you will see that it has more lines now.– Open the file again with vi and mover around the file using the cursorarrow keys.– When the cursor is over one character, you can type x to delete thatchara cter.– When the cursor is over one character, you can use r to replace thatchara cter.– When the cursor is at the start of a word or a string of characters typecw to change that word. After you have typed in the replacementword, hit escape to end the cw.– Using a you can append from where the cursor is positioned currently.Use escape to end the append.– You can delete a line by positioning the cursor on a line and typing indd.2– Practice these edits on your file. You can abandon the edits you havemade and revert t o the original version of the file by hiting shift colonfollowed by q!.– This will throw away the edits you have made in this session.• In your home directory t here is a file called test.f. ls it and more it. Whatdo you think it does?• Type g77 test.f. Then type ./a.out and describe the result.• Use vi or whichever editor you like to change the program so that it printsout the result of 2+2+2.• This is real computing: editing a program yourself, running it and lookingat the


View Full Document

OSWAGO AST 350 - Astronomy 350 Unix Lab

Download Astronomy 350 Unix Lab
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Astronomy 350 Unix Lab and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Astronomy 350 Unix Lab 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?