Skip to content

Instantly share code, notes, and snippets.

@cdeath
Last active October 26, 2020 12:27
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 cdeath/03645649bf94cae5fcc1e256a51ce041 to your computer and use it in GitHub Desktop.
Save cdeath/03645649bf94cae5fcc1e256a51ce041 to your computer and use it in GitHub Desktop.
bashing

Command line stuff

find (and optionally delete) files or folders

mdfind ''
find . -name ''
find . -iname ''
find . -name '' -type f -delete
find . -name '' -type d -delete

disk usage sorted by size descending

du -sh * | sort -hr
du -hd {depth} * | sort -hr

output parts of stuff

| awk '{print $1}`

count chars

| wc -c

truncate string

| cut -c1-{range}

remove line breaks

| tr -d '\n'

replace placeholder with filename

for i in `ls -1 `; do echo $i; sed -i "" "s/_filename_/${i}/g" $i; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment