Linux Command Line Beginner Quiz
30 questions on Linux Command Line – Complete Beginner to Advanced Guide.
Question 1: What is the core of the Linux operating system called?
- A. The Shell
- B. The Kernel — (correct answer)
- C. The Terminal
- D. The Command Line
Explanation: The kernel is the core component of Linux that manages the hardware, CPU, memory, and talks directly to the hardware on behalf of the software.
Question 2: Which command displays the current directory path?
- A. ls
- B. cd
- C. pwd — (correct answer)
- D. dir
Explanation: pwd stands for "Print Working Directory" and outputs the absolute path of the directory you are currently in.
Question 3: Which command lists the files and directories in your current location?
- A. show
- B. list
- C. ls — (correct answer)
- D. pwd
Explanation: The ls command lists the contents of the current directory.
Question 4: How do you change directories in Linux?
- A. change_dir
- B. open
- C. move
- D. cd — (correct answer)
Explanation: cd stands for "Change Directory". Example: cd /var/www/.
Question 5: Which command goes UP one level to the parent directory?
- A. cd up
- B. cd .. — (correct answer)
- C. cd /
- D. cd ~
Explanation: In Linux, .. represents the parent directory, while . represents the current directory.
Question 6: Which command creates a new, empty directory?
- A. createdir
- B. mkdir — (correct answer)
- C. newdir
- D. md
Explanation: mkdir stands for "Make Directory". Example: mkdir new_folder.
Question 7: How do you create a new, empty file quickly?
- A. create file.txt
- B. new file.txt
- C. touch file.txt — (correct answer)
- D. add file.txt
Explanation: The touch command updates a file's timestamp, but if the file doesn't exist, it creates a new empty file.
Question 8: Which command removes or deletes a file?
- A. delete
- B. remove
- C. rm — (correct answer)
- D. del
Explanation: The rm command permanently removes files. Be careful, as there is no "Recycle Bin" by default in the terminal!
Question 9: How do you copy a file named report.txt to a folder named backup?
- A. cp report.txt backup/ — (correct answer)
- B. copy report.txt backup/
- C. mv report.txt backup/
- D. clone report.txt backup/
Explanation: The cp command stands for "copy". The first argument is the source, and the second is the destination.
Question 10: Which command is used to move AND rename files?
- A. move
- B. rn
- C. rename
- D. mv — (correct answer)
Explanation: The mv command "moves" files. If you move a file to the same directory but with a new name, it effectively renames it.
Question 11: What does the cat command do?
- A. Concatenates and displays the contents of a file on the screen — (correct answer)
- B. Catalogs the directory
- C. Catches errors in the system
- D. Calculates file sizes
Explanation: cat file.txt prints the entire contents of the file directly to your terminal.
Question 12: Which command is used to search for a specific word or pattern inside a file?
- A. search
- B. find
- C. grep — (correct answer)
- D. locate
Explanation: grep is a powerful text-search utility. Example: grep "error" log.txt finds all lines containing the word "error".
Question 13: What does the sudo command do?
- A. Shuts down the computer
- B. Switches the user permanently
- C. Executes a command with superuser (root) privileges — (correct answer)
- D. Updates the system
Explanation: sudo stands for "SuperUser DO". It allows standard users to run administrative commands temporarily.
Question 14: Which key do you press to autocomplete a file or folder name while typing in the terminal?
- A. Enter
- B. Space
- C. Shift
- D. Tab — (correct answer)
Explanation: Tab completion is a massive time-saver in Linux. Typing cd Doc and pressing Tab will autocomplete to cd Documents/.
Question 15: What does the ~ (tilde) symbol represent in Linux file paths?
- A. The root directory
- B. The current user's home directory — (correct answer)
- C. The previous directory
- D. The trash folder
Explanation: cd ~ (or simply cd) will always take you back to your personal home folder, like /home/username/.
Question 16: How do you view hidden files (files starting with a dot) using the ls command?
- A. ls --hidden
- B. ls -a — (correct answer)
- C. ls -l
- D. ls -show
Explanation: The -a (all) flag tells ls to display all files, including hidden configuration files like .bashrc.
Question 17: What does the command rm -r foldername do?
- A. Removes the folder safely by moving it to trash
- B. Renames the folder
- C. Removes a directory and its contents recursively — (correct answer)
- D. Reads the folder contents
Explanation: The -r (recursive) flag is required to delete directories that contain other files or folders.
Question 18: What command would you use to change the permissions of a file?
- A. chown
- B. chgrp
- C. chmod — (correct answer)
- D. setperm
Explanation: chmod (Change Mode) modifies the read, write, and execute permissions of a file or directory.
Question 19: In Linux file permissions, what does chmod 777 do?
- A. Removes all permissions
- B. Grants Read, Write, and Execute permissions to everyone (Owner, Group, and Others) — (correct answer)
- C. Grants permissions only to the owner
- D. Deletes the file
Explanation: 7 stands for Read (4) + Write (2) + Execute (1). 777 is highly insecure and gives full control to all users.
Question 20: Which command changes the owner of a file?
- A. chmod
- B. chown — (correct answer)
- C. chuser
- D. switch
Explanation: chown (Change Owner) is used to assign ownership of a file to a specific user or group (e.g., chown root file.txt).
Question 21: How do you view a live, constantly updating stream of the newest lines appended to a log file?
- A. cat log.txt
- B. tail -f log.txt — (correct answer)
- C. less log.txt
- D. watch log.txt
Explanation: tail shows the end of a file. The -f (follow) flag keeps the file open and prints new lines as they are written in real-time.
Question 22: What does the top command do?
- A. Brings you to the top directory (
/)
- B. Displays real-time information about running processes, CPU, and memory usage — (correct answer)
- C. Shows the largest files on the hard drive
- D. Shuts down the top processes
Explanation: top (or htop) acts like the Windows Task Manager right in your terminal.
Question 23: Which command safely safely stops a running process by its Process ID (PID)?
- A. stop
- B. end
- C. kill — (correct answer)
- D. terminate
Explanation: The kill command sends a signal (like SIGTERM) to a process, asking it to safely shut down. Example: kill 1234.
Question 24: What is the package manager used in Debian and Ubuntu-based Linux distributions?
- A. yum
- B. pacman
- C. apt (or apt-get) — (correct answer)
- D. rpm
Explanation: Advanced Package Tool (apt) is used to install, update, and remove software on Ubuntu. Example: sudo apt install curl.
Question 25: Which character is used to "pipe" the output of one command directly into the input of another command?
- A. >
- B. &
- C. | — (correct answer)
- D. <
Explanation: The pipe operator | chains commands together. Example: ls -la | grep "doc" passes the directory list into grep to filter it.
Question 26: What does the > operator do in the terminal?
- A. Redirects the output of a command and overwrites a file — (correct answer)
- B. Appends the output to an existing file
- C. Redirects an error message
- D. Compares two files
Explanation: echo "Hello" > file.txt will write "Hello" into the file, completely replacing any previous contents. To append, use >>.
Question 27: What is the absolute root directory of a Linux filesystem, from which all other folders branch out?
- A. C:\
- B. /home/
- C. / — (correct answer)
- D. /root/
Explanation: The forward slash / is the root of the filesystem. Every file and folder on the system lives inside it.
Question 28: Which command is used to download files directly from the internet via HTTP/HTTPS?
- A. get
- B. wget — (correct answer)
- C. download
- D. fetch
Explanation: wget (Web Get) or curl are the standard command-line utilities for downloading files from the web.
Question 29: What does the command history do?
- A. Shows the system uptime
- B. Displays a numbered list of all the commands you have previously typed in the terminal — (correct answer)
- C. Shows the Git commit log
- D. Shows browser history
Explanation: history is extremely useful if you forgot a complex command you ran yesterday. You can rerun a command by typing !number.
Question 30: How can you run a command in the background so it doesn't block your terminal?
- A. Add
& to the end of the command — (correct answer)
- B. Add
bg to the start of the command
- C. Press Ctrl+C
- D. Add
--background to the end
Explanation: Running python script.py & starts the process in the background, immediately giving you your terminal prompt back.