As a terminal noob, I've created aliases for pretty much everything I do. The problem is that I've started forgetting those few commands that I do know because of it. On top of that, I sometimes need to edit a variable in the previous command.
So what I'd like is if when I use an alias, the first line printed is the actual command it represents, then proceed to execute the command. Since pressing up and !!
simply reprints the alias, I'm not too sure how to get a reference to the underlying command.
Thanks.
just type alias in your terminal, that will show the entire list of alias and redirect that to file if you want to save.
To see a list of aliases set up on your linux box, just type alias at the prompt. You can see there are a few already set up on a default Redhat 9 installation. To remove an alias, use the unalias command.
All you need to do is type alias at the prompt and any active aliases will be listed. Aliases are usually loaded at initialization of your shell so look in . bash_profile or . bashrc in your home directory.
each subsequent command you use in the shell automatically becomes a tracked alias. Invoking alias with the -t option, but without any specified names, displays all currently defined tracked aliases with appropriate quoting. marks each alias name on the command line for export.
You can always use:
alias
to list all your aliases, oralias name
to show the specification of the alias name
.So in fact you can define your alias as
alias myalias="alias myalias; <do stuff>"
I also think that chepner's answer with Alt-Control-e is more practical, but I am posting this for completeness.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With