Bird
Raised Fist0
Linux CLIscripting~5 mins

Opening and using the terminal in Linux CLI - Commands & Configuration

Choose your learning style10 modes available
Introduction
Sometimes you need to type commands to control your computer. The terminal is a tool that lets you do this by typing words instead of clicking. It helps you run programs, manage files, and check system information quickly.
When you want to open a program by typing its name instead of clicking icons.
When you need to find where a file is on your computer using commands.
When you want to check your computer's current folder or list files inside it.
When you want to create or delete files and folders quickly.
When you want to run scripts or programs that automate tasks.
Commands
This command opens a new terminal window on systems using the GNOME desktop environment. It lets you start typing commands.
Terminal
gnome-terminal
Expected OutputExpected
No output (command runs silently)
→
--window - Open a new window
→
--tab - Open a new tab in the terminal
This command shows the current folder you are in. It helps you know where you are in the computer's file system.
Terminal
pwd
Expected OutputExpected
/home/username
This command lists all files and folders in the current folder. It helps you see what is inside the folder.
Terminal
ls
Expected OutputExpected
Documents Downloads Pictures file.txt
→
-l - Show detailed information about files
→
-a - Show hidden files
This command prints the words 'Hello, terminal!' on the screen. It shows how you can display messages or check if commands work.
Terminal
echo Hello, terminal!
Expected OutputExpected
Hello, terminal!
Key Concept

The terminal lets you control your computer by typing simple commands to do tasks faster and more precisely.

Common Mistakes
Trying to open the terminal by typing random words or commands.
The terminal only opens with specific commands or shortcuts, so random words won't work.
Use the correct command like 'gnome-terminal' or the keyboard shortcut to open the terminal.
Typing commands without knowing the current folder.
Commands like 'ls' or file operations depend on the current folder, so you might look in the wrong place.
Use 'pwd' to check your current folder before running commands.
Ignoring command output and errors.
You might miss important messages that tell you if a command worked or failed.
Always read what the terminal shows after running a command.
Summary
Open the terminal using the 'gnome-terminal' command or your system's shortcut.
Use 'pwd' to see your current folder location.
Use 'ls' to list files and folders inside the current folder.
Use 'echo' to print messages on the screen.

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