Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

(a) Use date command to print the current date and time. (b) Use date command to

ID: 3751014 • Letter: #

Question

(a) Use date command to print the current date and time. (b) Use date command to print the current date and time in the following format: 2018-09-12 18-13-11s where this would be recorded on September 12, 2018 at 18 hours 13 minutes and 11 secondls (c) Use a Unix command that prints your current username. (d) Use a Unix command that prints your current userID (e) Use the Unix command cat to create a file named info.txt that has exactly four lines. These four lines, from line 1 to line 4, are: your first name, your last name, your CS userid, and your banner number (f) Use cat to show the content of the file created. (8) Use a Unix command to show the lines (h) Enter a Unix command to verify that this file has exactly four lines. Your command from file info.txt sorted alphabetically. should print a single integer (to the monitor) that is the number of lines in this file followed by a space character and then the file name.

Explanation / Answer

Answers:

In shell scripting

a) UNIX command to print date and time -

now=$(date)

echo "$now"

b) echo "$ date +"%Y-%m-%d %H-%M-%S"

c) echo "$USER"

d) uid="$(id -u)"

echo "User name ID (UID) : $uid"

-u flag tells you to give only ID.

** according to chegg policy I can only answer max of 4. post rest as separate question

%H hour (00..23)