The ls command lists all files and directories in the current folder. It's like opening a drawer to see what's inside.
Click to reveal answer
beginner
How do you change the current directory in Linux?
Use the cd command followed by the folder name to move into that folder. For example, cd Documents moves you into the Documents folder.
Click to reveal answer
beginner
What is the purpose of the pwd command?
The pwd command shows your current location in the folder structure. It tells you the full path of where you are, like a street address.
Click to reveal answer
beginner
How can you create a new empty file using Linux commands?
Use the touch filename command to create a new empty file named filename. It's like creating a blank sheet of paper.
Click to reveal answer
beginner
What does the man command do?
The man command shows the manual or help page for other commands. It explains how to use a command and its options, like a user guide.
Click to reveal answer
Which command lists files and folders in the current directory?
Atouch
Bls
Cpwd
Dcd
✗ Incorrect
The ls command lists files and folders in the current directory.
What does the cd command do?
ACreates a new file
BShows current directory path
CChanges the current directory
DLists files
✗ Incorrect
The cd command changes your current directory to another folder.
How do you see your current folder's full path?
Apwd
Bman
Cls
Dtouch
✗ Incorrect
The pwd command prints the full path of your current directory.
Which command creates a new empty file?
Als
Bman
Ccd
Dtouch
✗ Incorrect
The touch command creates a new empty file.
What is the use of the man command?
ATo show help/manual for commands
BTo change directory
CTo create files
DTo list files
✗ Incorrect
The man command shows the manual or help page for other commands.
Explain how you would navigate to a folder named 'Projects' and list its contents using Linux commands.
Think about moving into the folder first, then seeing what's inside.
You got /2 concepts.
Describe how to create a new file called 'notes.txt' and check where you are in the folder structure.
First create the file, then find your current location.
You got /2 concepts.
Practice
(1/5)
1. Which Linux command shows the current directory you are in?
easy
A. pwd
B. ls
C. cd
D. mkdir
Solution
Step 1: Understand the purpose of pwd
The pwd command stands for "print working directory" and shows the current folder path.
Step 2: Compare with other commands
ls lists files, cd changes directory, and mkdir creates a folder, so they don't show the current directory.
Final Answer:
pwd -> Option A
Quick Check:
Current directory command = pwd [OK]
Hint: Remember: pwd = print working directory [OK]
Common Mistakes:
Confusing ls with pwd
Using cd to show directory
Thinking mkdir shows current folder
2. Which of the following is the correct syntax to create a new directory named projects?
easy
A. mkdir projects
B. mk projects
C. create projects
D. newdir projects
Solution
Step 1: Identify the command to create directories
The standard Linux command to make a directory is mkdir.
Step 2: Check the syntax
The correct syntax is mkdir directory_name, so mkdir projects is correct.
Final Answer:
mkdir projects -> Option A
Quick Check:
Create directory command = mkdir [OK]
Hint: mkdir means make directory; use it to create folders [OK]
Common Mistakes:
Using mk instead of mkdir
Typing create instead of mkdir
Using newdir which is not a command
3. What will be the output of the following commands?
mkdir testdir
cd testdir
pwd
medium
A. /testdir
B. /home/testdir
C. /home/username/testdir
D. testdir
Solution
Step 1: Understand the commands
mkdir testdir creates a folder named testdir. cd testdir moves into that folder. pwd prints the full path of the current directory.
Step 2: Determine the full path
Assuming the user starts in their home directory (like /home/username), after changing into testdir, pwd will show /home/username/testdir.
Final Answer:
/home/username/testdir -> Option C
Quick Check:
pwd after cd into testdir = full path /home/username/testdir [OK]
Hint: pwd shows full path, not just folder name [OK]
Common Mistakes:
Expecting just folder name output
Assuming root directory path
Confusing relative and absolute paths
4. You run the command cd myfolder but get an error: bash: cd: myfolder: No such file or directory. What is the most likely cause?
medium
A. You do not have permission to use cd
B. The folder myfolder does not exist in the current directory
C. The cd command is misspelled
D. You need to use mkdir before cd
Solution
Step 1: Analyze the error message
The error says "No such file or directory", meaning the folder named myfolder is not found in the current location.
Step 2: Check other options
cd is a basic command and usually not misspelled here. Permissions errors give different messages. mkdir creates folders but is not required before cd if the folder exists.
Final Answer:
The folder myfolder does not exist in the current directory -> Option B
Quick Check:
cd error means folder missing [OK]
Hint: Check folder exists before cd [OK]
Common Mistakes:
Assuming permission error
Thinking cd needs mkdir first
Misspelling cd command
5. You want to create a new folder named backup inside your current directory and then move into it. Which sequence of commands will do this correctly?
hard
A. mkdir
cd backup
B. cd backup
mkdir backup
C. cd backup
cd backup
D. mkdir backup
cd backup
Solution
Step 1: Create the folder first
The command mkdir backup creates the folder named backup in the current directory.
Step 2: Change directory into the new folder
After creating it, cd backup moves you inside that folder.
Step 3: Check other options
cd backup
mkdir backup tries to cd into backup before it exists, causing an error. mkdir
cd backup misses the folder name in mkdir. cd backup
cd backup tries to cd twice without creating the folder.
Final Answer:
mkdir backup
cd backup -> Option D
Quick Check:
Create then cd = mkdir then cd [OK]
Hint: Always mkdir before cd into new folder [OK]
Common Mistakes:
Trying cd before mkdir
Omitting folder name in mkdir
Repeating cd without folder
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.