Menu

[Solved]-1 Give Command Single Command Pipelined Series Commands Performs Following Tasks Assume Ba Q37170594

1. Give the command (single command or pipelined series ofcommands) that performs each of the following tasks. Assume bash,and the commands we have been discussing. Do not use things likeperl, awk, python, etc. Unless specifically stated otherwise,assume that the command should work no matter what your currentworking directory is or where a user’s home directory is located.Use only flags that are required by the question as stated. Assumeyou are logged in as a “normal” (non-administrator) user, but thatyou have “administrative” permissions set up in the sudoers file incase you would be required to take advantage of that in order tocarry out any of these tasks. Use only single spaces between partsof a command/options/arguments, and do not put extra spaces beforeor after the answers.

m) Generates a list of the count of the number of processesrunning by each user, as identified by the “ps aux” command, withthis list sorted in descending order by count (so the user with themost running processes will be listed first and the user with theleast number of running processes will be listed last), and, ifmultiple users have the same number of processes those rows will belisted in alphabetical order by user login name. The output shouldbe the number of processes and the user login name for each userrunning processes. Ex: 15 smith 15 turk 10 williams

n) Store the count of the number of different users runningprocesses on the system (use data generated by the “ps aux”command) into a variable called “NUM_PROCESS_USERS”. To clarify,don’t count the same user multiple times, even if they’re logged inmore than once. (Also, don’t count the ps aux header line as auser…!)

o) Display the current date and time, as obtained and formattedwith the system “date” command, so that it shows the year, month,day of month, day of week, and time of day, in that order, informats such as are illustrated here: “2017 04(Apr) 07(Fri)13:25:55”. Notice the exact spacing, punctuation, capitalization,and zero-prefixing (where needed) to give exactly 2 digits in themonth and day of month numbers.

p) Take the information stored in the system-created USER, PWD,and HOME variables, and display a message formatted as thefollowing, using the information from these three variables:“turk’s home directory is ‘/home/turk’; the current workingdirectory is ‘/var/log’.” To be clear, this message tells who thelogged-in user is, what their home directory is, and what theircurrent working directory is, based on these three variables. Thisshould work for whoever is logged in, with whatever values arecurrently in these three variables. (These are system environmentvariables and are initialized by the system so you don’t need toworry about storing information into them.)

Expert Answer


Answer to 1. Give the command (single command or pipelined series of commands) that performs each of the following tasks. Assume b… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *