Читать книгу Linux Bible - Christopher Negus - Страница 121

Exercises

Оглавление

Use these exercises to test your knowledge of using the shell. These tasks assume that you are running a Fedora or Red Hat Enterprise Linux system (although some tasks work on other Linux systems as well). If you are stuck, solutions to the tasks are shown in Appendix B (although in Linux, there are often multiple ways to complete a task).

1 From your desktop, switch to the third virtual console and log in to your user account. Run a few commands. Then exit the shell and return to the desktop.

2 Open a Terminal window and change the font color to red and the background to yellow.

3 Find the location of the mount command and the tracepath man page.

4 Type the following three commands, and then recall and change those commands as described: $ cat /etc/passwd $ ls $HOME $ dateUse the command-line recall feature to recall the cat command and change /etc/passwd to /etc/group.Recall the ls command, determine how to list files by time (using the man page), and add that option to the ls $HOME command line.Add format indicators to the date command to display the date output as month/day/year.

5 Run the following command, typing as few characters as possible (using tab completion): basename /usr/share/doc/

6 Use the cat command to list the contents of the /etc/services file and pipe those contents to the less command so that you can page through it (press q to quit when you are finished).

7 Run the date command in such a way that the output from that command produces the current day, month, date, and year. Have that read into another command line, resulting in text that appears like the following (your date, of course, will be different): Today is Thursday, December 19, 2019.

8 Using variables, find out what your hostname, username, shell, and home directories are currently set to.

9 Create an alias called mypass that displays the contents of the /etc/passwd file on your screen in such a way that it is available every time you log in or open a new shell from your user account.

10 Display the man page for the mount system call.

Linux Bible

Подняться наверх