How To Save Commands

I would like to find a way to save the commands that I’m using often.
In your opinion is Keep the best way?

1 Like

Hi!
I was looking for an answer to a question like that, too. And since I use the CopyQ clipboard manager, the easiest option was to store commands there. By creating bookmarks and fixing records.

Screenshot_20200504_130958

1 Like

in the meantime maybe I’ve found another interesting solution:

I don’t use bash normally, but I know that readline (which bash uses) supports forward/backward history searching with M+n/p (Esc+n and Esc+p) in its default emacs-like mode.

edit1: it’s not saving commands, but rather related to the article above. Esc+p + part of the command + Enter seems easier than applying and using tags.

edit2: just checked out keep and it looks like a pretty neat way to store and quickly run rarely used commands. I like it, thanks for sharing :slight_smile:
It is in AUR. Can be installed with yay -Sa keep

1 Like

I search my history a lot for convenience, but for commands I want to keep and remember long-term I just keep them in my notes taking application. That way they aren’t localized on a single machine, don’t get removed if I re-install and i available on all my devices.

If you do decide to use keep, don’t use sudo pip to install it as recommended in that article. That will cause some havoc with the package manager later. It looks like it is in the AUR.

2 Likes

@cipolla
Bash can be configured (and many other shells too) to easily retrieve old commands.
Don’t know if that is anything you’d want, but worth a try anyway.

In recent EndeavourOS installs, bash is already configured for the above.

For example, if you write (long) commands like:

mousepad a-very-long-file-name.txt
leafpad a-very-long-file-name-too.txt

and more, you can retrieve those old commands by

  • writing the first letters of the desired command, and
  • press the Up-arrow key as many times as you see the command you wanted

Then a simple Enter key executes the command.

Also the Tab key can complete words (e.g. file names) easily.

Most shells have these little tricks available (with minor or no configuration).

4 Likes

thanks a lot for all the replies :smiley:
after reading and searching I suppose that I’ve found what I was looking for, the alias command
I save the aliases that I need in bashrc, it’s the best option for me since I need no more than 10 aliases

1 Like

Aliases can be good for the purpose. There are also bash functions that are more versatile if you need more than what aliases are capable of.

1 Like

I have a list in one of the notes in SimpleNote that works across all devices, including my phone. And I have a whole Entire Linux, and then Arch specific folders for bookmarking specific things to remember or that I need to learn more about.

1 Like

This is an awesome.