Linux Operations and Administration



Download 30.09 Kb.
Date29.01.2017
Size30.09 Kb.
#11574

Linux Operations and Administration, ISBN 111103530X

Ch. 3 Solutions-



Chapter 3 Solutions

Review Questions



  1. There can be multiple root directories in Linux. True or False?

False

  1. Describe a benefit of the Filesystem Hierarchy Standard (FHS).

Linux users and software developers can find the correct configuration files regardless of the distribution they’re using. Another benefit is that Linux software developers can create software that works in all major distributions.

  1. What command do you use to display your current directory?

c. pwd

  1. What command do you use to change to a different directory?

b. cd

  1. What command is used to view the contents of your current directory?

d. ls

  1. The cd /home/user command uses the relative method. True or False?

False

  1. The -l option effects the ls command by:

a. Changing the format to a long list

  1. After entering ls -a, how can you tell which files are hidden?

b. Their names start with a . (dot).

  1. Describe three options you can use with the ls command.

Students can choose any three options from Table 3-2.

  1. Which of the following information is displayed after issuing the ls -l command? (Choose all that apply.)

a. File permissions

c. File type



  1. Describe three man page sections.

Students can choose any three categories from Table 3-3.

  1. After you use the ls command, the following files are displayed:

file1 file2 file3 file.a file.b file.c files

List the files displayed with each of the following options:

a. file1, file2, file3, file.a, file.b, file.c, files (all files)

b. file1, file2, file3, files

c. No files are displayed.

d. files


  1. What command creates an empty file?

c. touch

  1. What command deletes files and directories?

a. rm

  1. What command deletes empty directories?

d. rmdir

  1. What command creates directories?

b. mkdir

  1. Explain how the -r option affects the rm command.

The -r option removes directories and their contents recursively.

  1. What command is used to rename or move a file?

c. mv

  1. What command is used to copy a file?

b. cp

  1. Explain the difference between an inode table, an inode, and an inode number.

An inode table lists all inodes on a Linux partition. An inode is a data structure that stores information about a file, such as size and inode number; it doesn’t contain the actual data or the filename. An inode number references an entry in the inode table.

  1. How does the -i option affect the ls command?

c. Displays the inode number

  1. Explain the difference between hard links and symbolic links.

Hard links are files on the same partition that point to data on the hard drive. All hard links with the same inode number on the same disk partition point to the same data. Symbolic links are special types of files that point to other files, which can be on different partitions or even different computers. Unlike hard links, they don’t share the same inode number

  1. How does the -s option affect the ln command?

a. Creates a symbolic link

  1. What Linux command can you use to switch users without actually logging off your system?

the su command

Activities



Activity 3-1

Step 3: The student’s home directory (/home/username) should be displayed.

Step 4: The current working directory is /etc, which is not the same as the student’s home directory. The student used the absolute method to change to the /etc directory.

Step 5: The student is in the root (/) directory.

Step 6: The cd command without arguments switches the student to his or her home directory.

Step 7: All files and directories starting with an uppercase D are displayed onscreen because of the BASH command completion feature.



Activity 3-2

Step 4: The timestamp will be different for each student.

Step 6: Answers will vary, depending on the options students choose.

Activity 3-3

Step 2: Adding a number to the man command displays only a specific section of the man page.



Activity 3-4

Step 4: Specifying h* in the command means only files and directories starting with “h” are listed.

Step 5: This command displays all files and directories ending with a period, followed by one character.

Step 9: The student switches to the /home directory because it’s the only subdirectory of root starting with “h.”



Activity 3-5

Step 7: The timestamp should change for actfile2 and actfile3 but not actfile1.

Step 9: The directory can’t be deleted because it’s not empty.

Step 11: Yes, the directory should be empty.



Activity 3-6

Step 4: The actfile1 file is renamed as actfile2.

Step 5: The actfile2 file is moved to the parent directory.

Step 6: Students should be in their home directories.

Step 7: A copy of actfile2 is created and renamed as actfile3.

Step 8: The actfile2 file is copied and moved to the Activity3-6 directory, which then contains only this file.



Activity 3-7

Step 3: The inode number is 3858 for actfile1.

Step 7: Two links are associated with actfile1. The link count changed because a link associated with actfile1 was created.

Step 8: Yes, the file is removed, but the data isn’t gone because there were two links. The data isn’t deleted until all the hard links are deleted.

Step 9: actfile1 has only one link because the other link was deleted in Step 8.

Step 10: The link count is 1 because it’s a symbolic link.

Step 11: The inode number isn’t the same because it’s a symbolic link.

Activity 3-8

Step 2: The student shouldn’t be able to change to the /root directory because his or her account doesn’t have root permissions.

Case Projects

Case Project 3-1: Working with Modified Files

The touch command is used to view a file’s timestamp, and the cp command is used to copy files from one directory to another.



Case Project 3-2: Creating a Link

First, students should change the directory to Michio’s home directory (cd /home/michio), and then create the symbolic link (ln -s /workgrp/project/sci.journal myjournal). Next, students should use similar commands for the other three science instructors.



Incorrect answers to look out for: Some students might start from the /workgrp/project directory. For instance, they might type cd /workgrp/project and then type ln -s sci.journal /home/dustin/myjournal. These commands are wrong because students are trying to create a symbolic link from a file. Doing so creates a symbolic loop and could cause unwanted effects. If necessary, remind students that they need to create a symbolic link that points to the file.

Download 30.09 Kb.

Share with your friends:




The database is protected by copyright ©ininet.org 2022
send message

    Main page