Linux and UNIX view command-line history

BASH is the default shell for Linux computers. Bash has history command. It display the history list with line numbers i.e. it lists everything you have entered on the command line. You can recall commands from history so that you can save the time.

Task: View your command Line History

Type the following command:

$ history

Output:

911 man 7 signal
912 man ps
913 man 7 signal
914 man killall
915 killall -l
916 man killall
917 su –
918 su – lighttpd
919 su – lighttpd
920 cd /tmp/

So whenever you type a command, that command is saved is a file called .bash_history. Type following commands to get more info:

$ help history

$ man bash (look for Event Designators for more info).

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s