- find all files with extension recursively and delete them
find . -name "*.png" -type f -delete
- make a directory multiple levels deep
mkdir -p currentdir/newdir/foo
- recursively search bash history
CTRL + r (tap r to cycle through history)
- go back to last working directory
cd -
- repeat previous command with sudo
sudo !!
- read latest entries on log files
tail -f logfile
- get size of directory contents
du -sh *
- kill process
ps -e | grep {package} // get the pid from this
kill {pid} // pid from previous command
- find and replace using sed
sed -i 's/oldstring/newstring/g' hello.txt
- search recursively for string and return line numbers of any occurrences
grep -rn string .
- add following to .zshrc or .bash_profile to return files whose name contains a string
f () { find . -name '*'"$@"'*' ; }