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

Exercises

Оглавление

Use these exercises to test your knowledge of efficient ways to get around the Linux filesystem and work with files and directories. When possible, try to use shortcuts to type as little as possible to get the desired results. 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 Create a directory in your home directory called projects. In the projects directory, create nine empty files that are named house1, house2, house3, and so on up to house9. Assuming that there are lots of other files in that directory, come up with a single argument to ls that would list just those nine files.

2 Make the $HOME/projects/houses/doors/ directory path. Create the following empty files within this directory path (try using absolute and relative paths from your home directory): $HOME/projects/houses/bungalow.txt $HOME/projects/houses/doors/bifold.txt $HOME/projects/outdoors/vegetation/landscape.txt

3 Copy the files house1 and house5 to the $HOME/projects/houses/ directory.

4 Recursively copy the /usr/share/doc/initscripts* directory to the $HOME/projects/ directory. Maintain the current date/time stamps and permissions.

5 Recursively list the contents of the $HOME/projects/ directory. Pipe the output to the less command so that you can page through the output.

6 Remove the files house6, house7, and house8 without being prompted.

7 Move house3 and house4 to the $HOME/projects/houses/doors directory.

8 Remove the $HOME/projects/houses/doors directory and its contents.

9 Change the permissions on the $HOME/projects/house2 file so that it can be read by and written to by the user who owns the file, only read by the group, and have no permission for others.

10 Recursively change permissions of the $HOME/projects/ directory so that nobody has write permission to any files or directory beneath that point in the filesystem.

Linux Bible

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