View the history of commands in Linux terminal
- August 31, 2019 at 1:44 pm #1893
Santhosh Kumar DMember
One can simply press the
up arrowkey to scroll through the typed commands in Ubuntu. But, what if you want to view the history of commands in Linux terminal that you typed a week ago?
In default, the above command will list around 500 commands that you have recently typed.
To filter these commands, use
xis the number of the command you want to see. For example:
And, to search for a specific keyword, use
grepalongside the history command. For example:
history | grep user
You can also recall a command by typing the (exclamation mark)
!followed by the entry number.
For example, type
!13and it will show the 13th command from the recent commands list.
If you want to run the very last command, use
And, to run the commands numbered from the last, use
And finally, to clear the history of all commands typed recently, type:
rm ~/.bash_history && history -c
You must be logged in to reply to this topic.
- Use Ctrl + Shift + T to undo a closed tab in your browser
- Instantly create Google Docs, Sheets, Slides, Sites or Forms from browser address bar
- How to access Google Maps offline on your phone
- Twitter collects your data – Here’s how you can control it
- How to watch YouTube videos while using other apps on Windows
- Save PowerPoint file in .pps format to open it directly in slideshow mode
- Rename an Office file to .zip and unzip it to get all the contents of the file
- View the history of commands in Linux terminal
- How to control the mouse cursor using the keyboard in Windows
- Essential tips to backup, save and protect your data
- Ragu on Turn your PowerPoint slide into a blackboard or a whiteboard2 weeks, 4 days ago
- Ken on Use f.lux to prevent eye strain from your PC screen by filtering out blue light2 months, 1 week ago
- Ken on Free up internal storage space on your Android device2 months, 2 weeks ago