Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CENG151-Assignment#1 The goal of this assignment is to give you some experience in dealing with Unix commands and with editing a file using vim. Work

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

CENG151-Assignment#1 The goal of this assignment is to give you some experience in dealing with Unix commands and with editing a file using vim. Work individually. If the commands do not work for you please ask for assistance. Comments begin with a \# - you don't have to type these in. The 1st word in a command line is the command. Spaces are important. ps -a displays all of your process. ps-a is just a bad command. 1. Information about you and your session: (7 marks) Issue the following commands in the terminal window. Record results that take up one line and summarize what the command does in general terms. Don't copy the output extract the information requested. This shows that you've read and interpreted the result. Anyone can run a command and copy the output. That's not what gets you marks. The marks are for showing awareness of what is happening and why.. a) who \#record the user id's and tty info on 2 other users. If there aren't any other users then document this but since this is an in-class exercise there should be. Based on the terminal information who is your and their ISP or IP address? b) Issue the commands whoami and then, on a separate line, who am i. These commands are useful if you have several accounts or several different log in sessions. What's the difference between the two commands? c) tty \#what is the identity of your terminal tty --version \#2 dashes before version. Which version of the cmd is used? man tty \#Who is the author of the cmd. Are the version \#s the same? Use putty to log on to a 2nd terminal window. What is the identity of the 2nd terminal? Stay logged on in both windows - you'll need it in Q2. d) Issue the command pinky (on older systems it used to be called finger) Describe the differences between the output of pinky and who. e) echo SUSER ps -u \$USER ps -u anotherUserid What is the nature of the value SUSER. ps -u \$USER Which command(s) are you running on your current terminal and what are their process ids? For any other user, what commands are they running on their terminals and what are their process ids. f) id username Use the id command to identify yourself and one other user. Report just the numeric user id of both and list the group names that each of you belong to but no other information. (screen shots will be marked as incorrect answers) g) Issue the command: last -w SUSER Exactly when did you first and last log into Unix according to the system log? Because you are supposed to be logged in twice there should be at least 2 entries. Substitute \$USER with the user name of any other user and record the cmd you used. Based on the result when was that last time they logged in and from where? (If you or they have used the system before in 2022 you'll get a longer output.) Note: Without the -w flag the last digit of a student username is left off. 2. Information about the system (7 marks/a-c 1 mark, d,e - 2 marks) Run the following commands, and summarize in your own words what they what they do using man command as a reference. Use your 2nd terminal window to view the man page while you test the commands in the 1st (6 marks) a) uptime Record the output. Consult the man page for uptime and summarize, using the specific values displayed, what the command says about the system load averages and when the system was last restarted. b) Issue the command lscpu. What is the speed and make and model of the CPU? c) Issue the command free. - How much memory is available? How much memory is used? - As a \% how much free memory is available? - Review the man page for free and then try free b, free k, free m and free g. In which units of measurement does free without a flag display? d) Issue the following command: hostname -I For each of the ip addresses listed issue the command: whois ipAddress | less - Which organization owns each address? - Run the last command and record the ip address and user name of any user who is not currently logged and who's ip address does not start with 192. - Use whois to determine who their ISP is. - Use the command pinky -I username to determine their real name. (That's the letter el after the dash, not a one. (2 marks) e) Run the htop command with no options. This will give you an overview of activity in the system. Identify two items of information that are provided by other commands covered in the assignment, and what these commands are. Identify two other items about the system that are new. When you are done, type q to quit. ( 2 marks) 3. Introducing Files (2 marks each/6 total) Record your answers as you do each part. If you need to and you missed something you can restart this exercise from the beginning. Focus on mostly on the ideas these commands are displaying and changing rather than the exact values. a) Create 2 files using the touch command. touch file1 file2 Wait a few seconds and create 2 more files, one where the file name comes alphabetically before file1 and file 2 and one where it comes after. Run the following commands: (Is stands for list subdirectory) Is Is -l \#that's dash followed by the letter el and not a number one There's more information there than you can immediately process but: - In what order are the files presented - What information about the files is revealed? b) Apply the following command to both file 1 and file2, and then apply it to the other two files that you created. stat file1 file2 - What new information about these files is revealed? - What old information is repeated? c) Review the man page for touch and look up what the two touch commands are supposed to do, then run them. touch -a file1 touch m file2 Rerun the ls and stat commands on both files. - Which of the 4 times shown by the stat command is displayed by the sI command? (You may wish to revise your answer in b). - Why do you think Unix has two commands that appear to do the same thing? What kind of task would be better for each command? 4. The vim tutorial (4 marks) Type in the command: vimtutor Follow the instructions up until the end of Lesson 2.7 of the tutorial then exit the tutorial using the command :wq. This enough to let you edit a file. Make a set of notes on the commands learned - hand in these notes with Part I of the assignment An overview of how to use vim appears on the next page. There is some overlap with the tutorial

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Students also viewed these Databases questions

Question

=+ (a) Show that P(U"_[X ,, = j i.o.]) =0 for all i.

Answered: 1 week ago