If foo1 and foo2 are sorted files of usernames


Using vi, create a file called lab7Exercises.txt and put your answers to the questions below in the file.

Question 1. If foo1 and foo2 are sorted files of usernames (a username on each line), what command could you enter to display all usernames that are in both foo1 and foo2. Provide the command. 
Question 2. Provide a command to select just the second to last line of the /etc/passwd file and no other lines (using the head and tail commands). 
Question 3. What command would you enter to assign the month field of the date command (the 3-character code for the current month) to a variable called MONTH. 
Question 4. Provide a single command line that outputs the username for only the users who are currently logged in more than once. Each user's username should only appear once in the output of your command. 
Question 5. Provide a single command line that outputs the username for only the users who are currently logged in just once. 
Question 6. Create a command that displays the /etc/passwd file sorted based on Group ID (the number in the fourth field) and then alphabetically on the username field (the first field). Note that this means rows that have the same Group ID number should appear together with their lines sorted according to username. (3 marks)
Question 7. The ps -alf command gives a listing of all processes on the system. There is a line of output is provided for each process (only a few of the processes will be yours), which indicates a number of things including the username of the person running the process followed by the process ID number followed by other information such as priority (PRI). The first line of the output listing is a heading line. Give a command line that would give the same listing, but without the heading line. Hint: consider the +count option for the tail command as described near the beginning of section 9.7.
Question 8. Using the ps -alf command as a starting point, provide a set of commands piped in a sequence (like the examples of section 9.13) that lists a count of the processes each user has running. The list should be sorted in descending order by the count of processes so that the user with the most processes is diplayed first and the user with the fewest processes is displayed last. For example, after running the command, the output should look something like this:
6 dafduck
6 akennedy
4 brubble
4 bsimpson
3 tedwards
2 mcarthur
2 daemon
1 smmsp 

Request for Solution File

Ask an Expert for Answer!!
Programming Languages: If foo1 and foo2 are sorted files of usernames
Reference No:- TGS088184

Expected delivery within 24 Hours