Skip to content

Instantly share code, notes, and snippets.

@jawardell
Created January 24, 2019 23:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jawardell/d1aef2ccbbb90fa9818e239b1d9b2a18 to your computer and use it in GitHub Desktop.
Save jawardell/d1aef2ccbbb90fa9818e239b1d9b2a18 to your computer and use it in GitHub Desktop.
bash commands
#recursively format print all files using awk
ls -R | awk ' /:$/&&f{s=$0;f=0} /:$/&&!f{sub(/:$/,"");s=$0;f=1;next} NF&&f{ print s"/"$0 }'
#recursively show the size of files in MegaBytes
ls -Rl --block-size=M
#list files recursively along with their size in bytes
find . -type f -exec du -ab {} + | sort -n -r | less
#move executables to a folder called ./executables/
for f in *; do
if [ -f "$f" ] && [ -x "$f" ]; then
mv "$f" executables/
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment