These are the files that get included in my ~/.bash_profile and
~/.bashrc. Each of them may be for a different operating system, so
before copying them to any host, make sure each script does what you
want on that machine. Or add tests to them so they exit when not on
an appropriate machine.
First, mkdir ~/.local/lib/bash, then copy the ones that are
appropriate to the host in question into that directory.
I have had to or am currently working with computers running any and all of the following:
- RedHat RHEL, CentOS, and Fedora
- Debian and Ubuntu
- SuSE SLES and OpenSuSE
- FreeBSD, NetBSD, and OpenBSD
- SysV Unix Solaris, OpenIndiana, and AIX
- Cygwin
- Macintosh OS/X
In case you log in to a server whose termcap supports 256 colors, but does not set the TERM to reflect that.
Look up the Autonomous System Number (and some other useful information) of an IPv4 address. You should also see the country of origin and the whole routed net block, as well as possibly some ISP information.
exa is an ls replacement written in Rust. I think it’s short for
examine. exag is a function that switches on all the useful git
options. exat is a replacement for tree.
I want to give a shout out to YouTuber Luke Smith for bringing up
fzf, the fuzzy finder. It works kind of like an interactive regular
expression parser, but not quite regular expressions. Let’s say you
pipe some text into fzf. Now type “the.” What fzf will now do is
narrow down the lines displayed to those matching .*t.*h.*e.*. So I
built some tools around it for searching documentation, history, and
log files.
In particular, this fixes Control-Left and Control-Right to go backward or forward one word at a time. Mostly for non-Linux hosts.
On Cygwin, color ls is not set up by default.
This ensures that Python and nmap are in my PATH on Cygwin.
This supports many different OSes. Sets up a color prompt. Takes
advantage of more than eight colors. Sets colors correctly with tput
instead of escape codes. If the last command exits with an error, it
turns the ending $ red. Also includes the current Git branch, if
available.
Note that on AIX, tput only supports setf and not setaf. Also,
the RGB order of bits is backward, which I assume is because Power is
big-endian and Intel is little-endian.
Taken from RedHat systems where this is configured by default. Sets the title bar on terminals to reflect user@host:pwd. This can also contain Screen session info.
A combination of PYgmentize and LEss. Pygmentize will colorize text written in most popular programming languages like any good editor would.
I couldn’t get Cygwin to work properly with the OpenSSH tools included
in Windows 10. Maybe I didn’t try hard enough, but I just added the
openssh package to my Cygwin install. This ensures there will be an
ssh-agent running so you can add your ssh keys.
Now I seem to have a multitude of HOME directories in Windows. In
Cygwin, $HOME is /cygwin64/home/$USER, but in Windows
$USERPROFILE is C:/Users/$USER. Prefix that with /cygdrive/c
and it’s annoying to type. Alias ~~ to cd there.
Export the variables to connect to the local X server and PulseAudio daemon. Then start ssh-agent if it’s not running.