Skip to content

Instantly share code, notes, and snippets.

@JanneSalokoski
Last active May 9, 2016 05:06
Show Gist options
  • Save JanneSalokoski/dfa9e146cb363a2c0b39 to your computer and use it in GitHub Desktop.
Save JanneSalokoski/dfa9e146cb363a2c0b39 to your computer and use it in GitHub Desktop.
# This is a list of bash commands I've found useful, but hard to remember.
# Get the temperature of the graphics card.
# Note: Only works for ATI/AMD cards.
sensors | grep radeon -A 2 | grep temp | sed 's:[^+]*\(\S*\).*$:\1:'
# Show the progress of a dd process.
dd --status=progress
# or
watch -n 10 kill -USR1 $(pgrep -l '^dd$' | sed 's: dd::')
# Convert all files in current directory and subdirectories into utf-8 from windows-1252
convmv -f WINDOWS-1252 -t UTF-8 . -r --notest
# Convert all .svg files in the current directory into .png, and autocrop any white borders away.
find . -name "*.svg" | while read line; do convert "$line" "${line%.svg}.png"; done
find . -name "*.png" | while read line; do convert -trim "$line" "$line"; done
# Scan (recursively) through the working directory and replace any 'ä' or 'ö' characters with 'a' and 'o' respectively.
# Warning: you need to first manually rename any directories.
for name in $(find . -type f -name "*.png"); do newname="$(sed 's:ä:a:g;s:ö:o:g' <<< $name)"; mv $name $newname; done
# Move into the last modified child-directory in parent.
cd $(ls -c | head -n 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment