Knowledge Base

Preserving for the future: Shell scripts, AoC, and more

Save common commands on this server to .useful file

Command line productivity takes many forms. Some people live by bash autocompletion. I disdained it when I first started using bash (coming from ksh93) but over time realized that it's a fantastic method for discovery (it's much more complete on Debian-based distros than Fedora-based ones) and ease of use when typing long pathnames. When you manage a disparate set of systems, and there are some tasks you repeat often, you usually try to list history and find the useful commands. One of mine:

sudo /var/storage1/shares/public/www/example.com/repo/devuan-deb/update-devuan-deb.sh

But over time, I have many commands I log in for, just to run the one command, and log out. So I have started using a text file: ~/.useful. Inside this file, place your oneliners. So whenever you log onto a box, and you need to see what commands you run here commonly, check what you've saved:

cat ~/.useful

Of course, it's only useful if you bother to populate it.

echo 'vi $( newest /var/log/debmirror/ log )' >> ~/.useful

Comments