1. What is Linux?
An open-source operating system kernel, e.g., used in distributions like Ubuntu, CentOS.
2. What is a Linux distribution?
A complete OS built on the Linux kernel, e.g., Ubuntu, Debian, Fedora.
3. What is the difference between Linux and Unix?
Linux is Unix-like, open-source; Unix is proprietary, older.
4. What is the `ls` command used for?
Lists directory contents, e.g., `ls -l` for detailed listing.
5. What does the `cd` command do?
Changes directory, e.g., `cd /home/user` to navigate.
6. What is the `pwd` command?
Prints working directory, e.g., `pwd` outputs `/home/user`.
7. What does the `mkdir` command do?
Creates directories, e.g., `mkdir myfolder`.
8. What is the `rm` command used for?
Removes files or directories, e.g., `rm file.txt` or `rm -r dir`.
9. What does the `cp` command do?
Copies files or directories, e.g., `cp file.txt file_copy.txt`.
10. What is the `mv` command used for?
Moves or renames files, e.g., `mv file.txt /home/user/` or `mv file.txt newname.txt`.
11. What does the `touch` command do?
Creates empty files or updates timestamps, e.g., `touch file.txt`.
12. What is the `cat` command used for?
Displays file contents, e.g., `cat file.txt`.
13. What does the `more` command do?
Views file contents page by page, e.g., `more file.txt`.
14. What is the `less` command?
Views file contents with navigation, e.g., `less file.txt`.
15. What does the `head` command do?
Displays first lines of a file, e.g., `head -n 5 file.txt`.
16. What is the `tail` command used for?
Displays last lines of a file, e.g., `tail -n 5 file.txt`.
17. What does the `wc` command do?
Counts lines, words, characters, e.g., `wc file.txt` outputs `lines words chars`.
18. What is the `grep` command used for?
Searches text patterns, e.g., `grep \"error\" log.txt`.
19. What does the `find` command do?
Searches for files, e.g., `find / -name \"file.txt\"`.
20. What is the `locate` command?
Finds files using a database, e.g., `locate file.txt`.
21. What does the `which` command do?
Shows executable path, e.g., `which ls` outputs `/bin/ls`.
22. What is the `whoami` command?
Displays current user, e.g., `whoami` outputs `user`.
23. What does the `man` command do?
Shows manual pages, e.g., `man ls` for `ls` documentation.
24. What is the `echo` command used for?
Prints text, e.g., `echo \"Hello\"` outputs `Hello`.
25. What does the `env` command do?
Displays environment variables, e.g., `env` lists variables like `PATH`.
26. What is the `export` command?
Sets environment variables, e.g., `export MYVAR
27. What does the `uname` command do?
Shows system info, e.g., `uname -a` for kernel, OS details.
28. What is the `df` command used for?
Shows disk usage, e.g., `df -h` for human-readable output.
29. What does the `du` command do?
Shows directory size, e.g., `du -sh /home` for total size.
30. What is the `free` command?
Displays memory usage, e.g., `free -m` for megabytes.
31. What does the `top` command do?
Shows real-time processes, e.g., `top` displays CPU, memory usage.
32. What is the `htop` command?
Enhanced `top`, e.g., `htop` with interactive interface.
33. What does the `ps` command do?
Lists processes, e.g., `ps aux` for all processes.
34. What is the `kill` command used for?
Terminates processes, e.g., `kill 1234` to stop PID 1234.
35. What does the `chmod` command do?
Changes file permissions, e.g., `chmod 755 file.sh`.
36. What is the `chown` command?
Changes file ownership, e.g., `chown user file.txt`.
37. What does the `ln` command do?
Creates links, e.g., `ln -s source link` for symbolic link.
38. What is the `tar` command used for?
Archives files, e.g., `tar -cvf archive.tar dir/`.
39. What does the `gzip` command do?
Compresses files, e.g., `gzip file.txt` creates `file.txt.gz`.
40. What is the `gunzip` command?
Decompresses files, e.g., `gunzip file.txt.gz`.
41. What does the `zip` command do?
Creates zip archives, e.g., `zip archive.zip file.txt`.
42. What is the `unzip` command?
Extracts zip archives, e.g., `unzip archive.zip`.
43. What does the `cut` command do?
Extracts fields, e.g., `cut -d\',\' -f1 file.csv` for first column.
44. What is the `sort` command used for?
Sorts lines, e.g., `sort file.txt` for alphabetical order.
45. What does the `uniq` command do?
Removes duplicate lines, e.g., `uniq file.txt`.
46. What is the `awk` command used for?
Text processing, e.g., `awk \'{print $1}\' file.txt` for first column.
47. What does the `sed` command do?
Stream editor, e.g., `sed \'s/old/new/\' file.txt` replaces text.
48. What is the `tee` command?
Reads stdin, writes to file and stdout, e.g., `ls | tee output.txt`.
49. What does the `xargs` command do?
Builds commands from input, e.g., `find . -name \"*.txt\" | xargs rm`.
50. What is the `history` command?
Shows command history, e.g., `history` lists past commands.
51. What does the `!!` command do?
Repeats last command, e.g., `!!` re-runs previous command.
52. What is the `alias` command used for?
Creates shortcuts, e.g., `alias ll
53. What does the `unalias` command do?
Removes aliases, e.g., `unalias ll`.
54. What is the `clear` command?
Clears terminal screen, e.g., `clear`.
55. What does the `date` command do?
Shows system date/time, e.g., `date` outputs current time.
56. What is the `cal` command?
Displays calendar, e.g., `cal` shows current month.
57. What does the `uptime` command do?
Shows system uptime, e.g., `uptime` displays running time.
58. What is the `who` command?
Lists logged-in users, e.g., `who` shows user sessions.
59. What does the `w` command do?
Shows user activity, e.g., `w` lists users and processes.
60. What is the `passwd` command?
Changes user password, e.g., `passwd` prompts for new password.
61. What does the `su` command do?
Switches user, e.g., `su - user` for new shell as `user`.
62. What is the `sudo` command?
Runs command as another user, e.g., `sudo apt update`.
63. What does the `shutdown` command do?
Shuts down system, e.g., `shutdown now` or `shutdown -r` for reboot.
64. What is the `reboot` command?
Restarts system, e.g., `reboot`.
65. What does the `halt` command do?
Stops system, e.g., `halt` powers off.
66. What is the `init` command?
Changes runlevel, e.g., `init 0` for shutdown (older systems).
67. What does the `jobs` command do?
Lists background jobs, e.g., `jobs` shows running tasks.
68. What is the `bg` command?
Runs job in background, e.g., `bg %1` for job 1.
69. What does the `fg` command do?
Brings job to foreground, e.g., `fg %1` for job 1.
70. What is the `nohup` command?
Runs command immune to hangups, e.g., `nohup script.sh &`.
71. // File Systems and Permissions: What is the Linux file system?
A hierarchical structure, e.g., `/` (root), `/home`, `/etc`.
72. What is the `/etc` directory?
Stores configuration files, e.g., `/etc/passwd` for users.
73. What is the `/home` directory?
User home directories, e.g., `/home/user`.
74. What is the `/var` directory?
Variable data, e.g., `/var/log` for logs.
75. What is the `/tmp` directory?
Temporary files, e.g., `/tmp/file.txt`.
76. What is the `/bin` directory?
Essential binaries, e.g., `/bin/ls`.
77. What is the `/sbin` directory?
System binaries, e.g., `/sbin/shutdown`.
78. What is the `/usr` directory?
User programs, e.g., `/usr/bin`.
79. What is the `/proc` directory?
Virtual files for processes, e.g., `/proc/cpuinfo`.
80. What is the `/dev` directory?
Device files, e.g., `/dev/sda` for disk.
81. What is a file permission in Linux?
Controls access, e.g., `rwxr-xr-x` for read, write, execute.
82. What does `rwx` mean in permissions?
Read (`r`), write (`w`), execute (`x`), e.g., `rwx` for full access.
83. What is the numeric notation for permissions?
Octal, e.g., `755` for `rwxr-xr-x` (4
84. How do you change permissions with `chmod`?
Use octal or symbolic, e.g., `chmod 644 file.txt` or `chmod u+x file.sh`.
85. What is the `chown` command used for?
Changes owner, e.g., `chown user file.txt`.
86. How do you change group ownership?
Use `chown` or `chgrp`, e.g., `chown :group file.txt` or `chgrp group file.txt`.
87. What is a sticky bit?
Restricts deletion, e.g., `chmod +t /tmp` (only owner deletes).
88. What is the setuid bit?
Executes as owner, e.g., `chmod u+s file` for owner privileges.
89. What is the setgid bit?
Executes as group, e.g., `chmod g+s dir` for group inheritance.
90. What does the `umask` command do?
Sets default permissions, e.g., `umask 022` for `rwxr-xr-x`.
91. What is a hard link?
Multiple names for same inode, e.g., `ln file.txt link.txt`.
92. What is a symbolic link?
Points to another file, e.g., `ln -s file.txt link.txt`.
93. What is an inode in Linux?
Metadata for files, e.g., stores permissions, size, location.
94. How do you check inode usage?
Use `df -i`, e.g., `df -i /` for inode count.
95. What is the `fsck` command?
Checks file system, e.g., `fsck /dev/sda1`.
96. What does the `mount` command do?
Attaches file system, e.g., `mount /dev/sda1 /mnt`.
97. What is the `umount` command?
Detaches file system, e.g., `umount /mnt`.
98. What is `/etc/fstab`?
File system table, e.g., defines mount points.
99. What is a swap space?
Virtual memory, e.g., `swapon /swapfile`.
100. How do you create a swap file?
Use `dd`, `mkswap`, e.g., `dd if
101. What is the `blkid` command?
Shows device UUIDs, e.g., `blkid /dev/sda1`.
102. What does the `parted` command do?
Manages partitions, e.g., `parted /dev/sda`.
103. What is the `fdisk` command?
Partitions disks, e.g., `fdisk /dev/sda`.
104. What is the `mkfs` command?
Formats file system, e.g., `mkfs.ext4 /dev/sda1`.
105. What is an ext4 file system?
Standard Linux file system, e.g., supports journaling.
106. What is an XFS file system?
High-performance file system, e.g., for large files.
107. What is a Btrfs file system?
Advanced file system, e.g., supports snapshots.
108. What is a file system journal?
Logs changes, e.g., recovers after crashes.
109. What does the `lsblk` command do?
Lists block devices, e.g., `lsblk` shows disks, partitions.
110. What is the `lsof` command?
Lists open files, e.g., `lsof -p 1234` for PID 1234.
111. What does the `fuser` command do?
Identifies processes using files, e.g., `fuser /file.txt`.
112. What is the `/etc/mtab` file?
Lists mounted file systems, e.g., dynamic version of `/proc/mounts`.
113. What is a RAID in Linux?
Redundant disk array, e.g., `mdadm` for RAID setup.
114. What is LVM in Linux?
Logical Volume Manager, e.g., flexible disk management.
115. How do you create an LVM volume?
Use `pvcreate`, `vgcreate`, `lvcreate`, e.g., `pvcreate /dev/sda1; vgcreate vg0 /dev/sda1; lvcreate -L 10G vg0`.
116. What is a snapshot in LVM?
Point-in-time copy, e.g., `lvcreate -s -L 1G vg0/lvol0`.
117. What does the `resize2fs` command do?
Resizes ext file systems, e.g., `resize2fs /dev/vg0/lvol0`.
118. What is the `xfs_growfs` command?
Expands XFS file system, e.g., `xfs_growfs /mnt`.
119. What is a file system quota?
Limits disk usage, e.g., `quotaon -u /home`.
120. How do you set a user quota?
Use `edquota`, e.g., `edquota user` to set limits.
121. What is the `tune2fs` command?
Adjusts file system, e.g., `tune2fs -m 5 /dev/sda1` for reserved space.
122. What is the `e2fsck` command?
Checks ext file systems, e.g., `e2fsck /dev/sda1`.
123. What is the `badblocks` command?
Scans for bad blocks, e.g., `badblocks /dev/sda`.
124. What is a file descriptor?
Reference to open file, e.g., `0` (stdin), `1` (stdout).
125. What is `/dev/null`?
Discards output, e.g., `ls > /dev/null`.
126. What is `/dev/zero`?
Provides zeros, e.g., `dd if
127. What is `/dev/random`?
Generates random data, e.g., `cat /dev/random`.
128. What does the `sync` command do?
Flushes file system buffers, e.g., `sync`.
129. What is a file system mount option?
Controls behavior, e.g., `ro` for read-only in `/etc/fstab`.
130. What is the `chattr` command?
Sets file attributes, e.g., `chattr +i file.txt` for immutable.
131. What is the `lsattr` command?
Lists file attributes, e.g., `lsattr file.txt`.
132. What is a file system label?
Identifies partition, e.g., `e2label /dev/sda1 mylabel`.
133. What is the `findmnt` command?
Lists mounted file systems, e.g., `findmnt /`.
134. What is a bind mount?
Mounts directory elsewhere, e.g., `mount --bind /dir1 /dir2`.
135. What is the `stat` command?
Shows file metadata, e.g., `stat file.txt` for inode, size.
136. What is the `file` command?
Identifies file type, e.g., `file file.txt` outputs `ASCII text`.
137. What is a sparse file?
File with unallocated blocks, e.g., `truncate -s 1G file`.
138. What does the `truncate` command do?
Changes file size, e.g., `truncate -s 100M file`.
139. // Processes and Resource Management: What is a process in Linux?
A running program, e.g., identified by PID.
140. What is a PID?
Process ID, e.g., unique number like `1234`.
141. What is the `ps` command used for?
142. What does the `top` command show?
Real-time process stats, e.g., CPU, memory usage.
143. What is the `htop` command?
Interactive process viewer, e.g., `htop` with colors, navigation.
144. What does the `kill` command do?
Sends signals, e.g., `kill -9 1234` to terminate PID 1234.
145. What is a signal in Linux?
Process communication, e.g., `SIGTERM` (15) for graceful exit.
146. What is `SIGKILL`?
Signal 9, force-kills process, e.g., `kill -9 1234`.
147. What is `SIGTERM`?
Signal 15, requests termination, e.g., `kill 1234`.
148. What does the `killall` command do?
Terminates by name, e.g., `killall firefox`.
149. What is the `pkill` command?
Terminates by pattern, e.g., `pkill -u user`.
150. What does the `nice` command do?
Sets process priority, e.g., `nice -n 10 command`.
151. What is the `renice` command?
Changes running process priority, e.g., `renice 10 -p 1234`.
152. What is a process priority in Linux?
Determines CPU allocation, e.g., -20 (high) to 19 (low).
153. What does the `vmstat` command do?
Shows system stats, e.g., `vmstat 1` for memory, CPU.
154. What is the `iostat` command?
Reports I/O stats, e.g., `iostat -x` for disk usage.
155. What does the `sar` command do?
Collects system stats, e.g., `sar -u` for CPU usage.
156. What is the `uptime` command?
Shows system load, e.g., `uptime` for load averages.
157. What is a load average?
System workload, e.g., `0.5, 0.3, 0.2` for 1, 5, 15 minutes.
158. What does the `lscpu` command do?
Shows CPU info, e.g., `lscpu` for cores, architecture.
159. What is the `free` command?
Shows memory usage, e.g., `free -h` for human-readable.
160. What does the `pmap` command do?
Shows process memory, e.g., `pmap 1234`.
161. What is a zombie process?
Defunct process, e.g., waits for parent to read status.
162. How do you find zombie processes?
Use `ps`, e.g., `ps aux | grep Z`.
163. What is an orphan process?
Process without parent, e.g., adopted by `init` (PID 1).
164. What does the `strace` command do?
Traces system calls, e.g., `strace ls`.
165. What is the `ltrace` command?
Traces library calls, e.g., `ltrace ls`.
166. What does the `pidstat` command do?
Shows process stats, e.g., `pidstat -u` for CPU usage.
167. What is a daemon process?
Background service, e.g., `sshd` for SSH.
168. What does the `/proc` directory contain?
Process info, e.g., `/proc/1234/stat` for PID 1234.
169. What is the `ulimit` command?
Sets resource limits, e.g., `ulimit -n 1024` for open files.
170. What does the `chrt` command do?
Sets process scheduling, e.g., `chrt -r -p 20 1234`.
171. What is a real-time process?
High-priority, e.g., scheduled with `SCHED_RR` or `SCHED_FIFO`.
172. What does the `ionice` command do?
Sets I/O priority, e.g., `ionice -c3 command`.
173. What is a fork in Linux?
Creates child process, e.g., duplicates parent process.
174. What is a thread in Linux?
Lightweight process, e.g., shares memory with parent.
175. What does the `pstree` command do?
Shows process tree, e.g., `pstree -p` for PIDs.
176. What is the `at` command?
Schedules one-time tasks, e.g., `at now + 1 hour` to run command.
177. What does the `cron` command do?
Schedules recurring tasks, e.g., via `/etc/crontab`.
178. What is a cron job?
Scheduled task, e.g., `0 0 * * * backup.sh` runs daily at midnight.
179. How do you edit cron jobs?
Use `crontab -e`, e.g., edit user’s crontab.
180. What does the `anacron` command do?
Runs missed cron jobs, e.g., for systems not always on.
181. What is the `/etc/crontab` file?
System-wide cron schedule, e.g., defines tasks for users.
182. What does the `systemctl` command do?
Manages services, e.g., `systemctl start sshd`.
183. What is the `service` command?
Controls services, e.g., `service sshd restart`.
184. What does the `chkconfig` command do?
Manages service runlevels, e.g., `chkconfig sshd on` (older systems).
185. What is a runlevel in Linux?
System state, e.g., `3` for multi-user, `5` for GUI.
186. What does the `init` process do?
First process, e.g., PID 1, parent of all processes.
187. What is `systemd` in Linux?
Init system, e.g., manages services, logging.
188. What does the `journalctl` command do?
Shows system logs, e.g., `journalctl -u sshd`.
189. What is a core dump?
Process memory snapshot, e.g., after crash, in `/var/crash`.
190. How do you enable core dumps?
Set `ulimit`, e.g., `ulimit -c unlimited`.
191. What does the `gdb` command do?
Debugs programs, e.g., `gdb core` for core dump.
192. What is the `nice` value range?
-20 (highest) to 19 (lowest), e.g., `nice -n 10 command`.
193. What does the `watch` command do?
Runs command periodically, e.g., `watch -n 1 \'date\'`.
194. What is the `time` command?
Measures execution time, e.g., `time ls`.
195. What does the `lscpu` command show?
CPU details, e.g., `lscpu` for cores, threads.
196. What is the `numactl` command?
Controls NUMA policy, e.g., `numactl --membind
197. What is NUMA in Linux?
Non-Uniform Memory Access, e.g., optimizes memory for multi-core.
198. What does the `taskset` command do?
Sets CPU affinity, e.g., `taskset -p 0x1 1234` for CPU 0.
199. What is CPU affinity?
Assigns process to CPUs, e.g., improves performance.
200. What does the `perf` command do?
Profiles performance, e.g., `perf stat ls`.
201. What is the `sar` command used for?
System activity report, e.g., `sar -u` for CPU stats.
202. What does the `dstat` command do?
Real-time system stats, e.g., `dstat -cdngy`.
203. What is the `iotop` command?
Shows I/O usage, e.g., `iotop` for disk activity.
204. What does the `nmon` command do?
Monitors system resources, e.g., `nmon` for CPU, memory.
205. // Shell Scripting and Automation: What is a shell in Linux?
A command-line interface, e.g., Bash, Zsh.
206. What is Bash?
Bourne Again Shell, e.g., default shell in most Linux distros.
207. What is a shell script?
File with commands, e.g., `script.sh` with `#!/bin/bash`.
208. How do you make a script executable?
Use `chmod`, e.g., `chmod +x script.sh`.
209. What is the shebang line?
Specifies interpreter, e.g., `#!/bin/bash` at script start.
210. What is a variable in Bash?
Stores data, e.g., `MYVAR
211. How do you export a variable?
Use `export`, e.g., `export MYVAR
212. What is the `$?` variable?
Exit status, e.g., `echo $?` shows last command status.
213. What does `$0` represent?
Script name, e.g., `echo $0` outputs `script.sh`.
214. What are `$1`, `$2`, etc.?
Script arguments, e.g., `./script.sh arg1` sets `$1
215. What is the `$#` variable?
Number of arguments, e.g., `echo $#` for count.
216. What does `$$` represent?
Current PID, e.g., `echo $$` for script’s PID.
217. What is a conditional in Bash?
Tests condition, e.g., `if [ $VAR -eq 1 ]; then echo \"True\"; fi`.
218. What is the `test` command?
Evaluates conditions, e.g., `test -f file.txt` checks file existence.
219. What does `[ ]` do in Bash?
Shorthand for `test`, e.g., `[ -d dir ]` checks directory.
220. What is the `[[ ]]` construct?
Enhanced test, e.g., `[[ $VAR
221. What does the `if` statement do?
Conditional execution, e.g., `if [ $x -gt 0 ]; then echo \"Positive\"; fi`.
222. What is an `elif` clause?
Else-if condition, e.g., `elif [ $x -eq 0 ]; then echo \"Zero\"; fi`.
223. What does the `case` statement do?
Matches patterns, e.g., `case $VAR in 1) echo \"One\";; esac`.
224. What is a `for` loop in Bash?
Iterates over items, e.g., `for i in 1 2 3; do echo $i; done`.
225. What is a `while` loop?
Runs while condition true, e.g., `while [ $x -lt 5 ]; do echo $x; ((x++)); done`.
226. What is an `until` loop?
Runs until condition true, e.g., `until [ $x -gt 5 ]; do echo $x; ((x++)); done`.
227. What does the `break` statement do?
Exits loop, e.g., `break` in `for` loop.
228. What is the `continue` statement?
Skips iteration, e.g., `continue` in `while` loop.
229. What is a function in Bash?
Reusable code, e.g., `myfunc() { echo \"Hello\"; }`.
230. How do you call a Bash function?
Use name, e.g., `myfunc` to run `myfunc()`.
231. What is a local variable in a function?
Limited scope, e.g., `local var
232. What does `return` do in a function?
Sets exit status, e.g., `return 1` for failure.
233. What is command substitution?
Captures output, e.g., `VAR
234. What is process substitution?
Feeds output as file, e.g., `diff <(ls dir1) <(ls dir2)`.
235. What is a here document?
Redirects input, e.g., `cat <
236. What is a here string?
Redirects string, e.g., `wc -w <<< \"hello world\"`.
237. What does the `read` command do?
Reads input, e.g., `read VAR` for user input.
238. What is the `printf` command?
Formats output, e.g., `printf \'Name: %s\ \' \"John\"`.
239. What does the `eval` command do?
Executes string as command, e.g., `eval \"ls -l\"`.
240. What is a pipeline in Bash?
Chains commands, e.g., `ls | grep txt`.
241. What does `|` do in Bash?
Pipes output to next command, e.g., `ls | wc -l`.
242. What is `&&` in Bash?
Runs if previous succeeds, e.g., `cmd1 && cmd2`.
243. What is `||` in Bash?
Runs if previous fails, e.g., `cmd1 || cmd2`.
244. What does `&` do in Bash?
Runs in background, e.g., `cmd &`.
245. What is the `wait` command?
Waits for background jobs, e.g., `wait` for all jobs.
246. What does the `trap` command do?
Catches signals, e.g., `trap \'echo Exit\' EXIT`.
247. What is a subshell?
Child shell, e.g., `(cmd1; cmd2)`.
248. What does `source` command do?
Executes script in current shell, e.g., `source script.sh`.
249. What is the `.` command?
Alias for `source`, e.g., `. script.sh`.
250. What is a Bash array?
Stores multiple values, e.g., `arr
251. How do you iterate over a Bash array?
Use loop, e.g., `for i in \"${arr[@]}\"; do echo $i; done`.
252. What is parameter expansion?
Manipulates variables, e.g., `${VAR:-default}` for default value.
253. What does `${#VAR}` do?
Returns length, e.g., `VAR
254. What is `${VAR%pattern}`?
Removes shortest match from end, e.g., `${VAR%.txt}`.
255. What does `${VAR#pattern}` do?
Removes shortest match from start, e.g., `${VAR#prefix}`.
256. What is a regular expression in Bash?
Pattern matching, e.g., `[[ $VAR
257. What does the `shift` command do?
Shifts arguments, e.g., `shift` moves `$2` to `$1`.
258. What is the `getopts` command?
Parses options, e.g., `while getopts \"a:b\" opt; do ...; done`.
259. What is a Bash script debugging?
Uses `set -x`, e.g., `set -x` to trace commands.
260. What does `set -e` do?
Exits on error, e.g., `set -e` stops script on failure.
261. What is `set -u`?
Exits on unset variables, e.g., `set -u` prevents undefined use.
262. What does `set -o pipefail` do?
Fails pipeline if any command fails, e.g., `set -o pipefail`.
263. What is a cron job in scripting?
Schedules script, e.g., `0 * * * * /script.sh` runs hourly.
264. What is the `logger` command?
Logs to system, e.g., `logger \"Message\"`.
265. What does the `mktemp` command do?
Creates temp file, e.g., `mktemp /tmp/tmp.XXXXXX`.
266. What is a Bash script exit code?
Status, e.g., `exit 0` for success, `exit 1` for failure.
267. What does `basename` command do?
Strips directory, e.g., `basename /path/file.txt` outputs `file.txt`.
268. What is the `dirname` command?
Strips filename, e.g., `dirname /path/file.txt` outputs `/path`.
269. What does the `tee` command do in scripts?
Writes to file and stdout, e.g., `echo \"log\" | tee log.txt`.
270. What is the `timeout` command?
Limits command time, e.g., `timeout 10s sleep 20`.
271. What does the `parallel` command do?
Runs commands in parallel, e.g., `parallel echo ::: 1 2 3`.
272. What is a Bash script for loop with files?
Iterates files, e.g., `for f in *.txt; do cat $f; done`.
273. What is a Bash script to read a file?
Uses `while`, e.g., `while read line; do echo $line; done < file.txt`.
274. // Networking and Security: What is the `ifconfig` command?
Shows network interfaces, e.g., `ifconfig eth0` (older systems).
275. What does the `ip` command do?
Manages networking, e.g., `ip addr show` for interfaces.
276. What is the `netstat` command?
Shows network stats, e.g., `netstat -tuln` for listening ports.
277. What does the `ss` command do?
Modern `netstat`, e.g., `ss -tuln` for sockets.
278. What is the `ping` command?
Tests connectivity, e.g., `ping google.com`.
279. What does the `traceroute` command do?
Shows packet path, e.g., `traceroute google.com`.
280. What is the `dig` command?
Queries DNS, e.g., `dig example.com`.
281. What does the `nslookup` command do?
Resolves DNS, e.g., `nslookup example.com`.
282. What is the `curl` command?
Fetches URLs, e.g., `curl http://example.com`.
283. What does the `wget` command do?
Downloads files, e.g., `wget http://example.com/file`.
284. What is the `scp` command?
Copies files over SSH, e.g., `scp file.txt user@host:/path`.
285. What does the `rsync` command do?
Syncs files, e.g., `rsync -av source/ dest/`.
286. What is the `ssh` command?
Connects to remote host, e.g., `ssh user@host`.
287. What does the `ssh-keygen` command do?
Generates SSH keys, e.g., `ssh-keygen -t rsa`.
288. What is the `~/.ssh/authorized_keys` file?
Stores public keys, e.g., for passwordless SSH.
289. What does the `iptables` command do?
Configures firewall, e.g., `iptables -A INPUT -p tcp --dport 22 -j ACCEPT`.
290. What is the `ufw` command?
Simplifies firewall, e.g., `ufw allow 22`.
291. What does the `firewalld` command do?
Manages firewall, e.g., `firewall-cmd --add-port
292. What is the `nmap` command?
Scans network, e.g., `nmap localhost` for open ports.
293. What does the `tcpdump` command do?
Captures packets, e.g., `tcpdump -i eth0`.
294. What is the `wireshark` command?
GUI packet analyzer, e.g., `wireshark &`.
295. What does the `ethtool` command do?
Manages NICs, e.g., `ethtool eth0` for status.
296. What is the `/etc/hosts` file?
Maps hostnames to IPs, e.g., `127.0.0.1 localhost`.
297. What is the `/etc/resolv.conf` file?
Configures DNS, e.g., `nameserver 8.8.8.8`.
298. What does the `hostname` command do?
Shows or sets hostname, e.g., `hostname` or `hostname newname`.
299. What is the `/etc/hostname` file?
Stores system hostname, e.g., `echo myhost > /etc/hostname`.
300. What does the `route` command do?
Shows routing table, e.g., `route -n`.
301. What is the `ip route` command?
Manages routes, e.g., `ip route add default via 192.168.1.1`.
302. What does the `arp` command do?
Shows ARP table, e.g., `arp -n`.
303. What is the `nc` command?
Network tool, e.g., `nc -l 12345` to listen.
304. What does the `telnet` command do?
Tests connections, e.g., `telnet localhost 80`.
305. What is the `sftp` command?
Secure file transfer, e.g., `sftp user@host`.
306. What does the `openssl` command do?
Handles SSL/TLS, e.g., `openssl genrsa -out key.pem 2048`.
307. What is the `gpg` command?
Encrypts/signs files, e.g., `gpg -c file.txt`.
308. What does the `chroot` command do?
Changes root directory, e.g., `chroot /newroot`.
309. What is the `/etc/shadow` file?
Stores passwords, e.g., encrypted hashes for users.
310. What does the `pam` command do?
Manages authentication, e.g., configured in `/etc/pam.d`.
311. What is the `selinux` command?
Manages SELinux, e.g., `setenforce 0` to disable.
312. What does the `getenforce` command do?
Shows SELinux mode, e.g., `getenforce` outputs `Enforcing`.
313. What is the `semanage` command?
Manages SELinux policies, e.g., `semanage port -a -t http_port_t -p tcp 8080`.
314. What does the `auditd` command do?
Logs security events, e.g., `service auditd start`.
315. What is the `fail2ban` command?
Blocks brute-force, e.g., `fail2ban-client start`.
316. What does the `apparmor` command do?
Manages AppArmor profiles, e.g., `aa-status`.
317. What is the `nmap` command for security?
Scans for vulnerabilities, e.g., `nmap -sV host`.
318. What does the `chkrootkit` command do?
Checks for rootkits, e.g., `chkrootkit`.
319. What is the `rkhunter` command?
Scans for rootkits, e.g., `rkhunter --check`.
320. What does the `lynx` command do?
Text-based browser, e.g., `lynx http://example.com`.
321. What is the `whois` command?
Queries domain info, e.g., `whois example.com`.
322. What does the `ipset` command do?
Manages IP sets, e.g., `ipset create myset hash:ip`.
323. What is the `nft` command?
Manages nftables, e.g., `nft add rule ip filter input accept`.
324. What does the `ipvsadm` command do?
Manages IPVS, e.g., `ipvsadm -A -t 192.168.1.1:80`.
325. What is the `hping3` command?
Packet crafting, e.g., `hping3 -S host` for SYN scan.
326. What does the `mtr` command do?
Combines ping/traceroute, e.g., `mtr google.com`.
327. What is the `/etc/services` file?
Maps ports to services, e.g., `http 80/tcp`.
328. What does the `dnsmasq` command do?
Provides DNS/DHCP, e.g., `dnsmasq --no-daemon`.
329. What is the `openvpn` command?
Sets up VPN, e.g., `openvpn --config client.ovpn`.
330. What does the `iptraf` command do?
Monitors network traffic, e.g., `iptraf-ng`.
331. What is the `iftop` command?
Shows bandwidth usage, e.g., `iftop -i eth0`.
332. What does the `nethogs` command do?
Shows bandwidth by process, e.g., `nethogs eth0`.
333. What is the `vnstat` command?
Monitors network traffic, e.g., `vnstat -i eth0`.
334. // System Administration: What is a Linux user?
Account for access, e.g., defined in `/etc/passwd`.
335. What does the `useradd` command do?
Creates user, e.g., `useradd -m user`.
336. What is the `usermod` command?
Modifies user, e.g., `usermod -aG group user`.
337. What does the `userdel` command do?
Deletes user, e.g., `userdel -r user`.
338. What is the `/etc/passwd` file?
Stores user info, e.g., `username:uid:gid:home:shell`.
339. What does the `groupadd` command do?
Creates group, e.g., `groupadd mygroup`.
340. What is the `/etc/group` file?
Stores group info, e.g., `groupname:gid:users`.
341. What does the `id` command do?
Shows user/group IDs, e.g., `id user`.
342. What is the `sudoers` file?
Configures sudo, e.g., `/etc/sudoers` with `user ALL
343. What does the `visudo` command do?
Edits sudoers safely, e.g., `visudo`.
344. What is the `last` command?
Shows login history, e.g., `last`.
345. What does the `w` command do?
Shows logged-in users, e.g., `w`.
346. What is the `apt` command?
Manages packages (Debian), e.g., `apt install vim`.
347. What does the `yum` command do?
Manages packages (CentOS), e.g., `yum install vim`.
348. What is the `dnf` command?
Modern `yum`, e.g., `dnf install vim`.
349. What does the `rpm` command do?
Manages RPM packages, e.g., `rpm -ivh package.rpm`.
350. What is the `dpkg` command?
Manages Debian packages, e.g., `dpkg -i package.deb`.
351. What does the `snap` command do?
Manages snap packages, e.g., `snap install package`.
352. What is the `/etc/apt/sources.list` file?
Lists package repositories, e.g., `deb http://archive.ubuntu.com/ubuntu focal main`.
353. What does the `systemctl` command do?
Manages services, e.g., `systemctl enable sshd`.
354. What is the `journalctl` command?
Views systemd logs, e.g., `journalctl -u nginx`.
355. What does the `logrotate` command do?
Rotates logs, e.g., configured in `/etc/logrotate.conf`.
356. What is the `/var/log` directory?
Stores logs, e.g., `/var/log/syslog`.
357. What does the `dmesg` command do?
Shows kernel messages, e.g., `dmesg | grep error`.
358. What is the `crontab` command?
Manages cron jobs, e.g., `crontab -e` to edit.
359. What does the `at` command do?
Schedules tasks, e.g., `at now + 1 hour`.
360. What is the `anacron` command?
Runs missed cron jobs, e.g., configured in `/etc/anacrontab`.
361. What does the `locale` command do?
Shows locale settings, e.g., `locale` for language, encoding.
362. What is the `timedatectl` command?
Manages time, e.g., `timedatectl set-timezone UTC`.
363. What does the `ntpdate` command do?
Syncs time, e.g., `ntpdate pool.ntp.org`.
364. What is the `chronyd` command?
Time synchronization, e.g., `chronyd -q`.
365. What does the `hwclock` command do?
Manages hardware clock, e.g., `hwclock --systohc`.
366. What is the `/etc/sysctl.conf` file?
Kernel parameters, e.g., `net.ipv4.ip_forward
367. What does the `sysctl` command do?
Sets kernel parameters, e.g., `sysctl -w net.ipv4.ip_forward
368. What is the `ulimit` command?
Sets resource limits, e.g., `ulimit -u 1000` for processes.
369. What does the `dmidecode` command do?
Shows hardware info, e.g., `dmidecode -t bios`.
370. What is the `lsmod` command?
Lists kernel modules, e.g., `lsmod`.
371. What does the `modprobe` command do?
Loads modules, e.g., `modprobe vfat`.
372. What is the `insmod` command?
Inserts module, e.g., `insmod module.ko`.
373. What does the `rmmod` command do?
Removes module, e.g., `rmmod module`.
374. What is the `/etc/modules` file?
Lists modules to load, e.g., `vfat` on boot.
375. What does the `uname` command do?
Shows system info, e.g., `uname -r` for kernel version.
376. What is the `lscpu` command?
Shows CPU info, e.g., `lscpu` for cores.
377. What does the `lsblk` command do?
Lists block devices, e.g., `lsblk` for disks.
378. What is the `blkid` command?
379. What does the `partprobe` command do?
Updates partition table, e.g., `partprobe /dev/sda`.
380. What is the `mkinitcpio` command?
Generates initramfs, e.g., `mkinitcpio -P` (Arch Linux).
381. What does the `update-grub` command do?
Updates GRUB config, e.g., `update-grub`.
382. What is the `/etc/grub.cfg` file?
GRUB configuration, e.g., defines boot entries.
383. What does the `grub-install` command do?
Installs GRUB, e.g., `grub-install /dev/sda`.
384. What is the `lvm` command?
Manages LVM, e.g., `lvm pvcreate /dev/sda1`.
385. What does the `mdadm` command do?
Manages RAID, e.g., `mdadm --create /dev/md0`.
386. What is the `zfs` command?
Manages ZFS, e.g., `zfs create pool/data`.
387. What does the `btrfs` command do?
Manages Btrfs, e.g., `btrfs subvolume create /data`.
388. What is the `snapper` command?
Manages Btrfs snapshots, e.g., `snapper create`.
389. What does the `lsof` command do?
Lists open files, e.g., `lsof -i :80` for port 80.
390. What is the `fuser` command?
Identifies processes, e.g., `fuser -k 80/tcp`.
391. What does the `rsyslog` command do?
Manages logs, e.g., configured in `/etc/rsyslog.conf`.
392. What is the `auditctl` command?
Controls auditing, e.g., `auditctl -a exit,always -F arch
393. What does the `systemd-analyze` command do?
Analyzes boot, e.g., `systemd-analyze blame`.
394. What is the `hostnamectl` command?
Manages hostname, e.g., `hostnamectl set-hostname myhost`.
395. What does the `localectl` command do?
Manages locale, e.g., `localectl set-locale LANG
396. What is the `timedatectl` command?
Manages time, e.g., `timedatectl set-ntp true`.
397. What does the `loginctl` command do?
Manages sessions, e.g., `loginctl list-sessions`.
398. // Advanced Topics and Troubleshooting: What is the Linux kernel?
Core of OS, e.g., manages hardware, processes.
399. What does the `dmesg` command do?
Shows kernel logs, e.g., `dmesg | grep error`.
400. What is the `/proc` file system?
Virtual files for system info, e.g., `/proc/meminfo`.
401. What does the `sysfs` file system do?
Exposes kernel objects, e.g., `/sys/devices`.
402. What is the `udev` system?
Manages devices, e.g., creates `/dev` entries.
403. What does the `udevadm` command do?
Controls udev, e.g., `udevadm trigger`.
404. What is a kernel module?
Dynamic code, e.g., `vfat` for FAT file systems.
405. What does the `lsmod` command do?
Lists modules, e.g., `lsmod | grep vfat`.
406. What is the `modinfo` command?
Shows module info, e.g., `modinfo vfat`.
407. What does the `depmod` command do?
Updates module dependencies, e.g., `depmod`.
408. What is the `/etc/modprobe.d` directory?
Stores module configs, e.g., `blacklist nouveau`.
409. What does the `kexec` command do?
Boots new kernel, e.g., `kexec -l kernel`.
410. What is the `grub` bootloader?
Loads kernel, e.g., configured in `/etc/grub.cfg`.
411. What does the `initramfs` do?
Initial RAM file system, e.g., loads drivers at boot.
412. What is the `dracut` command?
Generates initramfs, e.g., `dracut -f`.
413. What does the `journalctl` command do?
Shows systemd logs, e.g., `journalctl --since yesterday`.
414. What is the `systemd` unit file?
Defines services, e.g., `/etc/systemd/system/myservice.service`.
415. What does the `systemd-escape` command do?
Escapes strings, e.g., `systemd-escape \"my unit\"`.
416. What is a container in Linux?
Isolated environment, e.g., Docker, Podman.
417. What does the `docker` command do?
Manages containers, e.g., `docker run ubuntu`.
418. What is the `podman` command?
Rootless containers, e.g., `podman run ubuntu`.
419. What does the `lxc` command do?
Manages LXC containers, e.g., `lxc-create -n mycontainer`.
420. What is a namespace in Linux?
Isolates resources, e.g., PID, network namespaces.
421. What does the `unshare` command do?
Runs in new namespace, e.g., `unshare --net bash`.
422. What is a cgroup in Linux?
Controls resources, e.g., CPU, memory limits.
423. What does the `cgcreate` command do?
Creates cgroup, e.g., `cgcreate -g cpu:mygroup`.
424. What is the `systemd-cgtop` command?
Shows cgroup usage, e.g., `systemd-cgtop`.
425. What does the `perf` command do?
Profiles performance, e.g., `perf record sleep 1`.
426. What is the `strace` command?
Traces system calls, e.g., `strace -o trace.txt ls`.
427. What does the `ltrace` command do?
428. What is the `gdb` command?
Debugs programs, e.g., `gdb ./program`.
429. What does the `valgrind` command do?
Detects memory issues, e.g., `valgrind ./program`.
430. What is the `sar` command?
System activity report, e.g., `sar -r` for memory.
431. What does the `iotop` command do?
Shows I/O usage, e.g., `iotop -o`.
432. What is the `nmon` command?
Monitors resources, e.g., `nmon`.
433. What does the `htop` command do?
Interactive process viewer, e.g., `htop`.
434. What is the `glances` command?
System monitor, e.g., `glances`.
435. What does the `tcpdump` command do?
Captures packets, e.g., `tcpdump -i eth0 port 80`.
436. What is the `iptraf` command?
Monitors traffic, e.g., `iptraf-ng`.
437. What does the `nload` command do?
Shows network usage, e.g., `nload eth0`.
438. What is the `bmon` command?
Bandwidth monitor, e.g., `bmon`.
439. What does the `stress` command do?
Tests system load, e.g., `stress --cpu 4`.
440. What is the `sysdig` command?
System troubleshooting, e.g., `sysdig -c topprocs_cpu`.
441. What does the `dtrace` command do?
Dynamic tracing, e.g., `dtrace -n \'syscall:::entry\'`.
442. What is the `bpftrace` command?
BPF-based tracing, e.g., `bpftrace -e \'kprobe:do_sys_open { printf(\"%s\ \", comm); }\'`.
443. What does the `ftrace` framework do?
Traces kernel, e.g., via `/sys/kernel/debug/tracing`.
444. What is the `lsof` command for troubleshooting?
Lists open files, e.g., `lsof -i :80`.
445. What does the `netstat` command do for troubleshooting?
Shows connections, e.g., `netstat -tulnp`.
446. What is the `ss` command for troubleshooting?
Shows sockets, e.g., `ss -tuln`.
447. What does the `vmstat` command do for troubleshooting?
Shows system stats, e.g., `vmstat 1`.
448. What is the `iostat` command for troubleshooting?
Shows I/O stats, e.g., `iostat -x 1`.
449. What does the `top` command do for troubleshooting?
Monitors processes, e.g., `top` for CPU hogs.
450. What is the `dmesg` command for troubleshooting?
Shows kernel errors, e.g., `dmesg | tail`.
451. What does the `journalctl` command do for troubleshooting?
Shows logs, e.g., `journalctl -p 3` for errors.
452. What is the `logrotate` command for troubleshooting?
Manages logs, e.g., `logrotate -f /etc/logrotate.conf`.
453. What does the `fsck` command do for troubleshooting?
Fixes file system, e.g., `fsck /dev/sda1`.
454. What is the `badblocks` command for troubleshooting?
Checks disk, e.g., `badblocks -v /dev/sda`.
455. What does the `smartctl` command do?
Checks disk health, e.g., `smartctl -a /dev/sda`.
456. What is the `memtest86` tool?
Tests RAM, e.g., run from boot menu.
457. What does the `lscpu` command do for troubleshooting?
Shows CPU issues, e.g., `lscpu` for core count.
458. What is the `dmidecode` command for troubleshooting?
Shows hardware, e.g., `dmidecode -t memory`.
459. What does the `lspci` command do?
Lists PCI devices, e.g., `lspci` for GPUs, NICs.
460. What is the `lsusb` command?
Lists USB devices, e.g., `lsusb`.
461. What does the `lshw` command do?
Shows hardware, e.g., `lshw -C disk`.
462. What is the `blktrace` command?
Traces block I/O, e.g., `blktrace -d /dev/sda`.
463. What does the `iotop` command do for troubleshooting?
Shows I/O bottlenecks, e.g., `iotop -o`.
464. What is the `sar` command for troubleshooting?
Analyzes performance, e.g., `sar -u 1`.
465. What does the `free` command do for troubleshooting?
Shows memory issues, e.g., `free -m`.
466. What is the `uptime` command for troubleshooting?
Shows load, e.g., `uptime` for high load averages.
467. What does the `watch` command do for troubleshooting?
Monitors output, e.g., `watch -n 1 \'cat /proc/meminfo\'`.
468. What is the `time` command for troubleshooting?
Measures performance, e.g., `time myscript.sh`.
469. What does the `strace` command do for troubleshooting?
Debugs system calls, e.g., `strace -p 1234`.
470. What is the `ltrace` command for troubleshooting?
Debugs library calls, e.g., `ltrace -p 1234`.
471. What does the `gdb` command do for troubleshooting?
Debugs crashes, e.g., `gdb --pid 1234`.
472. What is the `valgrind` command for troubleshooting?
Finds memory leaks, e.g., `valgrind --leak-check
473. What does the `systemd-analyze` command do?
Analyzes boot, e.g., `systemd-analyze critical-chain`.
Share this protal to share friends and complete unlimited tests here. You can also make friends on our protal also start mutual competition tests with your firends easily.