So I recently discovered this terminal command on lobste.rs and now it became my favorite git log –graph –decorate –oneline –all
I have been using this command for about a week now and this has been a life saver since it allows you browse git history easily when working on large projects with a lot of commits.
Lastly guys i would like to thank everyone who have enjoyed discussions threads that I started and huge thanks to all those people who replied these threads by sharing their great knowledge with others. Honestly I learned a lot from you guys.
Anyways instead of repetitively posting discussion thread I have decided to post them once a week on Sundays.
I hope everyone had a great weekend and I’m definitely looking forward to great responses from you guys
Grats on cooling the rate of posting while sticking around! :)
tig
is my favorite replacement for git’s builtins for almost anything related to viewing repository statusasdf
is my preferred language runtime manager, especially when paired with per-project.tool-versions
files.sl
is a fun thing to install on servers to remind people to type carefullyHonestly, collecting a bunch of little bash scripts to scratch your own itches though is kinda where I’m at these days. I have a cute little snippet for quickly logging notes to myself:
Easy modification (used elsewhere) is to take the arguments to that script and add them in addition to the date in the notes file.
Another variant is used to quickly generate dated and slugged notes for meeting minutes.
Oh wow, I use something similar to your notes script to gather timestamped meeting agenda ideas, but using it to create timestamped meeting minutes is a fantastic idea. (I have ADHD, which comes with something they call time blindness, so timestamps really help me reconstruct how time passed.)
I have basically this same script, which works great from an open terminal window, but I also have a hammerspoon key binding that works globally that I can type which will:
It’s really handy for note taking during video calls and other activities where the terminal window can’t be the primary thing going on.
Not a command exactly, but I only recently learned about $CDPATH which is great when you’re traversing around large source trees. There are other tools for this, like fzf, but what I love about $CDPATH is it’s deterministic, allowing me to build a muscle memory about commands to move to a desired location. Prior to this I used a lot of aliases that are really just shortcuts to cd with a frequently accessed directory.
Instead of asking low-effort questions once a week what about writing a blog post what you learned during that week and submitting it here? I’d like that much more…
Having slept a night I feel like this was rude. I’m sorry, @mraza007.
I have a shell command that I wrote called
mb
which I use kind of likemh
ormblaze
but on my mboxes. It still doesn’t work exactly as I’d like it to, and I’ve had to get into the habit of backing up my mailboxes as I have corrupted them a couple of times, but I find it is becoming my preferred way to interact with mail. Here’s a little show of the interface:The hash characters mean that I can run the whole line as a command and it’ll pull up the message, without me losing the advantages of having some headers available. In a similar vein, I also have an
lm
command which I think I found in an article on here quite recently, but I’ve enjoyed using it a lot. It works likeapropos
, but once again lets me run any line as a command and get the man page straight away:Have you seen neatmail?
I hadn’t, but it looks pretty nice, along with a lot of the other software on that page! I’m definitely going to dig into the source, although I won’t use it exactly as is because it doesn’t fit my criterion that I must be able to interact by executing a full line.
That said, it runs noticeably faster than my
mb
script which was quickly patched together with Python’smailbox
library. Thanks!I had to use double dashes for the command you listed:
It’s neat thanks for sharing.
Tip: a mnemonic is ‘git log A DOG 🐶’:
Or you can use an alias. I’ve had the above or one very similar aliased to ‘git lg’.
endcli
It closes the Amiga shell. Typing it means you’re done, phew.
!$
has been my favorite shell “command” lately. It inserts the last argument of the previous command. So, if I blame a file:And then I want to edit that file:
It’s a decent time saver for me.
Or use Alt-.
I think I have new favorite.
fzf
hands down. I never run it directly, but I have it baked into a~/bin/fuzzy-filter
script and many of my shell aliases so it’s a key part of my workflow especially for dealing with situations where you end up with “choose from a list of things with partially memorable names and partial suffixes of uuids or other nonesense”. Like if I want toexec
into a running docker container I candrun foo
and if there’s only one container who’s name matchesfoo
, the command runs immediately with that container’s name. If there’s more then one match though, fzf pops up a fuzzy filterable list so I type some more to pick the correct container, then the command proceeds with that container name.yes
might be my favorite just because the source code isn’t a simple loop.https://raw.githubusercontent.com/coreutils/coreutils/master/src/yes.c
pushd
/popd
are pretty useful to, though I’m not sure shell builtins count as far as “terminal commands” go.The
AUTOPUSHD
option is a feature that I really like inzsh
. It effectively turns everycd
into apushd
. This way, I don’t have to try to think about or anticipate whether I might later want to pop back to a previous directory.I collected a few favorites almost 20 years ago. Looking back at it now, there is one that I still use:
color
.Really, though, asking for a favorite shell command is like asking for a favorite helper function in a programming language. The value of both lies largely in the surrounding context, in the system of names.
Perhaps not my favourite, but my most popular are:
This doesn’t include piped commands (the
grep
inls | grep
), so it’s not a full list of everything I’ve run. I can’t be bothered to come up with a program to include that too 😅My favourites are probably
grep
andsed
, because they’re such useful pieces of plumbing that can fit in so many different situations.The most useful custom command I have is probably
age
, to openag
search results in Vim:P.S. informational nitpick: it’s really a shell command, and not terminal command. A terminal just reads input and displays characters, and a command for that is an escape code which moves the cursor or whatnot, whereas the shell interprets the commands you type (while reading the input from the terminal, and sending the output back).
Your bash one-liner made me curious about what terminal commands I use most often:
yay
is a 3rd party arch linux package manager,g
is my alias forgit
,pass
is the standard password manager,rg
is the ripgrep utility. Other than those, it’s all pretty commonplace basic command line tools.Heya, good to see you’re sticking around.
To add some interaction to these threads, how about we all try reply to another response, as well as posting our own?
My favourite shell command … I have a great fondness for the humble
tree
andtree -if
, which see the look-directly-around-you, one-directory-at-a-timels
and gives you a map of the entire directory tree at once. It’s like going to an unfamiliar supermarket and having a bird’s-eye view, instead of having to check every aisle.I’d completely forgotten about
tree
, which is slightly embarrassing as I use it a whole lot. Do you usetree -if
with something likepick
? I didn’t know about that set of flags but it seems to me that you lose a bit of the usefulness of the visual layout, although that might just be me.tree -if
prints something likeThe indentation-based visual layout is nice for small trees. For large trees, where ancestors scroll a long way off the screen, a prefix-based layout shows you the full path directly. Because files in the same part of the tree are next to each other with the same prefix it’s still quite visual.
Am I missing something, because I don’t see how this differs from
find -type f
?Same output, yes; but I learned about tree long before I learned about find, which is why tree is the one that I’m fond of. Fondness was this post’s prompt, hence.
Points for mentioning find, though; because it’s always available as part of POSIX, and tree is not.
Yeah, I tried it after you mentioned it. It might just be me, but I still find that it looks quite like a list of files even with the common parents. It’s cool that you find it helpful though :)
I would say my favourite command is
vim
. If you openvim
with a path to a folder, rather than a file, it will load the netrw plugin (which is enabled by default) which gives you a directory listing. In that listing, you can move around (with arrow keys orj
/k
) and you can even search for entries (start typing/git
to find.git
, for example). You can press-
to go up one dir, andt
to open something in a new tab. I find that kind of interactive thing to be great for looking around directories!You can also vim open a compressed tarball and edit files inside.
If I had to choose only one, it would be
awk
, but going through my history file it seems to bels
.To replicate @arp242’s command:
where I get
Other noteworthy commands have to be pandoc and ffmpeg, although ffmpeg is one of those I can barley use (for something a bit more complicated that just simple format conversion) without looking the commands up.
Absolutely daily I use:
l PATTERN [DIR]
: list files matching pattern, recursivelyg PATTERN [DIR]
: wrapper around grep with good defaultsgg PATTERN
: small wrapper around git-grep(code is at https://leahneukirchen.org/dotfiles/.zshrc)
Definitely
Give it a try; Edward Snowden approves it as a privacy-tool.
This should cease this low-effort spam for a while, hopefully.