a set of unix shell commands
- Scripting Shell scripting
- Loops Looping statements
- Conditional Conditional statements
- Basic Basic shell commands
- HTTP Commands for working with HTTP
- Git Git commands
- Misc Other things
- Do not do Forkbomb and other things
for i in $(ls); do echo $i; done
df -h # shows total disk space
du <file|dir> -h # show file/directory size
du . --apparent-size # real size on filesystem (rather then disk usage)
du . -h # human readable
du . -hc # show total
du . -hc --exclude="/mnt" # exclude dir
du . -hcx # x excludes other drives (via symlink, mount, ...)
du . -hc --max-depth=1 # tree depth
du . -hc -d=1 | sort -hr # sort result (-d shortcut for max-depth)
install tree
tree . -L 2 # level
tree . -L 2 -a # print dotfiles
tree . -L 2 -a -I ".git|node_modules" # ignore files pattern
tree . -L 2 -a -P "*.js|*.json" # only files with pattern
tree . -L 2 --du -hs # humanreadable file sizes
tree . -L 2 --dirsfirst # directories first
find . -type f # lists files
find . -type d # lists directories
# finds all jpg, but not png
find images/ -type f -name *.jpg -not -name *.png
# finds *.jpg and deletes each file
find images -type f -name *.jpg -delete
# finds *.jpg and executes a command in cwd, {} is the placeholder for the filename
find images/ -type f -name *.jpg -exec echo Hello_{} \;
# excutes command in the directory
find images/ -type f -name *.jpg -execdir zip archive_{}.zip {} \;
# replaces HOST with localhost in specified file
sed -i s/HOST/localhost/g <file>
install wput