Which Linux command or utility is simple, powerful, and surprisingly unknown to many people or used less often?
This could be a command or a piece of software or an application.
For example I’m surprised to find that many people are unaware of Caddy, a very simple web server that can make setting up a reverse proxy incredibly easy.
Another example is fzf. Many people overlook this, a fast command-line fuzzy finder. It’s versatile for searching files, directories, or even shell history with minimal effort.
|
Honorary mention to
<
and&
awk
…for parsing the output of other commands quickly and simply. Then that parsed output can be used to create simple log messages or be passed as args to other scripts. Powerful.
awk and sed have always been intimidating for me with that cryptic syntax.
I agree with your sentiment regarding confusing syntax, however I think that confusion simply requires a calculated approach to dispell it.
It’s a prime example of why I use scripts as reminders as much as I use them functionally. I work out the syntax once… save it to an example script, then save myself 20 minutes of remembering by just $ cat ./path/to/script.sh and copying said syntax.
So if you can change your workflow such that learned things stay around as examples, I feel that you will pick it up much more quickly :)
zoxide. It’s a fabulous
cd
replacement. It builds a database as you navigate your filesystem. Once you’ve navigated to a directory, instead of having to typecd /super/long/directory/path
, you can typezoxide path
and it’ll take you right to/super/long/directory/path
.I have it aliased to
zd
. I love it and install it on every systemYou can do things like using a partial directory name and it’ll jump you to the closest match in the database. So
zoxide pa
would take you to/super/long/directory/path
.And you can do partial paths. Say you’ve got two directories named
data
in your filesystem.One at
/super/long/directory/path1/data
And the other at
/super/long/directory/path2/data
You can do
zoxide path2 data
and you’ll go to/super/long/directory/path2/data
Sounds a lot like autojump
I’m not familiar with
autojump
You can do
zoxide path2 data
I usually would just doz 2data
. Yes, I’m lazy. It’s the perfect tool for lazy people.Nice! I guess I can be even lazier when navigating!
Better than fasd?
- xargs
- parallel
- PXE (ohai cobbler)
- tee
- task-spooler (ts aka tsp)
- rpm -V
Nothing new, just forgotten.
task-spooler (ts aka tsp)
This looks amazing. Do you know how well it works in dispatching and tracking jobs over remote servers (over SSH)?
We’ve been using tsp at my work for years and it works well. It is just a very basic queueing system so if you can run the job from the command line then you can run it via tsp.
Our workflow is to have concurrent jobs run on the remote servers with cron and tsp but you should be able to trigger remote jobs over SSH also if you prefer to have a single machine in charge of task allocation.
probably well known at this point but rsync is incredible and I use it all the time
bc
It’s a simple command line calculator! I use it all the time.
socat
- connect anything to anythingfor example
socat - tcp-connect:remote-server:12345
socat tcp-listen:12345 -
socat tcp-listen:12345 tcp-connect:remote-server:12345
Control+r == search through your bash history.
I used linux for ten years before finding out about that one.
I’m not sure how underrated it is but the exec feature in
find
is so useful, there are so many bulk tasks that would just be incredibly difficult otherwise but instead are just one lineJust be careful with files with spaces in the name. There’s an incantation with
xargs
that I always have to look up when I want to use it safely.
- awk
- the (usually rust-based) coreutils “alternatives” like bat, fd, eza, procs
- trash-put (rm with trash integration. But beware that it also operates on directories by default, which rm only does with -r. There should be an option to change that behavior but there isn’t. Don’t alias rm to this)
- wl-copy/paste (or the older one for X11, ‘xclip’ IIRC. Enables you to do stuff like “cat image.jpg | wl-copy” to copy it to the clipboard. Best alias it to something shorter)
- xdg-open (open the file using your associated program for that file type. Alias to “o” or so)
- pass (awesome password manager, when you have a GPG key pair. Even better in combination with e.g. wofi)
- notify-send (to send GUI notifications from shell scripts)
- ledger (plain-text accounting software. If you use Emacs you should take a look at this as it’s written by an Emacs dev, and has good integration of course)
- nc
- nohup
kde connect
grep goes crazy if you know your regex
I can never get grep to work consistently on Mac and Linux. Now, ripgrep OTOH…
That’s because Macs generally use BSD-based command line tools instead of GNU ones. You have to do a lot of Homebrew jiggery-pokery to approximate a GNU environment. Know Your Tools: Linux (GNU) vs. Mac (BSD) Command Line Utilities
Alas, doesn’t fit my purpose since it requires action by the script user. I usually just use perl in those situations
Check out my chapter on GNU grep BRE/ERE for those wanting to learn this regex flavor: https://learnbyexample.github.io/learn_gnugrep_ripgrep/breere-regular-expressions.html (there’s also another chapter for PCRE)
Not powerful, but often useful,
column -t
aligns columns in all lines. EG$ echo {a,bb,ccc}{5,10,9999,888} | xargs -n3 a5 a10 a9999 a888 bb5 bb10 bb9999 bb888 ccc5 ccc10 ccc9999 ccc888 $ echo {a,bb,ccc}{5,10,9999,888} | xargs -n3 | column -t a5 a10 a9999 a888 bb5 bb10 bb9999 bb888 ccc5 ccc10 ccc9999 ccc888
vd
(VisiData) is a wonderful TUI spreadsheet program. It can read lots of formats, like csv, sqlite, and even nested formats like json. It supports Python expressions and replayable commands.I find it most useful for large CSV files from various sources. Logs and reports from a lot of the tools I use can easily be tens of thousands of rows, and it can take many minutes just to open them in GUI apps like Excel or LibreOffice.
I frequently need to re-export fresh data, so I find myself needing to re-process and re-arrange it every time, which visidata makes easy (well, easier) with its replayable command files. So e.g. I can write a script to open a raw csv, add a formula column, resize all columns to fit their content, set the column types as appropriate, and sort it the way I need it. So I can do direct from exporting the data to reading it with no preprocessing in between.
awk
simple
Came here to say both of these things. (Awk and “> simple”.)
To be totally honest, I don’t think awk is any more complicated than something like grep, it’s just that regular expressions get used more often so they’re typically more familiar. In the same way that programming languages with c-like syntax (like Java and C#) often feel easier than ones that don’t (like Haskell and Clojure).
Awk is a turing complete programming language.