Paths

Question 3: Create and Navigate Directories

What is your current working directory?

$ pwd
/home/demo

Make three directories in your HOME directory. Name these directories "mydir", "data", and "images".

$ mkdir mydir data images

Change your working directory into "data". Create two more directories in /home/demo/data called "dir1" and "dir2". If you create them in the wrong place delete them using "rmdir".

$ cd data
$ mkdir dir1 dir2

Change directory into dir2.

$ cd dir2
$ pwd
/home/demo/data/dir2

Change your current working directory to /home/demo. You can either "cd /home/demo" or "cd ..", as ".." means the directory above the current directory in your directory tree. Check with pwd to make sure you are in the right directory. Then try to delete the data directory using "rmdir data". What message to you get back?

$ cd /home/demo
rmdir data
Directory not empty

This deletes all files and directories in the data directory, including the data directory itself. Obviously getting the parameter wrong means you can lose a lot of stuff in one go!

Question 4: The ls command

What is the first file (in alphabetical order) which appears when you use "-a" in your HOME directory, other than "." and "..".:

Use the "-l" option to see a long listing of a file. Get a long listing of "/etc/passwd" and identify its size in bytes.:

Question 5: Relative and Absolute

What is the current directory:

What is the current directory:

What is the current directory:

What is the current directory:

What is the current directory:

What is the current directory:

What is the current directory:

Consider these commands and fill in the blank:

Consider these commands and fill in the blank:

Where the "pwd" command prints "/usr/share/perl5/Encode".

Where the "pwd" command prints "/etc"

Where the "pwd" command prints "/etc"

Last updated