2. Navigating the Filesystem Flashcards
How do you browse through previously executed lines in the terminal?
By using the Up and Down Arrow keys.
How do you get the Shell to try to complete the line you’re typing?
By using the Tab key.
In Bash, if there are several options matching what you typed, you have to press it twice to display all matching options.
In Z Shell, if there are several options matching what you typed, they are displayed immediately when the Tab key is pressed. And then, you can press Tab repeatedly to select the one you want.
How do you print the path to your current location in Shell?
By executing the pwd
command.
eg. pwd
What is pwd
the abbreviation for?
Path to Working Directory
Where are all the home directories in Linux?
Under /Home
.
eg. /Home/alican
Where are all the home directories in MacOS?
Under /Users
.
eg. /Users/alican
Where is the root directory in MacOS and Linux?
At the /
directory.
How do you navigate to the parent directory of the directory that you’re currently in?
By executing cd
and passing it double dots (..).
eg. cd ..
How do you list the contents of the directory you’re currently in?
By executing the ls
command.
Where are the essential, system programs that are available in your system located?
Inside the /bin
directory.
What is the shortcut to navigate to your home directory?
cd
.
How do you list all files in the current directory including the hidden files?
By executing the ls
command with the -a
flag.
eg. ls -a
How do you list all files in the current directory as well as information about them such as their owners, file sizes and last modification dates?
By executing the ls
command with the -l
flag.
eg. ls -l
How do you open the manual page for a command in the terminal?
By executing the man
command with the command you want to view the manual page of.
eg. man cd
How do you move up and down in the manual page of a command?
You press SPACE
to move down and B
to move up.
How do you perform a search in the manual page of a command?
By pressing forward slash (/
), typing the search term, and pressing enter.
How do you list the content of the current directory sorted by time modified?
By executing the ls
command with the -t
flag.
eg. ls -t
How do you exit the manual page?
By pressing Q
.
What is the first word of a line being executed in the shell?
The command.
What is the anatomy of commands?
Commands are words seperated by spaces.
- The first word is the command itself.
- All the other words after the command are called arguments and they are passed to the command as information about what you do.
- A special kind of argument is an option, which usually starts with a dash (
-
). Options change the behavior of the command.