This Linux quiz helps you check what you know about the Linux command line before an exam, an interview or your first job on a server. There are two short quizzes on this page, plus a revision guide with the commands and facts they test.

The first quiz covers Linux basics: files, directories, paths, permissions and everyday commands. The second covers users and groups: creating and removing accounts, group membership and the files that store this information.

Linux quiz

How to use this Linux quiz

Each question has one correct answer, and you see your score at the end. For the best results:

  1. First, take each quiz without looking anything up.
  2. Then note the questions you got wrong.
  3. Next, read the revision notes below and the linked guides.
  4. Finally, retake the quiz a day later to check that the knowledge stuck.

Aim for at least 80% before an interview. If you score lower, start with Linux fundamentals and basic commands.

Linux Basics Quiz

/10
1 votes, 5 avg
3
Created on

Linux Basic Quiz

Linux Basics Quiz

1 / 10

Question: How to check RAM usage in GB?

2 / 10

Question: Identify the service which is used to translate a domain name to IP address.

3 / 10

Question: What command is used to count the total number of lines, words, and characters contained in a file?

4 / 10

Question: Total primary partitions that can exist on one drive is ...........?

5 / 10

Question: Identify the command which is used to create Linux File systems.

6 / 10

Question: Which command is used to create a user?

7 / 10

Question: How to enter insert mode in the VIM editor?

8 / 10

Question: In which of the following directory does the configuration files are present?

9 / 10

Question: What command is used to remove files?

10 / 10

Question: What command is used to remove the directory?

Your score is

0%

Please rate this quiz

Linux Users and Groups Quiz

/10
0 votes, 0 avg
0
Created on

Linux User and Group Quiz

Linux User and Group Quiz

1 / 10

Question: By default, a Linux user belongs to which group?

2 / 10

Question: Which command is used to add a user in group?

3 / 10

Question: The encrypted password of a user is stored in ____?

4 / 10

Question: When a user is created, the group ID GID is listed in which file?

5 / 10

Question: Which of the following commands can be used to change the user’s password?

6 / 10

Question: Which of the following identifiers are associated with a process that determines its privilege level?

7 / 10

Question: The shell connection is _____?

8 / 10

Question: What is the default permission on the user's home directory?

9 / 10

Question: A user can change the default shell connection using ______?

10 / 10

Question: User ID which equals 0 is ______ ?

Your score is

0%

Please rate this quiz

Revision notes: Linux basics

Paths and navigation

An absolute path starts at the root directory, for example /etc/ssh/sshd_config. A relative path starts from your current directory, for example ../logs. In addition, ~ means your home directory, . means the current directory and .. means the parent.

CommandWhat it does
pwdPrints the current directory
ls -laLists all files, including hidden ones, with details
cd /var/logChanges to a directory
mkdir -p a/b/cCreates nested directories
cp -r src dstCopies a directory recursively
mv old newMoves or renames a file
rm -r dirRemoves a directory and its contents (no recycle bin)
find / -name "*.conf"Searches for files by name
grep -r "error" /var/logSearches text inside files

File permissions

Every file has permissions for three classes: the owner (u), the group (g) and others (o). Each class can have read (r = 4), write (w = 2) and execute (x = 1).

For example, chmod 750 script.sh gives the owner full access (7), the group read and execute (5) and others nothing (0). Similarly, chown alice:devs report.txt changes the owner and group. Read more in our guide to Linux file and directory permissions, and for SUID, SGID and the sticky bit see advanced permissions.

Revision notes: users and groups

Key files

FileWhat it stores
/etc/passwdUser accounts: name, UID, GID, home directory and shell
/etc/shadowHashed passwords and password ageing (root-only)
/etc/groupGroups and their members
/etc/gshadowGroup passwords and administrators

Key commands

CommandWhat it does
useradd -m -s /bin/bash aliceCreates a user with a home directory and Bash shell
passwd aliceSets or changes a password
usermod -aG sudo aliceAdds a user to a group without removing others
userdel -r aliceDeletes a user and their home directory
groupadd devsCreates a group
id aliceShows UID, GID and group memberships
chage -l aliceShows password expiry settings

A common trap is usermod -G without -a. It replaces all of the user’s supplementary groups instead of adding one. Also note that the root user always has UID 0. On most modern distributions, regular users start at UID 1000.

For the full walkthrough, read Linux user and group management.

Ready for more?

Once you pass both quizzes, move on to real server skills. For example, practise creating swap and LVM partitions in a virtual machine. Then prepare with our Linux interview questions.

Sources

Running Linux servers in production? Our Linux server hardening & security audit checks configuration, patching, SSH and logging. You can also use our free Linux server hardening checklist, or contact us.