Is there any feature in a terminal to make a list of favorites commands, using shortcuts, or some type of utility, something integrated into the terminal?
Is there any feature in a terminal to make a list of favorites commands, using shortcuts, or some type of utility, something integrated into the terminal?
You can define aliases:
(you can put that into your
.bashrc
)and you probably know about tab completion (if you never heard of that, I can imagine why you are asking).
I would recommend HSTR (formerly known as history suggest box. HSTR (HiSToRy) is a command line utility that brings improved bash/zsh command completion from the history. It aims to make completion easier and more efficient than Ctrl-r.
HSTR can also manage your command history (for instance you can remove commands that are obsolete or contain a piece of sensitive information) or bookmark your favorite commands.
I use it in particular for saving favorites.
To install
In Bash those are functions
You can create a function "f1" that would execute a command with specific options and a function "f2" that does the same command with a 2nd set of default options.
If interested, you could also try different shell, fish.
Fish has great auto-completion by default. Commonly run (or favorite) commands can be tab completed quite easily. This is also a useful feature for figuring out command sequences you don't have memorized, but remember parts of. You can type a portion of the sequence and use the ↑ and ↓ keys to go through you command history.
And like bash, you can create aliases in fish. A handy way to do it in the terminal:
The functions are located in
$HOME/.config/fish/functions/
I'll vote for customing our terminal to let it learn which command used most frequently. And here the tips:
1.install
zsh
and set it as the default Shell environment.2.install
Oh My Zsh
3.configure
zsh
theme(optional)4.add
zsh-autosuggestion
after the installation, we should set
plugins=(git zsh-autosuggestions zsh-syntax-highlighting)
in~/.zshrc
, then restart Shell.5.install
Terminator
(optional)\o/ finish! Just have a try, and you will love it!
And be friendly to your
up
,down
,left
,right
keys.It hasn't mentioned before here, but it might be useful to know that under bash by default command history is saved to ~/.bash_history and lines can be copied and saved out of here.
There is a small app called Marker that does exactly what you want. While your edited/polished command chain is on the command line you bookmark it with CTRL+k. It allows you to add some description too. to recall one of your bookmarked commands press CTRL+SPACE Type marker remove to remove a user-defined command
to install
main ref: https://github.com/pindexis/marker
also see this article for explanation.
The great thing about this app is that it offers almost all Linux commands -- including their flags and option -- as a template for you to complete. Just type the name of the command and press CTRL+SPACE.