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

Ready to Test Your Linux & Unix Skills?

Test yourself with our Linux basics quiz and sharpen your Unix fundamentals.

Difficulty: Moderate
2-5mins
Learning OutcomesCheat Sheet
Paper art quiz illustration with Linux and Unix icons distributions commands remote tools on dark blue background

Jump into the world of Linux with our Intro to Linux Answer Quiz - your fast track to testing and mastering core Unix fundamentals! Whether you're brand-new or refreshing your skills, this linux basics quiz covers everything from selecting distributions to wielding basic commands and remote access tools. Plus, these questions simulate real-world scenarios so you can test unix fundamentals quiz concepts in a hands-on way. By taking our intro to linux answer challenge, you'll uncover strengths, spot gaps and build hands-on confidence. Ready to level up? Sharpen your command-line prowess in our Linux commands quiz and start conquering the terminal today!

Which command lists files and directories in the current directory?
ls
pwd
cp
mkdir
The ls command is provided by GNU Coreutils and by default lists the contents of the current directory. The pwd command prints the working directory path, while cp copies files and mkdir creates directories. For more detail on ls flags and usage see GNU ls documentation.
Which symbol is used to redirect the standard output of a command to a file, overwriting it?
>
>>
|
&
The > operator redirects the standard output of a command to a file, replacing its contents. The >> operator appends output instead of overwriting. The | symbol pipes output to another command, and & is used to run commands in the background. See the Bash manual on redirection here.
What command shows the current working directory path?
pwd
whoami
cd
where
The pwd (print working directory) command outputs the full path of the current directory. The cd command changes directories, whoami prints the current user, and where is not a standard Linux command for this purpose. More on pwd can be found here.
Which command is used to change file permissions?
chmod
chown
chgrp
umask
The chmod command modifies file mode bits to change permissions for user, group, and others. The chown command changes file ownership, chgrp modifies the group, and umask sets default new file permissions. See the chmod manual here.
Which command displays the first lines of a file?
head
tail
cat
less
The head command, by default, shows the first 10 lines of a file. The tail command shows the last lines, cat concatenates and displays the whole file, and less is a pager for viewing file contents interactively. For details check GNU head documentation.
Which file contains user account information, such as usernames and user IDs?
/etc/passwd
/etc/shadow
/etc/group
/etc/fstab
The /etc/passwd file lists user accounts and basic information such as UID, GID, and home directory. Password hashes are typically stored in /etc/shadow, /etc/group stores group entries, and /etc/fstab lists filesystem mounts. More on /etc/passwd is available here.
Which command is used to view running processes in a snapshot?
ps
top
free
df
The ps command reports a snapshot of current processes. The top command provides a dynamic, real-time view. free shows memory usage, and df reports disk space. For ps options, see procps-ng documentation.
Which command copies files or directories from one location to another?
cp
mv
rm
mkdir
The cp command duplicates files or directories. The mv command moves or renames items, rm removes them, and mkdir creates new directories. You can learn more about cp at GNU cp manual.
Which key combination is used to interrupt a running foreground process in the terminal?
Ctrl+C
Ctrl+Z
Ctrl+D
Ctrl+X
Pressing Ctrl+C sends the SIGINT signal to the foreground process, causing it to terminate. Ctrl+Z sends SIGTSTP to suspend the process, Ctrl+D indicates end-of-file on input, and Ctrl+X has no special function in most shells. See keybindings in the Bash manual here.
How do you search for a specific text pattern within files?
grep
find
locate
echo
The grep command searches file contents for specified patterns using regular expressions. The find command locates files by name or attributes, locate uses a database, and echo only prints provided arguments. More on grep is at GNU grep manual.
Which command moves or renames files and directories?
mv
cp
rm
ln
The mv command is used to move files or directories and can also rename them in place. The cp command copies items, rm deletes them, and ln creates links. Official documentation is available here.
What environment variable determines the search path for executable commands?
PATH
HOME
SHELL
PWD
The PATH variable lists directories the shell searches for executables. HOME is the user’s home directory, SHELL is the path to the default shell, and PWD holds the current directory. Read more about PATH at Bash execution.
Which command displays disk usage for files and directories?
du
df
free
top
The du command estimates and reports file and directory disk usage. The df command reports overall filesystem free space, free shows memory use, and top is a process monitor. For details on du see GNU du documentation.
Which command finds files by name in a directory hierarchy?
find
locate
which
grep
The find command searches the directory tree for files matching criteria like name, type, or date. locate uses a prebuilt database for name lookup, which may be outdated. which identifies executables in PATH, and grep searches file contents. More at findutils manual.
Which command shows who is currently logged into the system?
who
w
whoami
last
The who command lists users currently logged in and their terminals. The w command provides additional system load and process info, whoami shows the current user, and last displays login history. See who manual for details.
Which command changes the owner of a file or directory?
chown
chmod
chgrp
usermod
The chown command changes file owner and optionally group. chmod adjusts permissions, chgrp modifies the group only, and usermod alters user account properties. Consult chown manual.
Which file would you edit to set system-wide environment variables for all users upon login?
/etc/profile
~/.bashrc
/etc/bash.bashrc
/etc/hosts
/etc/profile is executed for login shells across all users and is appropriate for system-wide variables. ~/.bashrc applies only per-user, /etc/bash.bashrc is for non-login interactive shells, and /etc/hosts maps hostnames. Learn more at Bash startup files.
How do you display the manual page for the ls command?
man ls
info ls
help ls
--help ls
Using man ls opens the manual pages for the ls command. info ls invokes the GNU info system, help ls works for shell builtins, and --help is an option for many commands but not for accessing the full manual. More on man is at man page.
What command would you use to securely copy files between hosts over SSH?
scp
rsync
ftp
sftp
The scp command copies files over SSH in a non-interactive way. rsync can also use SSH but requires additional options, ftp is unencrypted, and sftp is an interactive file transfer program. Documentation is at OpenSSH manual.
Which tar option extracts files from an archive?
-x
-c
-t
-r
The -x option tells tar to extract files from an archive. The -c option creates archives, -t lists their contents, and -r appends files to an existing archive. More on tar options is available here.
How would you display the last 100 lines of a log file?
tail -n 100 filename
head -n 100 filename
tail -f filename
grep '100' filename
The tail command with the -n option outputs the last n lines; here -n 100 shows the final 100 lines. head -n shows the first lines, tail -f follows new data, and grep filters content by pattern. Further info is at GNU tail manual.
What command would you use to update a file’s timestamp or create an empty file if it does not exist?
touch
chmod
chown
date
The touch command updates the access and modification timestamps of a file or creates it if it doesn't exist. chmod changes permissions, chown changes ownership, and date outputs or sets the system date. Read more at touch manual.
Which option with ls displays hidden files as well?
-a
-l
-h
-A
The -a flag for ls shows all files including hidden ones (those starting with a dot). The -l flag gives a long listing, -h prints sizes in human-readable form, and -A lists almost all, omitting . and ... For more, see ls documentation.
How can you recursively remove a directory and all of its contents?
rm -r directory
rmdir directory
rm -rf directory
mv directory /dev/null
The rm -r command removes directories and their contents recursively. rmdir only works on empty directories, rm -rf forces deletion without confirmation, and mv to /dev/null is invalid. Always be cautious; see rm manual.
Which command displays the kernel’s message buffer?
dmesg
journalctl
syslog
tail /var/log/messages
The dmesg command prints the kernel ring buffer, which contains boot and hardware messages. journalctl accesses the systemd journal, syslog is a logging daemon, and tail on /var/log/messages reads a log file. See the dmesg man page here.
Which command lists all current environment variables?
env
printenv
set
export
The env command prints a list of all environment variables and their values. printenv can do similar but isn’t always installed, set shows shell variables and functions, and export sets variables for child processes. More at env manual.
How do you grant execute permission to the file script.sh for the owner only?
chmod u+x script.sh
chmod a+x script.sh
chmod +x script.sh
chown user script.sh
Using chmod u+x adds execute permission for the file’s owner (user) only. chmod a+x or +x affects user, group, and others. chown changes ownership. See details at chmod manual.
How do you check which processes are listening on TCP port 22?
ss -tlnp | grep ':22'
netstat -tlnp | grep ':22'
lsof -iTCP:22 -sTCP:LISTEN
nmap -p 22 localhost
The ss tool is the modern utility to dump socket statistics; -tlnp filters TCP listening sockets with process info, and grep ':22' selects port 22. netstat is deprecated, lsof lists open files broadly, and nmap scans ports rather than showing local processes. Learn more at ss man page.
What is the effect of the 'set -e' option in a bash script?
The script exits immediately if any command returns a non-zero status.
It prints each command before execution.
It ignores all errors in subshells.
It treats unset variables as errors.
When set -e (errexit) is enabled, the shell exits immediately if any command exits with a non-zero status. It does not print commands (that’s set -x), nor does it ignore subshell errors or treat unset variables specially (that’s set -u). See Bash set builtin for details.
How do you create an ext4 filesystem on /dev/sdb1 and assign it the label 'MyVolume'?
mkfs.ext4 -L MyVolume /dev/sdb1
mkfs -t ext4 -l MyVolume /dev/sdb1
mkfs.ext3 -L MyVolume /dev/sdb1
mkfs.vfat -n MyVolume /dev/sdb1
The mkfs.ext4 command with the -L option sets the volume label on an ext4 filesystem. The mkfs -t ext4 syntax does not support -l for label, mkfs.ext3 creates an ext3 FS, and mkfs.vfat is for FAT filesystems. Detailed options are in mkfs.ext4 man page.
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 symbol is used to redirect the standard output of a command to a file, overwriting it?, What command shows the current working directory path?","img":"https://www.quiz-maker.com/3012/images/ogquiz.png"}

Study Outcomes

  1. Understand Core Linux & Unix Distributions -

    Differentiate between major distros like Ubuntu, CentOS, and Debian, as introduced in the intro to linux answer quiz.

  2. Apply Essential Command-Line Operations -

    Perform file navigation, directory management, and text editing using commands like ls, cd, cp, and nano in the linux basics quiz context.

  3. Identify and Manage File Permissions -

    Use chmod, chown, and ls -l to interpret and adjust file permissions and ownership on Unix systems.

  4. Demonstrate Secure Remote Access -

    Establish SSH connections, transfer files with scp, and understand key-based authentication methods.

  5. Analyze and Troubleshoot Common CLI Errors -

    Recognize typical command errors, parse error messages, and apply debugging strategies to resolve issues.

  6. Evaluate Fundamental Processes and Services -

    Use ps, top, and systemctl to monitor processes, manage services, and grasp basic process control concepts.

Cheat Sheet

  1. Understanding Linux Distributions -

    Knowing how distributions differ is key to the intro to linux answer. Debian (apt), Red Hat (yum/dnf), Arch (pacman) and SUSE (zypper) each cater to unique use cases; use the "DEAR" mnemonic (Debian, Enterprise, Arch, RedHat) to recall. Official docs from The Linux Foundation offer in-depth comparisons.

  2. Filesystem Hierarchy Standard (FHS) -

    The FHS, maintained by the Linux Foundation, defines directory roles: /etc for config, /home for users, /var for logs and /usr for apps. Remember "Every Home Value Underpins System" to map common paths. This structure is crucial for both troubleshooting and scripting.

  3. Core Command-Line Tools -

    Master commands like ls, cd, pwd, cp, mv and rm - you'll often see them on a basic linux commands quiz. Practice with flags (e.g., ls -lha shows hidden details) and chaining with pipes (e.g., ps aux | grep ssh). The Linux Documentation Project provides examples and use cases.

  4. File Permissions and Ownership -

    Understand chmod's numeric modes (r=4, w=2, x=1) to set rights, and chown to change owners; this often appears on linux basics quiz sections. A quick mnemonic is "421 Rule" for read, write, execute bits. Refer to official GNU documentation for practical scenarios.

  5. Remote Access with SSH -

    SSH (Secure Shell) is essential in a unix fundamentals quiz or linux and unix quiz format - use ssh user@host for login and scp for file transfers. Set up key-based auth with ssh-keygen for passwordless, secure sessions. The OpenSSH manual is the authoritative resource.

Powered by: Quiz Maker