What is the primary goal of the Practice Lab 1: Navigating the Linux Filesystem exercise?
To navigate a complex directory structure and locate a hidden file using basic Linux commands.
What command is used to determine your current location, or print working directory, in the Linux filesystem?
pwd
Print working directory
What command is used to list the contents of the current directory?
ls
List contents
To list directory contents in a long format showing permissions, owner, size, and modification date, you would use the command ‘ls’ with the —- option.
-l
example ls -l
In the output of ls -l
what does the leading ‘d’ in the permission string like ‘drwxr..’ signify?
It signifies that the item is a directory.
What command is used to change your current directory?
cd
change directory
How would you move from your current location into a subdirectory named ‘Level 1’?
cd Level1
What command moves you directly to the root of the entire filesystem?
cd /
What special character represents the root of the Linux filesystem?
/
Which command allows you to quickly return to the directory you were in immediately before the current one?
cd -
What is the shorthand to move up one level to the parent directory?
cd ..
How can you move up two directory levels from your current position with a single command?
cd ../..
A path that starts from the root directory / is known as the ____ path.
absolute
What is the key characteristic of a file that makes it ‘hidden’ in Linux?
It name begins with a period
If you are in a directory containing only a hidden file named .secret what will the output of only ls command
Nothing will be listed for using ls when looking for a secret directory
To list all files in a directory, including hidden ones, you must use the ls command with what option.
-a
example ls -a
What two commands can be used to return to your home directory from anywhere in the filesystem?
cd ~ or just cd
What special character is a shortcut for the users home directory?
~ the tilde
What command creates a new directory?
mkdir
The mkdir -p Level1/Level2/Level3 command is used to create a nested directory structure. What is the function of the -p option?
It creates any necessary parent directories that do not already exist.
What command is used to create a new, empty file (or update the timestamp of an existing file)?
touch
How would you create a hidden file named .hidden_key.txt?
touch .hidden_key.txt
What command is used to remove files or directories?
rm
example rm directory
or
example rm file
To remove a directory and all its contents (including subdirectories) you must use the rm command with the __ option for recursive deletion.
-r
example rm -r directory