category 10 / 10
Shell tricks
History, aliases, brace expansion, and shortcuts that save keystrokes.
005
entries
4 min
avg read
046Split a line into named variables without losing them to a subshellIFS=, read -r date region product units revenue <<< "$(sed -n 2p sales.csv)"; echo "$region $units"036Find out which stage of a pipeline actually failedgrep FATAL server.log | wc -l; echo "${PIPESTATUS[@]}"029Pull the filename, directory, or extension out of a path without basenamep=/var/log/nginx/access.log.2.gz; echo "${p##*/} ${p%/*} ${p%.*} ${p##*.}"015Compare the output of two commands without writing a temp filediff <(sort packages-web01.txt) <(sort packages-web02.txt)011Find out what a command actually is before you run ittype -a grep
showing 005 of 005