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: 3751075 • 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

To create a script type in the terminal: type script a1q4.script

a). To print current date and time using date, open terminal and type date. Press enter to see current date and time

b). For date in the given format type the command in terminal as: date +"%F %H-%M-%S"

c). For current user name type the command: whoami

d). For current userID type the command: id -u

press ctrl+d to end script file that was created by script command