1 / 3
Caption Text
2 / 3
Caption Two
3 / 3
Caption Three margin testing

Friday, July 30, 2010

How to View bash shell history and Change bash history file size in Ubuntu

http://www.ubuntugeek.com/how-to-view-bash-shell-history-and-change-bash-history-file-size-in-ubuntu.html?utm_source=rss&utm_medium=rss&utm_campaign=how-to-view-bash-shell-history-and-change-bash-history-file-size-in-ubuntu

The Bash shell is the default shell environment in most Linux distributions, including all flavours of Debian. One default feature of the Bash shell is to record a history of all the commands entered by a user in a log file called .bash_history, found in the user's home directory.
View user bash history in Ubuntu

First open up a terminal from Applications > Accessories > Terminal and type the following command

history

This will show you all your terminal commands history on the terminal

If you want to save this history in to a file use the following command

history -w ~/userhistory.txt

Once you have save the file you can view using the following command from your terminal

gedit ~/userhistory.txt

Change bash history file size

If you want to change bash history file size open up your .bashrc using the following command from your terminal

gedit ~/.bashrc

Now add the following line at the top

export HISTFILESIZE=3000

Save and exit the file

As you can see, the limit can be changed.

Bash shell keeps it's own history in a file. You can view that file as stated before, or by opening ~/.bash_history.

No comments:

Post a Comment

Featured Post

Windows和Ubuntu双系统完全独立的安装方法

http://www.ubuntuhome.com/windows-and-ubuntu-install.html  | Ubuntu Home Posted by Snow on 2012/06/25 安装Windows和Ubuntu双系统时,很多人喜欢先安装windows,然...