FLOPPIX Home | FAQ | Download | Labs | ToC | Back |  Next 

Directory Commands


Notes:

Some directory commands:

  1. pwd - print working directory (see navigating the filesystem)
     
  2. cd - change directory (see navigating the filesystem)
     
  3. ls - display a directory listing (see directory listings)
     
  4. mkdir - This command creates a new directory. Examples:
  5. rmdir -This command removes an existing directory. The directory must be empty before it can be removed. Example:


Exercises:

  1. Load Floppix and login on virtual console 1 using your own initials.
     
  2. How many directories are stored under /var? _____
     
  3. Try to view the contents of the directory /sbin? _____
    What error message is displayed? ____________________
    Why? ____________________
     
  4. Change to the /var directory. Try to create a directory called ddd.
    What error message is displayed? ____________________
    Why? ____________________
     
  5. Change to your own home directory and make a directory called ddd there. This time the command should succeed.
     
  6. Cd to the ddd directory and create a file called fff using the command: touch fff
     
  7. Try to make a subdirectory called fff using the command: mkdir fff
    What error message is displayed? ____________________
    Why? ____________________
     
  8. Still in the ddd directory, try to remove the ddd directory using the command: rmdir ddd
    What error message is displayed? ____________________
    Why? ____________________
     
     
  9. Change to your own home directory. Try to remove the ddd directory using the command: rmdir ddd
    What error message is displayed?____________________
    Why? ____________________
     
  10. Delete the file fff using the command: rm ddd/fff
    Now remove the ddd directory. This time the command should succeed.


Questions & Answers:

  1. What is the command to make a subdirectory called "mine"?
     
    Answer: mkdir mine
     
  2. Give 2 situations where the mkdir cmomand will fail?
     
    Answer: mkdir will fail:
    - when you try to make a subdirectory in a directory where you do not have write permissions
    - when a file or a directory already exists with that name
     
  3. Give 2 situations where the rmdir command will NOT remove a directory.
     
    Answer: rmdir will fail
     - when the directory is not empty
     - when you try to remove the working directory (or any of its parent directories)

Copyright © L. M. MacEwan
FLOPPIX Home | FAQ | Download | Labs | ToC | Back |  Next