Bird
Raised Fist0
Linux CLIscripting~10 mins

Why Linux powers the internet in Linux CLI - Test Your Understanding

Choose your learning style10 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the command to list all files including hidden ones in a directory.

Linux CLI
ls [1]
Drag options to blanks, or click blank then click option'
A-a
B-l
C-h
D-r
Attempts:
3 left
💡 Hint
Common Mistakes
Using -l shows details but not hidden files.
Using -h is for human-readable sizes, not listing hidden files.
2fill in blank
medium

Complete the command to find the current working directory.

Linux CLI
[1]
Drag options to blanks, or click blank then click option'
Apwd
Bls
Ccd
Dwhoami
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'ls' lists files but does not show current directory.
Using 'cd' changes directory but does not show it.
3fill in blank
hard

Fix the error in the command to display the first 5 lines of a file named 'log.txt'.

Linux CLI
head [1] log.txt
Drag options to blanks, or click blank then click option'
A-f 5
B-5
C-n 5
D-l 5
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-5' is not a portable option for head.
Using '-f' is for following a file, not line count.
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that maps words to their lengths only if length is greater than 3.

Linux CLI
{word: [1] for word in words if [2]
Drag options to blanks, or click blank then click option'
Alen(word)
Bword > 3
Clen(word) > 3
Dword
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'word > 3' compares strings to numbers, which is invalid.
Not using len() to get word length.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that maps uppercase words to their lengths only if length is greater than 4.

Linux CLI
{ [1]: [2] for word in words if [3] }
Drag options to blanks, or click blank then click option'
Aword.upper()
Blen(word)
Clen(word) > 4
Dword.lower()
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'word.lower()' instead of uppercase.
Not using len() to get length.
Using wrong comparison operators.

Practice

(1/5)
1. Why is Linux widely used to power internet servers?
easy
A. Because it is free, stable, and flexible
B. Because it is the only operating system available
C. Because it requires expensive licenses
D. Because it only runs on personal computers

Solution

  1. Step 1: Understand Linux's cost and flexibility

    Linux is free to use and can be customized easily, unlike many paid systems.
  2. Step 2: Recognize Linux's stability for servers

    Linux is known for running reliably over long periods, which is essential for internet servers.
  3. Final Answer:

    Because it is free, stable, and flexible -> Option A
  4. Quick Check:

    Linux powers servers due to freedom and stability = A [OK]
Hint: Linux is popular because it's free and reliable [OK]
Common Mistakes:
  • Thinking Linux is the only OS available
  • Believing Linux requires paid licenses
  • Assuming Linux only runs on personal computers
2. Which of the following is the correct command to check the Linux kernel version?
easy
A. pwd
B. ls -l
C. uname -r
D. cat /etc/passwd

Solution

  1. Step 1: Identify command to show kernel version

    The command uname -r displays the Linux kernel version.
  2. Step 2: Check other commands' purposes

    ls -l lists files, pwd shows current directory, cat /etc/passwd shows user info.
  3. Final Answer:

    uname -r -> Option C
  4. Quick Check:

    Kernel version command = uname -r [OK]
Hint: Use uname -r to see kernel version quickly [OK]
Common Mistakes:
  • Confusing ls -l with kernel info
  • Using pwd instead of uname
  • Trying to read unrelated files for version
3. What will be the output of the command ps aux | grep apache on a Linux server?
medium
A. Current directory contents
B. Error message about invalid command
C. System uptime information
D. List of running processes related to Apache

Solution

  1. Step 1: Understand the ps aux command

    ps aux lists all running processes on the system.
  2. Step 2: Understand the grep apache part

    grep apache filters the list to show only lines containing 'apache', showing Apache-related processes.
  3. Final Answer:

    List of running processes related to Apache -> Option D
  4. Quick Check:

    ps aux filtered by apache = running Apache processes [OK]
Hint: grep filters process list to show Apache only [OK]
Common Mistakes:
  • Expecting directory listing instead of processes
  • Thinking it shows system uptime
  • Assuming command will error out
4. You run the command systemctl start nginx but get an error saying 'Failed to start nginx.service: Unit not found.' What is the likely cause?
medium
A. Nginx is not installed on the system
B. You typed the command correctly and service is running
C. The systemctl command is not available on Linux
D. You need to reboot the server before starting nginx

Solution

  1. Step 1: Analyze the error message

    'Unit not found' means the service file for nginx does not exist, often because nginx is not installed.
  2. Step 2: Check other options' validity

    systemctl is standard on Linux; reboot is not required to start services; the command typed correctly but service missing.
  3. Final Answer:

    Nginx is not installed on the system -> Option A
  4. Quick Check:

    Unit not found = service missing = nginx not installed [OK]
Hint: Unit not found means service missing or not installed [OK]
Common Mistakes:
  • Assuming systemctl is missing
  • Thinking reboot fixes service start errors
  • Ignoring installation status of nginx
5. You want to automate daily backups on a Linux server using a script. Which Linux feature helps you schedule this task to run automatically every day at 2 AM?
hard
A. systemctl start
B. cron jobs
C. ls command
D. chmod permissions

Solution

  1. Step 1: Identify scheduling tools in Linux

    Cron is the standard Linux tool to schedule tasks to run automatically at set times.
  2. Step 2: Understand other options' purposes

    systemctl start runs services manually, ls lists files, chmod changes permissions, none schedule tasks.
  3. Final Answer:

    cron jobs -> Option B
  4. Quick Check:

    Automate daily tasks = cron jobs [OK]
Hint: Use cron to schedule tasks automatically [OK]
Common Mistakes:
  • Confusing systemctl with scheduling
  • Thinking ls or chmod schedule tasks
  • Not knowing cron is for automation
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