LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   bash - remove reboot history when new term starts up (https://www.linuxquestions.org/questions/linux-newbie-8/bash-remove-reboot-history-when-new-term-starts-up-4175469172/)

fedoraDrew 07-10-2013 12:53 PM

bash - remove reboot history when new term starts up
 
Hello,

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
me@desktop$

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
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH

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

/usr/bin/clear


Thanks,
-Andrew

jpollard 07-10-2013 01:01 PM

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...

fedoraDrew 07-10-2013 02:02 PM

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: http://www.linuxquestions.org/questi...istory-882493/ ). I can follow through from there.

Thanks for the help. Going to resolve the thread.


All times are GMT -5. The time now is 12:17 AM.