Based on the Linux Master 1 exam syllabusReport an error
022 → 644 / 755.kill. For nice, the smaller the value, the higher the priority.rpm, dpkg, insmod) cannot resolve dependencies automatically, while high-level tools (yum, apt, modprobe) can.| Shell | Features |
|---|---|
| bash | Linux default, sh-compatible + extensions |
| csh/tcsh | C-like syntax, history |
| ksh | Korn shell, used in many commercial Unix systems |
| zsh | Powerful autocompletion and plugins |
export, it is an environment variable (inherited by child processes); a plain assignment makes it a shell variable (not inherited).| Variable | Meaning |
|---|---|
PATH | Search path for executables |
HOME | Home directory |
PS1 | Default prompt string |
SHELL | Login shell path |
LANG | Default locale and language |
UID | User ID |
Configuration files in one line: /etc/profile (global, login), ~/.bash_profile (personal, once at login), ~/.bashrc (personal, each time a shell is opened). Aliases usually go in .bashrc.
| Special Permission | Number | Meaning | Notation |
|---|---|---|---|
| SetUID | 4000 | Run with the owner's privileges | s (owner x position) |
| SetGID | 2000 | Run with the group's privileges; directory group inheritance | s (group x position) |
| Sticky Bit | 1000 | Only the owner can delete (shared directories) | t (others x position) |
/usr/bin/passwd is SetUID (so a regular user can modify /etc/shadow), and /tmp has the Sticky Bit (anyone can write, but you can delete only your own).⚠️ umask trap: umask is a value that subtracts permissions. It is subtracted from the default 666 for files and 777 for directories. umask 022 → files 644, directories 755. Execute permission is never added to files by umask.
Watch for uppercase S/T: If SetUID/Sticky is set but there is no execute permission (x), it is shown as uppercase S/T rather than lowercase (indicating a permission conflict).
| Command | Role |
|---|---|
fdisk/parted | Create and manage partitions |
mkfs | Create a filesystem (format) |
mount/umount | Mount and unmount |
df | Disk usage (filesystem) |
du | Directory usage |
fsck | Check and repair filesystems |
/etc/fstab in order: device · mount point · filesystem · options · dump · fsck order.| RAID | Features | Minimum Disks |
|---|---|---|
| 0 | Striping, faster, no redundancy | 2 |
| 1 | Mirroring, higher reliability | 2 |
| 5 | One distributed parity | 3 |
| 6 | Two distributed parities | 4 |
| 1+0 | Mirror + stripe | 4 |
LVM 3-layer structure: Physical Volume (PV) → Volume Group (VG) → Logical Volume (LV). The order is pvcreate → vgcreate → lvcreate. Its biggest advantage is expanding capacity without downtime.
| Command | Role |
|---|---|
ps | Process snapshot |
top | Real-time monitoring |
kill/killall | Send signals |
nice/renice | Adjust priority |
jobs/fg/bg | Job control |
nohup | Keep running after logout |
| Number | Name | Meaning |
|---|---|---|
| 1 | SIGHUP | Restart / reload configuration |
| 2 | SIGINT | Interrupt (Ctrl+C) |
| 9 | SIGKILL | Forced termination (cannot be ignored) |
| 15 | SIGTERM | Graceful termination (default) |
| 18/19 | SIGCONT/SIGSTOP | Resume/stop |
⚠️ nice value range:
-20(highest priority) to19(lowest). The smaller the value, the higher the priority. Only root can specify negative values.
kill default: kill PID sends 15 (SIGTERM) by default. If it doesn't die, use kill -9. Signal 9 cannot be ignored or blocked by the process.
| Family | Low-level | High-level (automatic dependencies) |
|---|---|---|
| Red Hat (rpm) | rpm | yum/dnf |
| Debian (deb) | dpkg | apt/apt-get |
| Task | rpm | yum |
|---|---|---|
| Install | rpm -ivh | yum install |
| Upgrade | rpm -Uvh | yum update |
| Remove | rpm -e | yum remove |
| Query | rpm -qa | yum list |
| Package owning a file | rpm -qf | - |
Key difference: rpm/dpkg cannot resolve dependencies automatically (they only report an error). yum/apt automatically fetch and resolve dependent packages from repositories.
The 3 steps of compiling from source: ./configure (check the environment, generate the Makefile) → make (compile) → make install (install). Specify the install path with the configure option --prefix.
| File | Contents | Permissions |
|---|---|---|
/etc/passwd | Basic account information (7 fields) | 644 (public) |
/etc/shadow | Password hashes and expiry policy | 000/400 (protected) |
/etc/group | Groups and members | 644 |
/etc/skel | Home template for new accounts | - |
/etc/login.defs | Defaults for account creation | - |
UID conventions: 0 = root, 1-999 = system accounts, 1000 and up = regular users (starting from 500 on some distributions). An account with UID 0 has the same privileges as root, so be careful for security reasons.
Why shadow is protected: If the password hashes are exposed, offline cracking becomes possible, so permissions are restricted to 000/400. That's why you see only an x in the password field when you look at passwd.
| Tool | Purpose | Configuration |
|---|---|---|
| cron | Recurring jobs | crontab -e, /etc/crontab |
| at | One-time scheduling | at time |
| anacron | Catch up on jobs missed after boot | /etc/anacrontab |
cron.allow/cron.deny) are traps.allow/deny priority: If cron.allow exists, only the users listed there are allowed (deny is ignored). If it doesn't exist, only users not in cron.deny are allowed. allow is stronger than deny.
| Command | Purpose |
|---|---|
tar | Bundle/extract archives |
gzip/gunzip | Compress/decompress .gz |
bzip2 | .bz2 (high compression ratio) |
xz | .xz (highest compression ratio) |
dd | Block-level copy and images |
c (create), x (extract), v (show progress), f (file name), z (gzip), j (bzip2).tar in one line: To bundle, tar czvf out.tar.gz dir; to extract, tar xzvf out.tar.gz. Change z to j for bzip2. Always put f right before the file name.
| Step | Command/Task |
|---|---|
| Mount options | Add usrquota,grpquota in fstab |
| Create the database | quotacheck -cug /partition |
| Enable quotas | quotaon /partition |
| Set limits | edquota user |
| Check | quota user, repquota |
soft vs hard: With a soft limit, exceeding it is allowed during the grace period, but a hard limit blocks immediately. Both blocks (capacity) and inodes (number of files) can be limited.
| Command | Role |
|---|---|
lsmod | List loaded modules |
modprobe | Load a module including its dependencies |
insmod/rmmod | Load/remove a module (dependencies handled manually) |
modinfo | Module information |
sysctl | View and change kernel parameters |
insmod vs modprobe: insmod cannot handle dependent modules automatically, but modprobe resolves dependencies as well (the same pattern as the rpm:yum relationship). Persistent kernel parameters go in /etc/sysctl.conf.
System information command roundup: free (memory), uptime (uptime and load), vmstat (virtual memory statistics), iostat (I/O statistics), lscpu (CPU information). They are often asked together as a group for performance diagnosis.
Use the mock exam below for a final check.
export and passed down to child processes / a variable that stays only in the current shell.kill.yum, apt, and modprobe do. rpm, dpkg, and insmod lack it../configure (check the environment, generate the Makefile) → make (compile) → make install (install).Click a choice to reveal the answer and explanation.
Question 1
Which is the typical command with the SetUID bit set that lets a regular user change their own password?
Question 2
When the umask value is 022, what are the default permissions of a newly created regular file?
Question 3
Which special permission restricts each user to deleting only the files they created in a shared directory?
Question 4
Which signal cannot be ignored or blocked by the receiving process?
Question 5
Which RAID level requires at least 3 disks and uses one distributed parity?
Question 6
Which is the correct order of commands for creating a physical volume, a volume group, and a logical volume when setting up LVM?
Question 7
Which high-level tool installs an RPM package from a repository while resolving dependencies automatically?
Question 8
Which statement about the nice priority value is correct?
Question 9
Which is the correct order of the fields in /etc/fstab?
Question 10
Which statement about the difference between environment variables and shell variables is correct?