Based on the Linux Master 1 exam syllabusReport an error
mount vs /etc/fstab, start vs enable, firewall-cmd without --permanent./etc/exports and the spaces around = in shell variable assignment are classic point-losing traps on the practical exam.| Task | Command |
|---|---|
| Add a user | useradd -m -s /bin/bash name |
| Set a password | passwd name |
| Modify a user | usermod -G group name |
| Delete a user | userdel -r name (including home) |
| Add a group | groupadd group |
| Change permissions | chmod 755 file |
| Change owner | chown user:group file |
| Special permission | chmod u+s (SetUID) |
Practical exam points: Get useradd's -m (create home), -s (specify shell), -G (supplementary group), and -u (UID) exactly right. The -r in userdel -r deletes the home directory and mail spool too.
find, grep, awk, and sed are the core tools of the practical hands-on tasks.| Command | Purpose | Example |
|---|---|---|
find | File search | find / -name "*.log" -type f |
grep | Pattern search | grep -rn "error" /var/log |
awk | Field processing | awk '{print $1}' file |
sed | Stream editing | sed 's/old/new/g' file |
sort/uniq | Sorting and duplicates | `sort file |
wc | Counting | wc -l file |
find options in focus: -name (name), -type f/d (file/directory), -mtime +7 (modified more than 7 days ago), -size +100M (size), -perm (permissions), -exec ... {} \; (execute). On the practical exam, you use the -exec rm {} \; form.
fdisk /dev/sdb # create a partition
mkfs.ext4 /dev/sdb1 # create a filesystem
mkdir /data # mount point
mount /dev/sdb1 /data # temporary mount
# register permanently in /etc/fstab:
# /dev/sdb1 /data ext4 defaults 0 0
⚠️ Practical exam trap: A temporary mount (
mount) disappears on reboot. For a permanent mount, you must register it in/etc/fstab. You must write the 6 fstab fields (device, mount point, type, options, dump, fsck order) exactly to avoid losing points.
| Task | Command/Format |
|---|---|
| Register a recurring job | crontab -e |
| cron format | minute hour day month weekday command |
| One-time scheduling | at time |
| Check processes | `ps -ef |
| Force kill | kill -9 PID |
| Kill by name | killall process-name |
0 3 * * 1 /backup.sh = runs every Monday at 03:00.cron field order: minute (0-59) hour (0-23) day (1-31) month (1-12) weekday (0-7, 0 and 7 = Sunday). * means every time, */10 means every 10 units, 1-5 is a range, and 1,15 is a list.
| Service | Configuration File | Key Entries |
|---|---|---|
| Network | /etc/sysconfig/network-scripts/ifcfg-* | IPADDR, NETMASK, GATEWAY |
| DNS client | /etc/resolv.conf | nameserver |
| Hostname | /etc/hostname | hostname |
| SSH | /etc/ssh/sshd_config | Port, PermitRootLogin |
| Firewall | firewall-cmd | --add-port, --permanent |
Firewall on the practical exam: To open a port permanently, run firewall-cmd --permanent --add-port=80/tcp and then firewall-cmd --reload. Without --permanent, it disappears on reboot.
| Task | Command |
|---|---|
| Start | systemctl start service |
| Stop | systemctl stop service |
| Restart | systemctl restart service |
| Reload configuration | systemctl reload service |
| Enable at boot | systemctl enable service |
| Check status | systemctl status service |
⚠️ enable vs start:
startstarts it now, andenablestarts it automatically at boot. They are separate, so if you need both, usesystemctl enable --now service.
| Log | Path | Purpose |
|---|---|---|
| General system | /var/log/messages | General kernel and service messages |
| Authentication/security | /var/log/secure | Login and sudo records |
| Boot | /var/log/boot.log | Boot messages |
/var/log/maillog | Mail sending and receiving |
tail -f /var/log/messages; to extract a specific pattern, use grep "Failed" /var/log/secure.journalctl on the practical exam: In a systemd environment, you also use journalctl -u service-name (logs for a specific service), journalctl -b (this boot), and journalctl -f (real-time).
| Element | Syntax |
|---|---|
| Shebang | #!/bin/bash |
| Variable | VAR=value (no spaces) |
| Conditional | if [ condition ]; then ... fi |
| Loop | for i in list; do ... done |
| Arguments | $1 $2 ... $# (count) $@ (all) |
Test operators: -f (file exists), -d (directory), -z (empty string), -eq/-ne/-lt/-gt (numeric comparison). Spaces on both sides inside [ ] are mandatory.
Variable assignment trap: Putting spaces around =, as in VAR = value, causes an error. Always write it joined, as VAR=value. Reference it with $VAR or ${VAR}.
| Requirement | Number | Command |
|---|---|---|
| Owner full, group and others read and execute | 755 | chmod 755 |
| Owner read and write, others read | 644 | chmod 644 |
| SetUID + 755 | 4755 | chmod 4755 |
| Sticky + 777 | 1777 | chmod 1777 |
Calculation in one line: rwx=7, rw-=6, r-x=5, r--=4. Special permissions are added as the leading digit of the 4 digits (SetUID 4, SetGID 2, Sticky 1). The permission of /tmp is 1777 (Sticky+777).
/etc/exports)/srv/share 192.168.1.0/24(rw,sync,no_subtree_check)
/etc/samba/smb.conf)[data]
path = /srv/data
writable = yes
valid users = @staff
crontab -e)30 2 * * * /usr/local/bin/backup.sh
The exports whitespace trap: You must not put a space between client(options). If you separate them as in 192.168.1.0/24 (rw), rw is opened to all hosts. The number one point-loser on the practical exam.
| Symbol | Meaning |
|---|---|
| ` | ` |
> | Overwrite output |
>> | Append output |
2> | Redirect standard error |
&& | Run the next if the previous succeeded |
; | Run sequentially (regardless of success) |
ps -ef | grep nginx | grep -v grep | awk '{print $2}' — extracts only nginx's PID.Combination examples: du -sh * | sort -rh | head (largest first), cat access.log | grep 404 | wc -l (count of 404s). The mindset of chaining filters with pipes is the core of the practical exam.
| Situation | Response |
|---|---|
| Lost root password | Enter rescue/single mode from GRUB, then passwd |
| Boot failure due to an fstab error | Fix fstab in emergency mode |
| Service fails to start | Trace the cause with systemctl status and journalctl -xe |
| Disk full | Find large files with du and clean up, rotate logs |
Single-user mode: If you enter by adding single or rd.break to the kernel line in the GRUB menu, you can do recovery work with root privileges. This is the standard procedure for password recovery.
You need to practice spelling and options repeatedly by hand. Check yourself with the mock exam below.
useradd -m -s : The option combination that creates an account by making a home directory (-m) and specifying a login shell (-s).userdel -r : An option that deletes the home directory and mailbox along with the account.-exec {} \; : The syntax by which find runs a command for each file found. {} stands in for the file name./etc/fstab that persists after reboot. If you only run mount, it is temporary.enable vs start : Register to start automatically at boot / start immediately now. If you need both, use enable --now.--permanent + --reload : The two steps that save a firewalld setting permanently and apply it to the current session.-u (service), -b (this boot), -f (real-time)./tmp is 1777).|) : A connection that passes the previous command's output as the next command's input. The mindset of chaining filters is the core of the practical exam.single or rd.break. It is the standard procedure for resetting the root password.Click a choice to reveal the answer and explanation.
Question 1
Which command correctly creates the user 'kim' with a home directory and sets the login shell to bash?
Question 2
Which command recursively searches for the string "error" under /var/log with line numbers?
Question 3
Which file must you register the added disk partition /dev/sdb1 in so that it is automatically mounted at /data even after a reboot?
Question 4
Which crontab entry runs /backup.sh every Monday at 3 AM?
Question 5
Which is the correct procedure for permanently opening port 80/tcp in firewalld so that it persists after reboot?
Question 6
Which command starts the httpd service now and also sets it to run automatically at boot, all at once?
Question 7
Which command uses find to locate and delete files under /tmp that have not been modified for more than 7 days?
Question 8
Which sed command replaces every "old" with "new" in a text file and prints the result?
Question 9
Which command terminates all running 'nginx' processes at once by name?
Question 10
Which command correctly adds the SetUID permission to the file report.sh?