Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 07-10-2013, 12:53 PM   #1
LQ Newbie
Registered: Oct 2008
Posts: 11

Rep: Reputation: 0
bash - remove reboot history when new term starts up


I am running a RHEL5.4 install with bash as my shell. I am getting quite annoyed at having to look at the reboot history every time I open a new shell window, but I can't figure out how to suppress it.

When I open a new shell, this is what I see:

# ... history goes waaaay back
Rebooted at 11:41AM 05/28/13 2.6.18-164.el5
Rebooted at 15:20PM 05/31/13 2.6.18-164.el5
Rebooted at 14:49PM 06/05/13 2.6.18-164.el5
Rebooted at 10:02AM 06/11/13 2.6.18-164.el5
Rebooted at 11:58AM 06/18/13 2.6.18-164.el5
SWITCH eth0: ... GigabitEthernet7/11

Here's some of my config files contents below. While not shown below, I looked through /etc/profile and /etc/profile.d/* but found nothing that looks relevant to suppressing reboot history.

me@desktop$ bash --version
GNU bash, version 3.2.25(1)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2005 Free Software Foundation, Inc.

me@desktop$ cat ~/.bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc

# User specific environment and startup programs


export PATH

me@desktop$ cat ~/.bash_logout
# ~/.bash_logout


Old 07-10-2013, 01:01 PM   #2
Senior Member
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,843

Rep: Reputation: 1472Reputation: 1472Reputation: 1472Reputation: 1472Reputation: 1472Reputation: 1472Reputation: 1472Reputation: 1472Reputation: 1472Reputation: 1472
So what is in the file "~/.bashrc"?

What do you want to see?

You can always delete the history file if you want. Just "rm $HISTFILE" on logout.

If you do that though, you might want to set the history file in bash_profile to something like $HOME/.bash_history`tty | sed 's/\//-/g'` That way you will always get a unique file for each terminal window, and delete it when you exit the shell.

Note: if the window is aborted, the exit/logout of the shell is not executed, so there can be some leftover files with the name .bash_history-dev-pts-<nn> where the nn corresponds tothe psuedo terminal numbers used for the terminal. Normally this wouldn't be a problem but sometimes you may find a history already exists...

Last edited by jpollard; 07-10-2013 at 01:08 PM.
Old 07-10-2013, 02:02 PM   #3
LQ Newbie
Registered: Oct 2008
Posts: 11

Original Poster
Rep: Reputation: 0
I would like to see just the last two lines, the SWITCH line and then the prompt. I don't really care about reboot history, and it is a corporate host so there are some things I can't touch (like /etc/profile).

Regarding the $HISTFILE, this is my command history, which I want to preserve. I checked, and I'm sure it doesn't have anything to do with displaying the host's reboot history.

I did find another thread that asked the same exact question (see here: ). I can follow through from there.

Thanks for the help. Going to resolve the thread.



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Eclipse Foundation starts Long Term Support initiative LXer Syndicated Linux News 0 02-21-2013 09:50 PM
How do you clear reboot history? Robert G Linux - Newbie 9 05-24-2011 06:28 PM
Apache Never Starts on Reboot SteveJenkins Linux - Server 9 03-19-2010 04:17 PM
Write history to .bash_history on reboot Kvetch Linux - Software 2 03-14-2007 08:43 PM
Every reboot starts an integrity check mustang05 Linux - Software 1 01-24-2004 09:34 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:19 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration