Information below is not for the current semester.
The current semester can be found here.
This is an advanced course. We have put together a list of commands we expect you to know and be able to use.
Read through the manpages to learn about each command and, where listed, its
options. Don’t read man pages top-to-bottom, that’s impossible. The goal is to
know what commands there are, not to know every single option they have. Learn
to search the man page (/ if the pager used is less).
Most of these commands (with obvious exceptions, such as rm or reboot) are
safe to just try—take advantage of that.
- You probably use most of these already, or at least you know they exist:
man,man -k- read
man manto learn about different sections of the manual and the$PAGERvariable PAGER=cat man ls- To reference a man page and section, you often use ls(1) in writing to
refer to the man page of ls in section 1 of the manual (
man 1 ls). - Multiple sections may contain the same page, cf
man 1p mkdirandman 3p mkdir. - The double-dash (
--) option terminator as implemented by many built-ins and commands - If you’re interested in a bit of history, check out Unix command line conventions over time (8 min reading)
- The
$POSIXLY_CORRECTenvironment variable set,set -euxenv,exportcommand -v(POSIX) vs.which,which -a- What is the difference between a command, a built-in (command) and an alias?
$?exitwhoami,id,/etc/passwd,/etc/group,/etc/shadow- Man pages exist for files and file formats too, see e.g. passwd(5)
cd,cd -pwd,$PWDpasswdchshsudo,sudo -E,sudo -u,sudo -i,sudo -shostnameuname -avs./etc/os-releaseprintf(POSIX) vs.echo [-n](many different implementations)read -r,$IFS- test
-eq,-gt,-ge, …=,!=-e,-f,-d-s-r,-w,-x- Understand
testvs[ ... ]vs[[ ... ]]
ls,ls -la,ls -latrtouchmkdirrm,rm -r,rm -f,-rf,rmdircat,cat -nlessteeln -s,ln -sfreadlink -frealpathfindwith the following predicates:-!\( ... \)-type-name-path-size-executable-exec ... \;
wc,wc -l,wc -chead,taildiff,diff -ucomm,comm -123cut -f,cut -dpaste,paste -d,paste -sbcgrep,grep -E,grep -F,grep -r,egrepandfgrep(deprecated)sed,sed -e CMD -e CMD ...awkreboot,poweroffxargs,xargs -I,xargs -nsort,sort -n,sort -runiq,uniq -cseqbase64,base64 -dhexdump,hexdump -Ctruncatesha256sum,sha512sum
- These may be new to you, but are nonetheless very useful:
ps,ps auxfpgrep,pgrep -f,pgrep -akill,kill -SIGNALpkill,pkill -SIGNAL,pkill -fhtop,top, iotopwatch,watch -nsleeppausetimedate,date -d @TIMESTAMP,date -udflsblk,blkiddu,du -h,du -sfree,free -h/proc/meminforeset
- Debugging:
strace,strace -f,strace -pgdb,gdb --argsdmesglsmod,modprobeobjdump
- Networking:
ip link(ip l),ip addr(ip a),ip route(ip r) etc.- Many of the following commands support
-4(force IPv4) and-6(force IPv6), that will be useful. pingtraceroute,mtrssh,ssh -pnc,nc -l,socatss,netstatiwtelnetcurldrill,dig,nslookup
- UNIX permissions will be of utter importance:
- What is the meaning of
rwxbits for files and directories respectively? chmodwith both symbolic and octal mode,chmod -R u+X .chown,chown -R
- What is the meaning of
- Make sure you understand basic concepts of the Unix shell. You don’t need to
understand the underlying mechanisms (although that cannot hurt), but you
must be able to use them:
- Writing shell scripts:
- What is the shebang/hashbang?
- What is the
#!/usr/bin/env ...idiom used for? - Which permissions are required for a script to be successfully executed?
- I/O redirection:
- What is stdin, stdout and stderr?
- What is a file descriptor and how is it related to stdin, stdout and stderr?
CMD <fCMD >f,CMD 2>f,CMD 2>&1,>f CMDCMD >>f- Order matters:
CMD >/dev/null 2>&1vsCMD 2>&1 >/dev/null
- Pipes:
grep /sbin/nologin /etc/passwd | cut -d: -f1- What is the exit code of a pipeline?
set -o pipefail(Bash, Zsh)
- Writing shell scripts: