Unlock hundreds more features
Save your Quiz to the Dashboard
View and Export Results
Use AI to Create Quizzes and Analyse Results

Sign inSign in with Facebook
Sign inSign in with Google

Master the Linux Basics Quiz Challenge

Assess Command Line Fundamentals in This Quiz

Difficulty: Moderate
Questions: 20
Learning OutcomesStudy Material
Colorful paper art depicting elements related to a Linux Basics Quiz

Ready to test your Linux command-line skills? This Linux Basics Quiz challenges learners with multiple-choice questions on commands, file operations, and shell scripting essentials. Ideal for students or professionals seeking to sharpen their Linux fundamentals, it provides instant feedback to guide your learning journey. Feel free to tailor the quiz using our interactive editor. Explore related tests like Linux System Administration Knowledge Test, enhance coding practice with the Python Basics Knowledge Test, or browse more quizzes to continue honing your expertise.

Which command lists files and directories in the current directory?
pwd
cd
mkdir
ls
The ls command lists the contents of the current directory. It displays files and folders by default.
Which command prints the current working directory?
pwd
cd
whoami
ls
pwd stands for print working directory and outputs the absolute path of the current directory. It is the standard way to check where you are in the file system.
Which command is used to change the current directory?
cp
pwd
mv
cd
The cd (change directory) command changes the shell's current working directory to the specified path. No other command alters your directory context.
Which command displays the first 10 lines of a file by default?
tail
less
head
cat
head outputs the start of a file, showing the first 10 lines by default. tail shows the last lines, while cat concatenates and less paginates.
Which command creates a new directory?
rmdir
touch
mkdir
rm
mkdir (make directory) creates one or more new directories with the given names. touch is for files, rmdir removes empty directories, and rm deletes files.
Which option of the cp command copies directories and their contents recursively?
cp -f
cp -v
cp -r
cp -a
The -r or --recursive option tells cp to copy directories and all their contents recursively. Other flags control force, verbose, or archive modes.
Which command is used to move or rename files and directories?
mv
rm
ln
cp
mv moves or renames files and directories. cp copies them, rm deletes them, and ln creates links.
Which command removes a directory and all its contents without prompting?
del
rmdir
rm -rf
rm -r
rm -rf uses -r for recursive deletion and -f to force removal without confirmation. rmdir only removes empty directories and rm -r may prompt.
Which option makes grep perform a case-insensitive search?
grep -i
grep -r
grep -v
grep -n
The -i option tells grep to ignore case distinctions in both the pattern and the input. Other flags invert match, recurse, or number lines.
Which command finds files named "*.log" in the current directory and its subdirectories?
locate *.log
grep "*.log"
ls *.log
find . -name "*.log"
find . -name "*.log" searches recursively from the current directory for filenames matching the pattern. grep searches contents, locate uses an indexed database, and ls is not recursive.
Which command displays filesystem disk space usage in human-readable format?
free -h
df -h
du -h
lsblk
df reports filesystem disk space usage and -h prints sizes in human-readable units. du shows directory-wise usage, free is for memory, and lsblk lists block devices.
Which command creates a symbolic link to a file?
ln source target
mv source target
ln -s source target
cp source target
ln -s creates a symbolic link from target pointing to source. Without -s it would create a hard link instead.
How do you export an environment variable VAR with value "test" in the current shell session?
export VAR="test"
set VAR=test
VAR="test"
env VAR test
export VAR="test" defines VAR and exports it to the environment in the current shell. Simply assigning without export won't propagate it to child processes.
Which command prints all environment variables and their values?
export
printenv
set
env
printenv lists all environment variables passed to the process. env alone can also list them, but printenv is the dedicated command for this purpose.
In a bash script, which variable holds the first command-line argument?
$#
$1
$0
$@
$1 expands to the first argument passed to a shell script. $0 is the script's name, $# is the argument count, and $@ is all arguments.
Which signal does kill send by default if no option is specified?
SIGTERM
SIGHUP
SIGINT
SIGKILL
kill without specifying a signal sends SIGTERM (signal 15), allowing processes to perform cleanup. SIGKILL (signal 9) requires -9 and cannot be caught.
Which numeric mode in chmod sets permissions rwxr-x--x?
755
640
711
751
Numeric mode digits represent owner, group, and others. 7=4+2+1 (rwx), 5=4+1 (r-x), 1=1 (--x), so 751 yields rwxr-x--x.
How do you recursively change the owner to alice and group to dev on /path?
chown -R alice:dev /path
chown alice:dev /path -R
chown --recursive alice:dev /path
chown alice:dev -R /path
chown -R alice:dev /path uses -R before the user:group specifier to apply changes recursively. Placing -R elsewhere or using --recursive incorrectly may fail.
What is the purpose of the shebang (e.g. #!/bin/bash) at the top of a script?
It defines an environment variable
It specifies the interpreter to execute the script
It comments out the first line
It sets the script's working directory
The shebang line tells the operating system which interpreter to use for executing the script. Without it, the default shell may be used.
In a bash conditional, which test checks if /tmp/test is executable?
[ -w /tmp/test ]
[ -x /tmp/test ]
[ -r /tmp/test ]
[ -e /tmp/test ]
The -x test returns true if the file exists and is executable. -e checks existence, -w checks write permission, and -r checks read permission.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
0
{"name":"Which command lists files and directories in the current directory?", "url":"https://www.quiz-maker.com/QPREVIEW","txt":"Which command lists files and directories in the current directory?, Which command prints the current working directory?, Which command is used to change the current directory?","img":"https://www.quiz-maker.com/3012/images/ogquiz.png"}

Learning Outcomes

  1. Identify core Linux commands and their functions
  2. Apply file system navigation skills confidently
  3. Demonstrate proficiency in process management techniques
  4. Analyse permissions and user management scenarios
  5. Evaluate basic shell scripting concepts
  6. Master environment variable configuration and usage

Cheat Sheet

  1. Master Essential Linux Commands - Get hands-on with must-know commands like pwd, ls, and cd to effortlessly move around the file system. These basics form the foundation for everything you'll do in the terminal. Embrace the command line and watch your confidence soar! Linux Basic Commands Guide
  2. Understand File System Navigation - Dive into absolute vs. relative paths and practice jumping between folders with cd and verifying your location with pwd. Knowing how to find your way around is like having a treasure map in the terminal world. Navigate directories like a fearless explorer! Linux Basic Commands Guide
  3. Manage Processes Efficiently - Keep an eye on running tasks with ps, peek at live stats using top, and send rogue programs packing with kill. Process management is your backstage pass to a smooth-running system. Take control of your CPU and memory resources like a true sysadmin star! Advanced Shell Commands
  4. Grasp File Permissions - Decode the magic of read (r), write (w), and execute (x) bits for owners, groups, and others. Use chmod to grant or restrict access so your files stay safe and sound. Master these permission bits and protect your data vault like a Linux guardian! Linux System Admins Handbook
  5. Manage Users and Groups - Learn to add, tweak, and remove user accounts with useradd, usermod, and groupadd. Organizing users ensures everyone has the right access and permissions. Become the ultimate gatekeeper of your Linux kingdom! Linux System Admins Handbook
  6. Explore Basic Shell Scripting - Kick off your scripting journey by automating simple tasks with loops, variables, and conditionals in .sh files. Shell scripts let you tackle repetitive actions in seconds. Watch your productivity skyrocket as you turn routine chores into one-click wonders! Linux Basic Commands Guide
  7. Configure Environment Variables - Tweak and export variables to customize your shell's behavior and set up tools just the way you like them. From PATH tweaks to custom prompts, these settings are your command-line superpowers. Personalize your workspace for peak efficiency! Linux Command Line Tutorial
  8. Utilize the man Command - Treat the man pages as your personal Linux encyclopedia - just type man followed by any command to unlock on-demand guidance. Detailed docs and examples are always a keystroke away. Become a self-sufficient wizard with built-in manuals at your fingertips! Linux Basic Commands Guide
  9. Practice File Manipulation - Create, copy, move, and delete files and folders using touch, cp, mv, and rm. Mastering these commands means you can sculpt your file system effortlessly. Shape your directories like an artist with a digital chisel! Linux Basic Commands Guide
  10. Understand the Linux Directory Structure - Familiarize yourself with essential folders like /bin, /etc, /home, and /var to know where everything lives. This roadmap is key to effective system management and troubleshooting. Navigate like a pro and never lose your way again! Linux Basic Commands Guide
Powered by: Quiz Maker