Tech stuff and info dump

linux: find out what you’ve recently typed at the command line

May 31st, 2010

If you open a terminal window (in Ubuntu 10.04, go to Applications->Accessories->Terminal) and type

history

this will print out a list of things that have been recently typed at the command line.

If you’re curious, the history is stored in a file called .bash_history which you can view as a file. In Ubuntu, for example, you can open it with gedit by opening a terminal window and typing

gedit .bash_history

at the command line.

Note: if you have two (or more) terminal windows open and are typing commands in all of them, the history of one terminal window won’t know about what you’ve typed in the other window. If you close, say terminal window A, leave terminal window B open. and then open terminal window C, typing history in terminal window C will display what you’ve typed in A but not in B.

Examples of using grep to search through the history are here.


Filed under: Command line,linux
May 31st, 2010 11:43:53
no comments
Leave a Reply