When you accidentally cat a binary file.
Command Line Magic
@climagic
Cool Unix/Linux Command Line tricks you can use in $TWITTER_CHAR_LIMIT characters or less. Here mostly to inspire. Also on mastodon.social/@climagic
Command Line Magic’s posts
Spectacular motherboard cake my daughter made for me. It uses buttercream frosting so it's also vulnerable to meltdown. 101010!!
echo "Is this real life?" | cowsay -n | cowsay -n | cowsay -n | cowsay -n
0:15
telnet mapscii.me # For maps in your terminal from OpenStreetMap. Yes really.
inotifywait -e open art.jpg && s=$(stat -c %s art.jpg );h=$(($s/2));r=$((s-h)); dd if=/dev/urandom | grep -a -o -P "[\x01-\xD0]" | tr -d $'\n' | dd of=art.jpg bs=1 seek=$h count=$r # Digitally "shred" half a file after it is opened. #Banksy
socat -d -d TCP-L:22,reuseaddr,fork SYSTEM:"nc \$SOCAT_PEERADDR 22" # Confuse people SSHing to your host with a redirect back to theirs.
I had an epiphany yesterday. I think I now know why the parent directory in Unix is represented by two dots.
They started using Linux at the fortune cookie factory because they heard they could save a fortune.
telnet mapscii.me # For maps in your terminal from OpenStreetMap. Use arrow keys to move around and a/z to zoom in/out. Or use your mouse if your terminal supports that.
37, the age at which Grace Hopper joined the Navy, learned logic and later invented the compiler. Its never too late to start.
I like to put sine waves in my log files because that's how I roll. 😎
awk -v cols=$(tput cols) '{c=int(sin(NR/10)*(cols/6)+(cols/6))+1;print(substr($0,1,c-1) "\x1b[41m" substr($0,c,1) "\x1b[0m" substr($0,c+1,length($0)-c+2))}' access_log | less -SR
read image description
ALT
curl wttr.in # Get local weather forecast in your terminal
curl v2.wttr.in # Get local daily graph of temp/precipitation in your terminal
Made by
Thx for the heads up
Old Ma Bell Unix, vi and C quick reference guides. And yes, it shows how to quit vi on the 2nd page. #Unix50
In vim, pressing % while the cursor is over a {, ( or [ will jump your cursor to the matching ], ), or } and vice versa.
GIF
Print an access_log with indicator chart bars under each request line to show the size of the data transfer using log() to keep things "in control".
awk -v cols=$(tput cols) '{e=int(log($10)*5); print("\x1b[42m" substr($0, 1, e) "\x1b[0m" substr($0, e+1) )}' access_log | less -SR
read image description
ALT
Replying to
If you cat /dev/urandom forever it eventually outputs a secure version of wordpress.
saveurl() { cat > /dev/null; } # Save a url for reading later when you "have time".
Dear university computer science/informatics/infosec programs of the world, stop letting students graduate without command line experience. We still need that experience.
PROMPT_COMMAND='[ $? -eq 0 ] || printf "(╯°□°)╯︵ ┻━┻\n"' # You can set this in your bash shell config to flip a table whenever a command fails with a non-zero exit status.
for i in {128512..128591} {128640..128725} ; do printf "\U$(echo "ibase=10;obase=16;$i;" | bc) " ; done ; echo # Your terminal in Linux may now support color emoji in case you didn't notice. 😵🙈
read image description
ALT
vim scp://user@server1//etc/httpd/httpd.conf # Edit a file on a remote server using vim from your local *nix desktop
p=3.14;for i in $( seq 0 0.04 100 );do r=$( printf "128+127*s($i)\n" |bc -l |cut -d. -f1) g=$( printf "128+127*s($i+$p*(1/3))\n" |bc -l |cut -d. -f1 ) b=$( printf "128+127*s($i+$p*(2/3))\n" |bc -l |cut -d. -f1 ); printf "\e[48;2;$r;$g;${b}m\n"; done # Sunrise in a 24-bit terminal
0:15
curl -s http://artscene.textfiles\.com/vt100/globe.vt | pv -L9600 -q # Spinning ASCII art globe. Visit the parent directory in that URL for more animations.
0:03
777 are great numbers in Vegas, but horrible numbers on your files and directories.
Her: The terminal is so plain and boring.
Me: top | lolcat
read image description
ALT
GIF
read image description
ALT
Please tell me that someone has shown this image at a Landscape Architecture conference because I've seen in many times at tech conferences.
"Where did you acquire your knowledge of the Unix? A magical fountain?"
"No, it's simple. I read the documentation and practice regularly."
Brian Kernighan just submitted code to add Unicode support to awk. Thank you! 🎉 😃 🙌 🧙
xclip -out -selection clipboard | qrencode -o - -t UTF8 # Display clipboard content as a QR-code using Unicode characters. Thanks
A programmer was sentenced to 255 days in jail. He asked the judge if he could make it 256 days instead. The judge granted his request and the programmer walked free the next day.
Option Mnemonics: tar xzvf = Xtract Ze Vucking Files [said in thick German accent]
{ bmon || iptraf || iftop || nettop; } # Try out one of these fine TUI programs for monitoring your network traffic from the command line. nettop is available by default on Mac. #MondayMonitoring Image credit: (bmon) by Tecmint.com
GIF
I think wttr.in by wins the award for the best use of *blink* ever.
BTW, how to make a 2 frame animated gif using Imagemagick
convert -loop 0 -delay 70 1.png 2.png thunderstorm.gif
GIF
"Google Now Bans Some Linux Web Browsers From Their Services"
I think we should ban Google from using Linux now. Let's see how they feel about that.
Right now I'm logged into a server with a massive 4 petabyte filesystem within the Scholarly Data Archive at . I think the whole service has 42PB total storage. Someday this tweet may not be impressive, but not today! :D
What new commands did you learn about in 2017? It's ok if ls or cd are some of them. Welcome.
convert inputmemeimage.png -font impact -fill white -pointsize 84 -stroke black -strokewidth 3 -gravity north -annotate +0+20 'TOP MEME TEXT' -gravity south -annotate +0+20 'BOTTOM MEME TEXT' outputmemeimage.png # Make your own meme image using Imagemagick.
github.com/mps-youtube/mp # mps-youtube is a TUI interface for Youtube, giving you console access to many of YT's common features, except advertising.
*Daughter attends a cybersecurity camp*
Me: So what did you learn today at camp?
Her: Some people pronounce sudo su-due
Famous moments in shutdown history: When I forgot to use -r when logged in remotely on an isolated system 13,370 km away.
jp2a Photo.jpg | tee photo.ascii # Convert a photo into an ASCII art representation directly into the terminal and save it to photo.ascii at the same time.
curl -r 28705-29696 -s http://artscene.textfiles\.com/vt100/globe.vt | sed -r '/^\e\[H /q' | GREP_COLORS="ms=01;32" egrep --color=always "[^ ]+" | GREP_COLORS="ms=01;44" grep -P --color=always -e "(?<=[^\ ])\ +" # Only take what you need. Happy #EarthDay!
read image description
ALT
Happy #SysAdminDay. The problems that often come up after 4pm today will be ignored. Say hi to devops for me and have a nice weekend all.
Whoops, I forgot to create my dynamic tunnel on this SSH session. No problem, just press [enter] in the ssh session, then literally ~C to open the SSH options prompt (ssh>). You can then specify your tunnel option of -D 8022 or whatever and it will create it.
sshfs user@remotehost:/remotedir localdir # sshfs is a util that uses FUSE and SSH to mount a remote directory as a local one. Saves the hassle of having to login to a remote system or copying files back and forth.
Downloading/installing Open Source Software:
Run "$[packagemanager] install $[package]"
Downloading "Mainstream" (such as Windows) software:
Read fluffy article, looking for link.
Click link (ad)
Click back
Click link (ad)
Click back
Click link
Wait for download
Delete malware
A trillion dollar company can't support a free audio format.
(OGG is not supported in Safari)
GIF
Son, now that you're 6, it's time I taught you about SSH. This is how you ssh into the computer upstairs and play a loud sound on it to scare your sister.
Linux for Monkeys. Look how far we've evolved.
read image description
ALT
read image description
ALT
Happy 60th Birthday to Mark Adler (), who co-wrote gzip, zip and the zlib library, contributed to PNG development and has had significant roles in planetary exploration missions while at JPL and has an extremely out of date website. ;)
If you don't want to feel old, stop reading now.
1TB hard drives are now over a decade old.
Yes, right now something related to terminals and the command line is trending globally. Sure, it's Windows Terminal, but who cares. This just proves that the command line is here to stay because people find the CLI useful. It's not "old school", it's alternative.
For the next time this comes up.
IRC:
1. Free
2. Open
3. Extensible
4. Software on every platform.
5. Still there after 29 years.
Ex: weechat ircs://irc.freenode.org/climagic
Remember that certificate you created 10 years ago with a 10 year expiration time thinking you wouldn't need to worry about it expiring in 10 years because it'd be way past the system's lifetime? Well....
montage -font FreeSans-Bold -strokewidth 3 -stroke black -fill white -pointsize 80 -gravity south \( 1.jpg -annotate 0 LINKEDIN \) \( 2.jpg -annotate 0 FACEBOOK \) \( 3.jpg -annotate 0 INSTAGRAM \) \( 4.jpg -annotate 0 TINDER \) -tile 2x2 -mode Concatenate dc.jpg #DollyChallenge
TIL: vim can directly work with zip file contents, viewing the files inside, and even editing them in place then re-compressing it when you're done.
0:26
It all started for me 20 years ago. 6 months later I finally got X working.
socat -d -d TCP-L:22,reuseaddr,fork SYSTEM:"nc \$SOCAT_PEERADDR 22" # Confuse people SSHing to your host with a redirect back to theirs.
Happy 25th Birthday Linux!!
The Linux kernel was first released on September 17th, 1991.
It's faster, fresher, and easier to pull up termux on the phone and run curl wttr.in to check the weather than it is to use the slow, overly bloated, spammy, and confusing weather apps.
git log --author=$USER --format="- %B" --since=-7days --reverse |mail -s "What I've done this week" boss@company\.com # Send a commit report to your boss
cd ~/Pictures && mkdir blurrybackgrounds && for i in *.jpg *.JPG *.png *.PNG ; do out=$(uuidgen).jpg ; convert -quality 75 "$i" -strip -auto-orient -resize 4x4 -resize 1920x1080\! "blurrybackgrounds/${out}" ; done # Use your photos and images to make nebulous backgrounds.
Did you know: Brian J. Fox's (creator of bash) grandfather Dan Fox, created the Monopoly® Man character. Now the $ prompt makes more sense.
Lonely is the user who searches the Internet for an error message and only finds the source code that generates it.
Happy 30th Birthday /bin/bash! Thanks to its developers Brian Fox and Chet Ramey and all those who have contributed to it.
sudo !!! # Get root access, even if you're not authorized. This is a special undocumented "feature" of sudo.
The command line is the jazz of the programming world; Once you learn the scales and have the feels, you can live-improvise a solution to nearly any problem. Not everyone likes jazz, but not everyone likes sonotas either.
ssh-copy-id 'user@remotehost' # Automatically installs your public key to the remote host (this is included in the openssh package)
Alright girls and boys, I know that it's also your job and stuff. But be honest, you use the command line because it's fun don't you?
clear ; for t in "Wake up" "The Matrix has you" "Follow the white rabbit" "Knock, knock";do clear;pv -qL10 <<<$'\e[2J'$'\e[32m'$t$'\e[37m';sleep 5;done
37, the age at which Grace Hopper joined the Navy, learned logic and later invented the compiler. You're never too old to define yourself.
My dad doesn't seem to be aware that he keeps telling me the same UDP joke over and over again.
Running out of space on that 1TB drive? On Linux, the ext[234] filesystems reserve 5% of the space by default to only used by the root user, that's 50GB! You can reduce it to 2% with the following command (Replace sda1 with whatever):
sudo tune2fs -m2 /dev/sda1
Checking the weather in Baltimore to check if it's gonna freeze tonight.
curl -s wttr.in/Baltimore,MD
Dear world,
I just showed a bunch of 13 year olds how to use ssh.
You're welcome,
--
Our parents made machines that took people to the moon. We created programs that make it look like we are vomiting rainbows.
If you haven't heard, there is a new shell on the block ${DEVICE}
nushell.sh
read image description
ALT
