Reference no: EM131274214
Read all of these instructions carefully, as they state some very specific details that will be assumed/expected when grading your answers.
Give the command (single command or pipelined series of commands) that performs each of the following tasks. Assume bash, and the commands we have been discussing. Do not use things like perl, awk, python, etc. Unless specifically stated otherwise, assume that the command should work no matter what your current working directory is or where a user's home directory is located. Use only flags that are required by the question as stated. Assume you are logged in as a "normal" (non-administrator) user, but that you have "administrative" permissions set up in the sudoers file in case you would be required to take advantage of that in order to carry out any of these tasks. Use only single spaces between parts of a command/options/arguments, and do not put extra spaces before or after the answers.
a) Lists all the files and/or directories in the top-level bin directory that have names starting with "ca". Use a single flag to make this a "long" listing.
b) Lists all the files and/or directories in the current user's etc directory that have 5-character-long names. Just a regular listing, not "long", not showing "hidden" files, etc.
c) Lists all the files and/or directories in the directory one level above the current working directory that have names that start with "a" or "b".
d) Copies all the files in user turk's NetworkingClass directory to the current working directory of the currently-logged-in user. Assume permissions are set on turk's NetworkingClass directory to allow you to do this. Do not recurse into sub-directories.
e) Copies user turk's NetworkingClass directory, all its files, all its subdirectories, and all files in all its subdirectories, preserving all file permissions, to the ~/MyNetworkingClass directory. Assume permissions are set on turk's NetworkingClass directory to allow you to do this.
f) Sets it so that, of permissions that would normally be given for files and/or directories that are created in the future, all permissions will be denied to "other", write and execute permissions will be denied to "group", and no permissions will be denied to the "user" (owner).
g) Using "absolute" (numeric) notation, changes the permissions on all the existing files in the ~/NetworkingClass/scripts directory so that the "user" (owner) has all permissions, all users in the same group have read and execute permissions, and all other users have only read permissions.
h) Renames the file "hello.c" which is in the current working directory to be called "hello.cpp".
i) Moves all files in /usr/local/bin that start with "c", "C", "b", or "B" to /local/bin.
j) Create a symbolic (soft) link to the existing /bin/vi file from a new file called "editor" in a directory called "etc" in the current user's home directory.
k) Create a hard link to the current user's ~/.bashrc file from their ~/etc directory.
l) Sort the output of "ps auxf" so that, in the order specified here, it 1) gets rid of the column header line, 2) sorts alphabetically by user name, thus keeping lines about all processes run by each user together, and 3) sorts secondarily in descending (largest to smallest) order by the numeric process ID.
m) Counts the number of processes running by each user, as identified by the "ps aux" command, and sorts this output in descending order by count (so the user with the most running processes will be listed first and the user with the least number of running processes will be listed last). The output should be the number of processes and the user login name for each user running processes. Ex: 15 turk
n) Store the count of the number of different users running processes 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 in more than once. (Also, don't count the ps aux header line as a user...!)
o) Display the current date and time, as obtained and formatted with the system "date" command, so that it shows the year, month, day of month, day of week, and time of day, in that order, in formats such as are illustrated here: "2016 04(Apr) 01(Fri) 13:25:55". Notice the exact spacing, punctuation, capitalization, and zero-prefixing (where needed) to give exactly 2 digits in the month 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 the following, using the information from these three variables: "turk's home directory is '/home/turk'; the current working directory is '/var/log'." To be clear, this message tells who the logged-in user is, what their home directory is, and what their current working directory is, based on these three variables. This should work for whoever is logged in, with whatever values are currently in these three variables. (These are system environment variables and are initialized by the system so you don't need to worry about storing information into them.)
q) Sort a long file listing ("ls -l") by file size (and secondarily by file name) and store the filename and date and time that the largest file was last updated into a variable called F_NM_DT_TM. For example, if the file has been changed recently, the results should follow the format illustrated in this example (not including the quotation marks): "Oct 20 06:56 sampleFile2". If the file had not been changed recently, the results might look like this: "Jan 11 2014 sampleFile1".
r) Extract the file name from the F_NM_DT_TM variable (see earlier question Q) and store it into a variable called F_NM.
s) Extract the file month from the F_NM_DT_TM variable (see earlier question Q) and store it into a variable called FE_MO.
t) Extract file day from the F_NM_DT_TM variable (see earlier question Q) and store it into a variable called F_DY.
u) Extract file time (or year) from the F_NM_DT_TM variable (see earlier question Q) and store them into a variable called F_TM_YR.
v) Display a message using the four pieces of information extracted from the F_NM_DT_TM variable (see earlier questions Q, R, S, T, & U) and display a message that reads something like "'lastlog' is the largest file; it was last changed 'Feb 03, 2015'", or "'lastlog' is the largest file; it was last changed 'Nov 03, 14:15:25'", depending on whether it was updated recently or not. (If it is a recently updated file, it will show the time; if not recently updated it will show the year.) Of course, it should display information about whatever the largest file is when the command is run, not just the information illustrated here. Notice the short version of the month name, and the zero-prefixed day number, and the 24-hour time format display.