Vikid's Bash Cookbook
Some Simple Stuff
bash --version ls -adFlLQrRS1 pwd -L, pwd -P type which, type -a which apropos zip => man -k, locate which find stat, file -b chsh -s /bin/bash passwd -el sudo cat /etc/shells
Common Shell Variables
$USER $- list all current option flags
Download a website
wget -r -np -k http://somesite.comOptions:
- -r (recursive)
- -np (don't follow links to parent directories)
- -k to make links in downloaded HTML or CSS point to local files
- -nd (no directories): download all files to the current directory
- -e robots.off: ignore robots.txt files, don't download robots.txt files
- -A png,jpg: accept only files with the extensions png or jpg
- -m (mirror): -r --timestamping --level inf --no-remove-listing
- -nc, --no-clobber: Skip download if files exist
Quoting
echo value is $3?! echo "value is $3?!" echo 'value is $3?!'!" is history substitution
Sources and Links
Builtin Commands
ls () { builtin ls "@" echo "using defined ls" }
Interactive
#!/usr/bin/env bash case "$-" in *i*) echo "interative" *) echo "not interactive" esac
http://thevikidtruth.com/wiki/?vikidsbashcookbook
04apr23 | admin |