ssh -R 5000:localhost:5000 user@host-with-https # Did this from a raspberry pi at home that I wanted to control from Alexa, which requires recognized SSL cert. So Alexa connects to my website, then mod_rewrite redirects to the SSH reverse tunnel and connects to program on Pi.

ls ????????????????????* # Shell globbing doesn't have a quantifier expression such as {20}, but you can just use enough '?'s to indicate the quantity of characters you need to match. In this case, match files 20 characters or longer.

And before you say "Y2K wasn't a big deal". The reason it wasn't a big deal is because programmers worked hard for years prior to prepare. The 2038 bug will probably get less hype because it's not as obvious and could be more dangerous because it's meant for computer timekeeping.

date -d "+ 20 years"|| date -v +20y # Tomorrow at 01:37:04 UTC is the halfway point between Y2K and the Unix signed 32-bit epoch rollover on Jan 19th, 2038. Think it doesn't matter? Consider that Raspbian OS for Raspberry Pi's is still 32-bit.

mplayer 12??18????.mp4 # Play only videos from December 2018. My phone camera app has a weird date format (MMDDYYHHMM). Fortunately I can find videos I've synced to backup easily enough with globbing expressions. ? means match anything in that one place of the filename.

touch -r 1218181022.jpg 1218181022-mirrored.jpg # Change the timestamp on a file so that it matches that of a reference file.

And you may ask yourself, what does this cable go to?

exiftool -v0 -createddate-=5 DSCN{1222..1387}.JPG # Correct the created date in the exif tags of photos DSCN1222.JPG through DSCN1387.JPG because you took them in a different time zone. Unfortunately, the exif "standard" doesn't include timezone info. *groan*

ncdu -x # TUI program for showing directory usage stats. The -x option skips crossing filesystem boundaries. Great for finding were your precious space is being utilized.

Every dark cloud has a silver pronged power plug lying on the floor.

gzip -v9 -c /var/log/maillog > /root/maillog.gz # Out of space? Compress large log to other filesystem, then delete & move the old log back.

r=$((RANDOM%3072+1024));c=$(echo "obase=16;$r"|bc);display -size 300x300 -title '' xc:"#$c";read -p "Color? " g;printf "Color was $c, off by %s\n" $(bc<<<"obase=16;ibase=16;$g-$c") # Color Game. After color shows, press space and guess with a 3 digit HEX RGB value. ie. F3D

mtr # Check connectivity/latency to a network host. Kind of a real time ping/traceroute hybrid. Try the different display modes.

f=$(($RANDOM%5900+100));play -qn synth sin $f trim 0 0.75 vol .1;read -p "Hz(100-6000)? " g;printf "Hz=$f; Off by %d\n" $((f-g)) # Hz game.

printf "Is it really a line of text if there is no newline?" | wc -l # Metaphysical Unix

xargs < file.txt # This is an easy way to join a file into one line if you're in a hurry. Be careful with really long data though.

PS1=':$( [ $? == 0 ] && echo ") " || echo "( " )' # Emoticon prompt for BASH shows return status as emoticon.

Show more

Follow friends and discover new ones. Publish anything you want: links, pictures, text, video. This server is run by the main developers of the Mastodon project. Everyone is welcome as long as you follow our code of conduct!