Exercises

 < Day Day Up > 

1.

Is each of the following an absolute pathname, a relative pathname, or a simple filename?

  1. milk_co

  2. correspond/business/milk_co

  3. /home/alex

  4. /home/alex/literature/promo

  5. . .

  6. letter.0610

2.

List the commands you can use to

  1. Make your home directory the working directory

  2. Identify the working directory

3.

If your working directory is /home/alex with a subdirectory named literature, give three sets of commands that you can use to create a subdirectory named classics under literature. Also give several sets of commands you can use to remove the classics directory and its contents.

4.

The df utility displays all mounted filesystems along with information about each. Use the df utility with the h (humanly readable) option to answer the following questions.

  1. How many filesystems are on your Linux system?

  2. Which filesystem stores your home directory?

  3. Assuming that your answer to exercise 4a is two or greater, attempt to create a hard link to a file on another filesystem. What error message do you get? What happens when you attempt to create a symbolic link to the file instead?

5.

Suppose that you have a file that is linked to a file owned by another user. What can you do so that changes to the file are no longer shared?

6.

You should have read permission for the /etc/passwd file. To answer the following questions, use cat or less to display /etc/passwd. Look at the fields of information in /etc/passwd for the users on your system.

  1. Which character is used to separate fields in /etc/passwd?

  2. How many fields are used to describe each user?

  3. How many users are on your system?

  4. How many different login shells are in use on your system? (Hint: Look at the last field.)

  5. The second field of /etc/passwd stores user passwords in encoded form. If the password field contains an x, your system uses shadow passwords and stores the encoded passwords elsewhere. Does your system use shadow passwords?

7.

If /home/jenny/draft and /home/alex/letter are links to the same file and the following sequence of events occurs, what will be the date in the opening of the letter?

  1. Alex gives the command vim letter.

  2. Jenny gives the command vim draft.

  3. Jenny changes the date in the opening of the letter to January 31, 2006, writes the file, and exits from vim.

  4. Alex changes the date to February 1, 2006, writes the file, and exits from vim.

8.

Suppose that a user belongs to a group that has all permissions on a file named jobs_list, but the user, as the owner of the file, has no permissions. Describe what operations, if any, the user/owner can perform on jobs_list.

Which command can the user/owner give that will grant the user/owner all permissions on the file?

9.

Does the root directory have any subdirectories that you cannot search? Does the root directory have any subdirectories that you cannot read? Explain.

10.

Assume that you are given the directory structure shown in Figure 4-2 on page 77 and the following directory permissions:

 d--x--x---   3 jenny pubs 512 Mar 10 15:16 business drwxr-xr-x   2 jenny pubs 512 Mar 10 15:16 business/milk_co 

For each category of permissions owner, group, and other what happens when you run each of the following commands? Assume that the working directory is the parent of correspond and that the file cheese_co is readable by everyone.

  1. cd correspond/business/milk_co

  2. ls l correspond/business

  3. cat correspond/business/cheese_co

     < Day Day Up > 


    A Practical Guide to LinuxR Commands, Editors, and Shell Programming
    A Practical Guide to LinuxR Commands, Editors, and Shell Programming
    ISBN: 131478230
    EAN: N/A
    Year: 2005
    Pages: 213

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net