Linux CLI — 60 questions
Play ▸- #1 · Which
ls option also lists files whose names start with a dot?
- #2 · What does the
-p flag do here? mkdir -p projects/web/assets
- #3 · What is
/opt/app/current after these commands? ln -s /opt/app/v2 /opt/app/current rm -rf /opt/app
- #4 · What does
cat b.txt print? echo original > a.txt ln a.txt b.txt rm a.txt cat
- #5 · What does the
z in -czf tell tar to do? tar -czf backup.tar.gz /etc
- #6 · Which files does this command list? find /var/log -type f -size +100M
- #7 · Who can execute
deploy.sh? -rwxr-x--- 1 alice dev 2048 Mar 3 10:12 deploy.sh
- #8 · What does
ls -l show for the file afterwards? chmod 644 notes.txt
- #9 · What are the permissions after the
chmod? $ ls -l report -rw-rw-rw- 1 bob staff 512 Jan 9 re
- #10 · What permissions does
new.txt get? umask 027 touch new.txt
- #11 · What does the
s in the owner execute slot mean? -rwsr-xr-x 1 root root 68208 /usr/bin/passwd
- #12 · What does the trailing
t enforce on /tmp? drwxrwxrwt 18 root root 4096 /tmp
- #13 · What does this print? printf 'a\nb\nc' | wc -l
- #14 · What does this print? printf 'a\nb\na\n' | uniq | wc -l
- #15 · What does this print? echo 'root:x:0:0:root:/root:/bin/bash' | cut -d: -
- #16 · What does this print? printf 'a,3\nb,5\nc,2\n' | awk -F, '{s+=$2} END {p
- #17 · What does this print? echo "cat cat cat" | sed 's/cat/dog/'
- #18 · What does this print? printf '10\n9\n100\n' | sort | head -1
- #19 · What does this print? echo hello | tr a-z A-Z
- #20 · What does this print? printf 'bob,30\nann,4\ncid,12\n' | sort -t, -k2 -n
- #21 · Where do the script's errors end up? ./build.sh > build.log 2>&1
- #22 · Where does the "No such file" error message go? ls nosuchfile 2>&1 > out.txt
- #23 · What does
>> do here? echo "deploy done" >> deploy.log
- #24 · Why use
-print0 with xargs -0 instead of a plain pipe? find . -name '*.bak' -print0 | xargs -0 rm
- #25 · How many lines does this print? seq 1 5 | xargs -n 2 echo
- #26 · What does
echo $? print in default bash? false | true echo $?
- #27 · Which signal does this send to PID 4312? kill -9 4312
- #28 · What does the
Z state mean for PID 2210? PID PPID STAT CMD 2210 1980 Z [worker] <defunct>
- #29 · Which command brings this job back to the foreground? $ sleep 300 & [1] 5521
- #30 · What does
nohup add here? nohup ./server.sh > server.log &
- #31 · What trend do these load averages show? top - 14:02:11 up 3 days, load average: 4.00, 2.50
- #32 · What effect does this have on the job? nice -n 10 ./reindex.sh
- #33 · Which file maps hostnames to IP addresses locally, before DNS is asked?
- #34 · What does the
-I flag make curl do? curl -I https://example.com
- #35 · What is this command typically used for? sudo lsof -i :8080
- #36 · What does this command set up? ssh -L 5433:localhost:5432 admin@db.example.com
- #37 · What does the trailing slash on
src/ change? rsync -a src/ backup/
- #38 · What does this command do? sudo apt update
- #39 · What does this command show? dpkg -L nginx
- #40 · How does
purge differ from remove? sudo apt purge nginx
- #41 · What effect does this have? sudo apt-mark hold linux-image-generic
- #42 · What is the usual cause of this error? E: Could not get lock /var/lib/dpkg/lock-frontend.
- #43 · Which package file format do Debian and Ubuntu use?
- #44 · How much free space is left on the root filesystem? Filesystem Size Used Avail Use% Mounted on /dev/sd
- #45 · Roughly how much memory can new programs still use? total used free shared buff/cache available Mem: 7
- #46 · What does this command do? sudo systemctl enable nginx
- #47 · What does this show? journalctl -u nginx -f
- #48 · When does this crontab entry run? 0 2 * * 1 /usr/local/bin/backup.sh
- #49 · When does this crontab entry run? */10 9-17 * * 1-5 /opt/check.sh
- #50 · What does this print? echo '$HOME'
- #51 · What does this print? # s.sh contains: echo $# bash s.sh a "b c" d
- #52 · When is
failed printed? make && make test || echo "failed"
- #53 · What does this print? echo f{1..3}
- #54 · What does this print? unset NAME echo "${NAME:-guest}"
- #55 · If
app.conf contains no line matching "timeout", what does echo $? print? grep timeout app.conf echo $?
- #56 · Which file holds the hashed user passwords on a modern Linux system?
- #57 · Why is this command risky compared with
usermod -aG docker alice? sudo usermod -G docker alice
- #58 · What does the last field mean for bob? bob:x:1001:1001:Bob:/home/bob:/usr/sbin/nologin
- #59 · What does this command do? sudo -u postgres psql
- #60 · What does this command show? id alice