Hello guys,
In this post I'm gonna show you "How to display and play with a list of recent commands in Ubuntu?".
To check history of command or to get info about command executed by user, we can use the following command:
Now you may feel it dificult to find a specific command among them. In order to do so, we can combine the history with grep.
We can also execute a specific command by knowing its serial number from this list. After getting the result from history command, just type the number preceeded by ! to execute the command. To execute command which is at number 115 in the list, just type
To re-run a recent command that starts with xyz, just type !xyz.
And the most commonly used reverse search:
In this post I'm gonna show you "How to display and play with a list of recent commands in Ubuntu?".
To check history of command or to get info about command executed by user, we can use the following command:
historyIt will display the list of all the command executed, along with a serial number indiacating the oerder in which they are executed.
Now you may feel it dificult to find a specific command among them. In order to do so, we can combine the history with grep.
history | grep versionThis will display a list of command in which the word "version" has appeared.
We can also execute a specific command by knowing its serial number from this list. After getting the result from history command, just type the number preceeded by ! to execute the command. To execute command which is at number 115 in the list, just type
!115It will run the 115th command in the history list.
To re-run a recent command that starts with xyz, just type !xyz.
!histoIt may display the recent history, if no other command would have been executed after recent history command.
And the most commonly used reverse search:
Ctrl + RAfter typing this command, type a keyword to search. When you found your command, just press enter.
Comments
Post a Comment