An amazing thing happened today. I posted a digest of replies from @tlakomy's tweet on favorite lesser known terminal utility/commands, and everyone poured in. I tried to collect as many as I could, and I thought I got most of them. Then more people piled on to the heap afterward. So here are my favorites.
WARNING: don’t run random commands from the internet in your terminal before making sure it does what you think it does. You can use the man
command or explainshell.com to learn a little bit first before you endanger your system. There were were a few trolls who thought it would be cute to post running rm -rf
IN ROOT. Don't do that. Be especially wary of anything that starts with sudo
.
Anyway, here we go...again.
There's git and then there's tig
@ryan_c_harris offers up his experience with tig
.
Sure! It allows you to not only see the log, but the actual diff for each commit, which is super useful. It also has a visual representation of your branches like
— ryan.harris (@ryancharris) May 2, 2020gitk
or a git GUI 🙌
So you thought getting out of vim was hard try tmux
Seriously though I need to use tmux
more. It makes other terminal tools look like a joke. Give it a shot. Just don't say I didn't warn you about exiting it. I'm pretty sure it's CTRL-j and then d. Thanks @vicentebosch!
tmux - terminal multiplexer. You have sessions, dettach and reattach to them. Logging into a machine, attaching to a session and have everything as you usually need to do the work on that machine is awesome.
— Vicent (@vicentebosch) May 2, 2020
toilet heh heh
You'd think having kids I'd be tired of potty talk. Well I'm not. Anyway, I had to install this utility suggested by @ali_bala, but I could see its use case.
sorry this one didn't render May 2, 2020
-
isn't just for cd
git checkout -
is a thing too. Thanks to @Houndsto0th for this tip.
For git commands I’ve aliased “git checkout -“ to git- and it checks out the previous branch. Makes hopping back to master to pull changes down and merge them into a branch a little more convienent
— Mechanical Koi (@Houndsto0th) May 2, 2020
sudo !!
I really wish I could remember this one. I've been told this too many times, and I keep forgetting it. It reruns your last command, and you can prefix it with sudo
for those times you forget to do that the first time. Kudos to @antoniwan and @AndyMardell for sharing.
!!
— Antonio Rodriguez (@antoniwan) May 2, 2020
fuck
Obligatory be careful with scripts from others, but I couldn't not share this one. This utility takes a guess at what you really meant. Thanks @Mikkel250, for killing my 1 post streak of being family friendly...
Tons of great tips here!
— Mikkel Ridley (@Mikkel250) May 2, 2020
This isn't a command but a utility in kind of the same spirit. It guesses intended previous commands by typing in "fuck" to the console.
It's awesome.https://t.co/IU2ki5nuyc
pbcopy and jelly in my belly
Can you tell I'm a dad by now? Anyway @maciejwalkowiak shares this gem. It's a slick way to get stuff into your clipboard. @sudip_post shares the linux equivalent.
pwd | pbcopy
— Maciej Walkowiak 🍃 (@maciejwalkowiak) May 2, 2020
Copies current directory path to clipboard. Works only on 🍏 but there is an equivalent for Linux afair
The cow says moo
@BerzelBest shared this one. I'm not surprised this exists.
fortune | cowsay
— Berzel Best (@BerzelBest) May 2, 2020
Even created a tiny bash script for it #fotune-cow#linux #webdevelopers #100DaysOfCode #CodeNewbie pic.twitter.com/ZOO7FJ3exJ
oh man
I'm surprised that this didn't show up sooner, and I should have pointed it out myself. Use man
to learn about the commands. Good call out @DocBohn
man
— Chris Bohn (@DocBohn) May 2, 2020
It tells me how to use the other terminal commands.
If you want to know how to use man:
man man
make vim talk hex
Where were you @AndreJaenisch last week when I needed you. Instead I had to use Google to figure out how to edit hex values. At any rate, I'm pretty sure vim can do everything.
xxd (turn vim into a Hex Editor when entered in command mode. IIRC :%xxd)
— André Jaenisch (@AndreJaenisch) May 2, 2020
These aren't all of the tweets and there are more. If you're craving more take a stroll through the thread.
Anyway, if you read this far I'd appreciate a retweet or a follow. The goal is to share knowledge and level everyone up so that we can get some really cool stuff made, and who doesn't like cool stuff.
Until next time, stay safe and keep learning!