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

1. Switch to a command-line terminal (tty2) by pressing Ctrl+Alt+F2 and log in t

ID: 3588404 • Letter: 1

Question

1. Switch to a command-line terminal (tty2) by pressing Ctrl+Alt+F2 and log in to the terminal using the user name of root and the password of LNXrocks!. 2. At the command prompt, type touch newfile and press Enter. Next, type locate newfile at the command prompt and press Enter. Did the locate command find the file? Why? 3. At the command prompt, type updatedb and press Enter. When the command is finished, type locate newfile at the command prompt and press Enter. Did the locate command find the file? If so, how quickly did it find it? Why?
4
Hands-on Projects 177
Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
4. At the command prompt, type find / -name "newfile" and press Enter. Did the find command find the file? If so, how quickly did it find it? Why? 5. At the command prompt, type find /root -name "newfile" and press Enter. Did the find command find the file? How quickly did it find it? Why? 6. At the command prompt, type which newfile and press Enter. Did the which command find the file? Why? Type echo $PATH at the command prompt and press Enter. Is the /root directory listed in the PATH variable? Is the /bin directory listed in the PATH variable? 7. At the command prompt, type which grep and press Enter. Did the which command find the file? Why? 8. At the command prompt, type find /root –name "sample" and press Enter. What files are listed? Why? 9. At the command prompt, type find /root –type l and press Enter. What files are listed? Why? 10. At the command prompt, type find /root –size 0 and press Enter. What types of files are listed? Type find /root –size 0 | more to see all of the files listed. 11. Type exit and press Enter to log out of your shell.
Project 4-6 In this hands-on project, you delete files and directories using the rmdir and rm commands. 1. Switch to a command-line terminal (tty2) by pressing Ctrl+Alt+F2 and log in to the terminal using the user name of root and the password of LNXrocks!. 2. At the command prompt, type cd samples and press Enter. At the command prompt, type ls -R and press Enter. Note the two empty directories todelete and undermysamples. 3. At the command prompt, type rmdir undermysamples todelete and press Enter. Did the command work? Why? Next, type ls –F at the command prompt and press Enter. Were both directories deleted successfully? 4. At the command prompt, type rm sample1* and press Enter. What message is displayed? Answer n to all three questions. 5. At the command prompt, type rm –f sample1* and press Enter. Why were you not prompted to continue? Next, type ls –F at the command prompt and press Enter. Were all three files deleted successfully? 6. At the command prompt, type cd .. and press Enter. Next, type rmdir samples at the command prompt and press Enter. What error message do you receive and why? 7. At the command prompt, type rm -Rf samples and press Enter. Next, type ls –F at the command prompt and press Enter. Was the samples directory and all files within it deleted successfully? 8. Type exit and press Enter to log out of your shell.

Explanation / Answer

It has been already mentioned that cycling with Alt+ArrowLeft until you get back to your bellowed desktop also works, especially accross distro's (my Fedora 20, for instance, has GUI on F2), so it's convenient.

There's also a crude method: login and run sudo service lightdm restart, which will restart your session ( so yes, you will be logged out and will get back to login screen )

1down vote

It has been already mentioned that cycling with Alt+ArrowLeft until you get back to your bellowed desktop also works, especially accross distro's (my Fedora 20, for instance, has GUI on F2), so it's convenient.

There's also a crude method: login and run sudo service lightdm restart, which will restart your session ( so yes, you will be logged out and will get back to login screen )