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

Raspberry Pi 3 : Linux 1. Consider the problem of finding files that are not use

ID: 3742175 • Letter: R

Question

Raspberry Pi 3 : Linux

1. Consider the problem of finding files that are not useful anymore. What is the option to ls that shows when a file has last been accessed?

2. What is the primary difference between the two commands? "shutdown -h" vs. "shutdown -r"

3. Using the man pages for "ls", "sort", and "head" as references, write a one-line script to list the details of the five largest files in the current directory. NOTE: You can NOT use the "-S" option of "ls" command. Call the script "top5.sh".

Explanation / Answer

Answer:

The shutdown command brings the system down in a secure way. All logged-in users are notified that the system is going down, and loginoperations are blocked. It is possible to shut the system down immediately, or after a specified delay.

All processes are first notified that the system is going down by the signal SIGTERM. This gives programs like vi time to save the file being edited, mail and news processing programs a chance to exit cleanly, etc.

shutdown does its job by signalling the init process, asking it to change the runlevel. Runlevel 0 is used to halt the system, runlevel 6 is used to reboot the system, and runlevel 1 is used to put the system into a state where administrative tasks can be performed (single-user mode). Runlevel 1 is the default, unless the -h or -r options are specified.

shutdown -h:

Instructs the system to shut down and then halt

shutdown -r:

Reboot after shutdown.