16 Questions
What happens if you don't start your path with a slash?
The current directory is the assumed starting point
What is the command to show the current directory?
pwd
What is the purpose of the tab key in path completion?
To expand the command line to a correct path
What is the effect of typing 'cd home' when the current directory is '/home/paul'?
You will get an error message
What is the purpose of the 'ls -a' command?
To show all files, including hidden files
What happens when you type 'cd /paul' from the '/home' directory?
You will get an error message
What is the effect of typing 'cd home' when the current directory is '/'?
You will enter the '/home' directory
What is a hidden file in a Linux file system?
A file that starts with a dot
What does the pwd
command do?
Displays the current directory
What is the effect of typing cd
without a target directory?
It moves you to your home directory
What is the purpose of the cd..
command?
To go to the parent directory
What does the cd -
command do?
Moves you to the previous directory
What is an absolute path?
A path starting with a slash (/)
What is the purpose of the cd ~
command?
To go to your home directory
What is the effect of typing cd.
?
It stays in the current directory
What is the main difference between absolute and relative paths?
Absolute paths start with a slash, relative paths do not
Study Notes
Working with Directories
- The
pwd
command displays the current working directory. - The
cd
command is used to change the current directory. -
cd
without a target directory will put you in your home directory. -
cd ~
is a shortcut to get back into your home directory. -
cd ..
is used to go to the parent directory. -
cd .
is used to stay in the current directory. -
cd -
is used to go to the previous directory.
Absolute and Relative Paths
- Absolute paths start with a slash (/) and are relative to the root of the file tree.
- Relative paths do not start with a slash and are relative to the current directory.
- When in the root directory, both absolute and relative paths can be used.
Path Completion
- The tab key can be used to complete a path without errors.
- The tab key will expand the command line to the correct path if it exists.
ls Command
- The
ls
command is used to list the contents of a directory. - The
-a
option is used to show all files, including hidden files. - Hidden files start with a dot (.) and are not shown by default.
Learn basic Linux commands for working with directories, including pwd, cd, ls, mkdir, and rmdir, as well as absolute and relative paths and path completion in the bash shell.
Make Your Own Quizzes and Flashcards
Convert your notes into interactive study material.
Get started for free