Bird
Raised Fist0
Linux CLIscripting~20 mins

Opening and using the terminal in Linux CLI - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Terminal Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
1:00remaining
What is the output of the command pwd?
You open a terminal and run the command pwd. What does it show?
Linux CLI
pwd
A/home/username
BList of files in the current directory
CShows the current date and time
DAn error message saying command not found
Attempts:
2 left
💡 Hint
Think about what 'pwd' stands for and what it tells you.
💻 Command Output
intermediate
1:00remaining
What happens when you run ls -l in the terminal?
You type ls -l and press Enter. What output do you expect?
Linux CLI
ls -l
AAn error saying invalid option
BOnly the names of files and directories without details
CThe current directory path
DA detailed list of files and directories with permissions, owner, size, and date
Attempts:
2 left
💡 Hint
The -l option means 'long format'.
📝 Syntax
advanced
1:00remaining
Which command correctly changes directory to the parent folder?
You want to move one folder up from your current location. Which command is correct?
Acd /
Bcd ..
Ccd .
Dcd ../..
Attempts:
2 left
💡 Hint
The parent folder is one level above the current folder.
💻 Command Output
advanced
1:00remaining
What error appears if you try to run cd nonexistent_folder?
You type cd nonexistent_folder where the folder does not exist. What is the output?
Linux CLI
cd nonexistent_folder
Abash: cd: nonexistent_folder: No such file or directory
BMoved to nonexistent_folder
CPermission denied
DCommand not found
Attempts:
2 left
💡 Hint
Think about what happens when you try to enter a folder that does not exist.
🚀 Application
expert
1:30remaining
How many files and directories are listed by ls -a in a folder with 3 visible files and 2 hidden files?
You have 3 normal files and 2 hidden files (names start with a dot) in a folder. What is the total number of items shown by ls -a?
Linux CLI
ls -a
A5
B6
C7
D3
Attempts:
2 left
💡 Hint
Remember that ls -a also shows '.' and '..' entries.

Practice

(1/5)
1. What is the main purpose of opening a terminal on a Linux system?
easy
A. To type commands to control the computer
B. To watch videos
C. To browse the internet
D. To play music

Solution

  1. Step 1: Understand what a terminal does

    The terminal allows users to type commands to control and manage the computer.
  2. Step 2: Compare options with terminal use

    Watching videos, browsing internet, and playing music are done with other apps, not the terminal.
  3. Final Answer:

    To type commands to control the computer -> Option A
  4. Quick Check:

    Terminal = command control [OK]
Hint: Terminal is for commands, not media [OK]
Common Mistakes:
  • Thinking terminal is for media
  • Confusing terminal with GUI apps
  • Not knowing terminal controls computer
2. Which of the following commands correctly opens a new terminal window in most Linux desktop environments?
easy
A. gnome-terminal
B. open-terminal
C. start-terminal
D. launch-term

Solution

  1. Step 1: Identify common terminal commands

    The command gnome-terminal is the standard way to open a terminal window in GNOME desktop.
  2. Step 2: Check other options

    Commands like open-terminal, start-terminal, and launch-term are not standard Linux commands.
  3. Final Answer:

    gnome-terminal -> Option A
  4. Quick Check:

    Standard terminal command = gnome-terminal [OK]
Hint: Remember GNOME uses gnome-terminal command [OK]
Common Mistakes:
  • Typing non-existent commands
  • Confusing Windows commands with Linux
  • Using wrong command names
3. What will be the output of the command pwd immediately after opening a new terminal?
medium
A. /usr/bin
B. /root
C. /etc
D. /home/username

Solution

  1. Step 1: Understand what pwd does

    The pwd command shows the current directory path.
  2. Step 2: Know the default directory on terminal open

    When a user opens a terminal, it usually starts in their home directory, like /home/username.
  3. Final Answer:

    /home/username -> Option D
  4. Quick Check:

    New terminal starts in home directory [OK]
Hint: New terminal starts in your home folder [OK]
Common Mistakes:
  • Assuming root or system folders
  • Not knowing pwd shows current folder
  • Confusing with other commands
4. You typed ls -l but got an error: ls: command not found. What is the most likely cause?
medium
A. You are not in the home directory
B. You need to use list -l instead
C. The ls command is not installed or PATH is broken
D. You forgot to open the terminal

Solution

  1. Step 1: Understand the error message

    The error command not found means the system cannot find the ls command.
  2. Step 2: Identify common causes

    This usually happens if the command is missing or the PATH environment variable is broken.
  3. Final Answer:

    The ls command is not installed or PATH is broken -> Option C
  4. Quick Check:

    Command not found = missing command or PATH issue [OK]
Hint: Command not found means missing or PATH error [OK]
Common Mistakes:
  • Thinking directory location matters
  • Using wrong command names
  • Ignoring terminal must be open
5. You want to open a terminal and immediately list all files in your Documents folder. Which command should you use?
hard
A. open-terminal ls Documents
B. gnome-terminal -- bash -c "ls ~/Documents"
C. start-terminal -list ~/Documents
D. terminal ls -all Documents

Solution

  1. Step 1: Understand how to open terminal and run a command

    The command gnome-terminal -- bash -c "ls ~/Documents" opens a terminal and runs ls ~/Documents.
  2. Step 2: Check other options for correctness

    Other options use invalid commands like open-terminal, start-terminal, or wrong syntax.
  3. Final Answer:

    gnome-terminal -- bash -c "ls ~/Documents" -> Option B
  4. Quick Check:

    Open terminal and run command = gnome-terminal -- bash -c [OK]
Hint: Use gnome-terminal with bash -c to run commands [OK]
Common Mistakes:
  • Using non-existent commands
  • Wrong syntax for running commands
  • Not quoting commands properly
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard