The pwd command shows the full path of the current directory you are in. It tells you exactly where you are in the folder structure.
Click to reveal answer
beginner
How can pwd help when you feel lost in the terminal?
If you don't know which folder you are working in, running pwd will print your current location. This helps you avoid mistakes like creating files in the wrong place.
Click to reveal answer
beginner
True or False: pwd changes your current directory.
False. pwd only shows your current directory path. It does not move you to another directory.
Click to reveal answer
beginner
What is the typical output format of pwd?
It outputs an absolute path starting with a slash /, like /home/username/Documents. This path shows the full route from the root folder to your current folder.
Click to reveal answer
intermediate
Can pwd be used in scripts? Why?
Yes, pwd is often used in scripts to get the current directory path. This helps scripts know where they are running and manage files correctly.
Click to reveal answer
What does the pwd command display?
AList of files in the directory
BThe current user's name
CThe system's hostname
DThe current directory's full path
✗ Incorrect
pwd prints the full path of the directory you are currently in.
If you run pwd and see /home/user, where are you?
AIn the user's home directory
BIn the temporary files folder
CIn the system's bin folder
DIn the root directory
✗ Incorrect
/home/user is the home directory for the user named 'user'.
Does pwd change your location in the terminal?
AYes, it moves you to the root directory
BNo, it only shows your current directory
CYes, it moves you to the home directory
DNo, it lists files in the directory
✗ Incorrect
pwd only prints your current directory path; it does not change it.
Which symbol usually starts the output of pwd?
A~
B#
C/
D$
✗ Incorrect
The output is an absolute path starting with a slash /.
Why might a script use pwd?
ATo find out the current directory path
BTo list all files
CTo change the directory
DTo delete files
✗ Incorrect
Scripts use pwd to know the current directory path for file operations.
Explain what the pwd command does and why it is useful.
Think about how you find your location on a map.
You got /3 concepts.
Describe a situation where using pwd in a script would be helpful.
Imagine a script saving files and needing to know where to put them.
You got /3 concepts.
Practice
(1/5)
1. What does the pwd command do in a Linux terminal?
easy
A. Lists all files in the current directory
B. Deletes the current directory
C. Changes the current directory
D. Shows the full path of the current directory you are in
Solution
Step 1: Understand the purpose of pwd
The pwd command stands for 'print working directory'. It shows the full path of the directory you are currently in.
Step 2: Compare with other options
Options A, C, and D describe other commands like ls, cd, and rm, which do not print the current directory path.
Final Answer:
Shows the full path of the current directory you are in -> Option D
Quick Check:
pwd = current directory path [OK]
Hint: Remember: pwd = print working directory path [OK]
Common Mistakes:
Confusing pwd with ls (list files)
Thinking pwd changes directory
Assuming pwd deletes files
2. Which of the following is the correct syntax to display the current directory path in Linux?
easy
A. pwd
B. pwd -l
C. printwd
D. showdir
Solution
Step 1: Identify the standard command
The standard command to print the current directory is exactly pwd without any extra letters or options.
Step 2: Check other options for validity
Options B, C, and D are not valid Linux commands for this purpose. pwd -l is not a standard option, and printwd and showdir do not exist.
Final Answer:
pwd -> Option A
Quick Check:
Correct syntax = pwd [OK]
Hint: Type exactly 'pwd' to print current directory [OK]
Common Mistakes:
Adding wrong options like -l
Using non-existent commands
Confusing with print working directory spelled out
3. If you run these commands in order:
cd /usr/local
pwd
What will be the output of pwd?
medium
A. /usr
B. /usr/local
C. /local
D. /home/user
Solution
Step 1: Understand the cd command effect
The command cd /usr/local changes the current directory to /usr/local.
Step 2: Check what pwd outputs
After changing directory, pwd prints the full path of the current directory, which is /usr/local.
Final Answer:
/usr/local -> Option B
Quick Check:
cd changes directory, pwd shows it [OK]
Hint: pwd shows the directory set by last cd command [OK]
Common Mistakes:
Assuming pwd shows only part of the path
Confusing directory names
Thinking pwd shows home directory always
4. You run the command pwd but get an error: command not found. What is the most likely cause?
medium
A. The current directory is empty
B. You are not logged in as root
C. You typed pwd incorrectly or misspelled it
D. The terminal is broken and needs restart
Solution
Step 1: Analyze the error message
The error command not found means the shell cannot find the command you typed.
Step 2: Identify common causes
This usually happens if the command is misspelled or typed incorrectly. Being root or directory contents do not affect pwd availability.
Final Answer:
You typed pwd incorrectly or misspelled it -> Option C
Quick Check:
Misspelling commands causes 'command not found' [OK]
Hint: Check spelling if 'command not found' appears [OK]
Common Mistakes:
Assuming permissions cause 'command not found'
Thinking empty directory breaks pwd
Restarting terminal unnecessarily
5. You want to save the current directory path to a file named current_dir.txt (overwriting it if it exists). Which command correctly does this?
hard
A. pwd > current_dir.txt
B. pwd >> current_dir.txt
C. pwd | current_dir.txt
D. pwd current_dir.txt
Solution
Step 1: Understand output redirection
The symbol > redirects the output of a command to a file, overwriting it.
Step 2: Apply redirection to pwd
Using pwd > current_dir.txt writes the current directory path into the file current_dir.txt.
Step 3: Check other options
pwd >> current_dir.txt appends instead of overwriting. Options A and C are invalid syntax.
Final Answer:
pwd > current_dir.txt -> Option A
Quick Check:
Use > to save command output to a file [OK]
Hint: Use > to save output; >> appends output [OK]
Common Mistakes:
Using pipe (|) incorrectly to file
Forgetting > or >> for redirection
Using command with filename as argument
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.