Easier .bash_aliases editing

I’m a lazy fellow. I like writing bash aliases to make my life easier. For example, I wrote a tutorial on how to automate updates with an alias that would rrun apt-get update/upgrade/dist-upgrade/autoremove automatically. And I’m about to write one regarding connecting to SFTP connections; as a web host, I need to access a number of sites, and it’s really handy to be able to connect from tilda quickly…

Anyway, today’s tip is about two aliases I have in my .bash_aliases that make life easier. Here’s the aliases (well, technically functions):

al()
{
	pluma ~/.bash_aliases </dev/null &>/dev/null &
}

sal()
{
	source ~/.bashrc
}

al” is short for “aliases”, and “sal” is short for “source aliases”, although technically it’s source ~/.bashrc, but .bashrc references .bash_aliases.

Basically, al starts a Pluma instance with .bash_aliases loaded. When I’m done editing, ctrl-s + alt-F4 and I’m done. It’ll take me back to either tilda (a quick F12 away) or the terminal instance I was in, where I can run sal, which reloads .bashrc and makes my changes work. (If you’re not familiar - .bashrc is only read when you start a terminal, so if you make changes, you have to reload it, which is what source does)

The only thing I don’t like is that the above method of calling Pluma causes status updates to appear in the terminal session. However, the nice thing is that you can kill the terminal session and Pluma is detached — so it won’t close if you close your terminal session for whatever reason.

If anyone knows of a cleaner way to do that, I’m all ears.

And now I’m off to write up my next tip article that references this one. :slight_smile:

1 Like