Various tools in my toolbox -- notes and code
Over the past couple of decades, I have used several Unix tools, and have amassed a pretty good collection of notes, tips, and tricks on many of them. I've also created several little tools for my own use.
Over the next few weeks/months I hope to add those notes, as well as most of my tools, cleaned up and made current, to this repo.
I should mention that some of the tools in this repo did, at some time, have their own repos. But they all gradually became smaller and simpler (as I became smarter??) so I moved many of them to this repo instead. These repos are (so far):
bq
active-aliases
lineup
external tools
vifm -- file manager with vim-like key bindings
I had been somewhat happy with the file manager I had been using for some years, having learnt to live with it's somewhat baroque configuration requirements (involving 4 different files -- 2 custom syntaxes, 1 shell, and 1 python!)
But the urge to move on was there, and one weekend I started looking around, eventually finding vifm.
It has some really nice features that I explore in vifm.mkd.
my own tools
installation
Any or all of these can be installed simply by copying the corresponding
script(s) to some place in your $PATH
. They're not meant to be any more
complicated than that.
compatibility / requirements
I've only tested these on Linux. I only use bash
(not interested in
limiting myself to sh
).
Some of them may require a relatively recent perl and bash.
I make good use of all the mod-cons; fd
, rg (ripgrep)
, and fzf
to start
with.
I think somewhere in my scripts I use sponge
from moreutils
.
Anything more specific should be mentioned in the markdown file corresponding
to the specific tool in question (for example, dirstat
uses GNU "datamash",
and you'll see it mentioned in dirstat.mkd
).
tools without their own documentation
Some of the tools don't come with an "mkd" file, so here are some pointers for their use if you're curious.
-
try
try
is an interesting use offzf
's "preview" function. Instead of an "mkd", you get a video to explain it :) -
fxp
See the section on "progress bar while copying files" in cli-tips.mkd.
-
yturl
See the section on extracting youtube IDs from a filename in argmod.mkd.
appendix A: other tools in my toolbox
map
map
is my replacement for xargs, at least until someone like BurntSushi or
sharkdp writes something to replace it (as they did with ripgrep (grep) and fd
(find) respectively!)
Has only 3 options, and does so, so, much!
It's just a bit bigger than the tools here, so I left it in its own repo: https://github.com/sitaramc/map
appendix B: really minor hacks...
...that might nevertheless help someone.
pasting commands
Have you ever found it annoying that a lot of commands shown in website
(including possibly mine) include the $
prompt at the start? Whatever the
reason, it's annoying because you can't simply double-click the line in your
browser, hit Ctrl-C, then hit Ctrl-V in your terminal; instead, you have to
actually move the mouse over almost the whole line, carefully avoiding the
$
.
Well, not if you have an executable called $
in your $PATH
, containing
just two lines:
#!/bin/bash
"$@"
:-)
(Obviously this own't work for things like cd
, or setting environment
variables, etc., so do pay attention to what the command is doing!)
colors
Do you want to add color to your terminal output, but don't want to muck
around with arcana like ^[32;1m
or whatever? Just use git! Here's a script
I call "color":
#!/bin/bash
_color() {
local color=$1
[ $color = reset ] || color="$color bold"
echo -n `git config --get-color "" "$color"`
}
_color $1; echo -n "$2"; _color reset
Use it like this:
echo `color red ERROR:` file not found
man git-config
will tell you what colors are supported (plus you can also
use RGB values in hex, like #ff0ab3
).