Answer the question
In order to leave comments, you need to log in
Where can I read about `!!` in bash?
I knew about !!
it, it launches the last executed command. But I accidentally discovered something similar to aliases: !1
it displays for me sudo apt-get upgrade
!2
it displays for me it shutdown -r now
!55
displays for me nvm ls --lts
I understand that this is the id of some events, but I didn’t understand where they come from (they are clearly "outdated", some of these commands I long time no input).
Please share where this behavior is described and how to saddle it correctly.
Answer the question
In order to leave comments, you need to log in
1. The command history 10
will display the last 10 commands typed.
If it's simple history
, then it will print in order from 1 to 1000 - the number specified in the variable (in my case, these are 1000 commands)
For example:$HISTSIZE
[email protected]:~> history 6
1 ls -l
2 ls -la
3 ls -lh
4 sudo zypper dup --no-allow-vendor-change
5 sudo zypper se virtualbox
6 history
!3
, then the command will be executed, ls -lh
etc. Ctrl+r
, and then enter the first few letters of the command and it will return the closest to the input.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question