Visit the LQ Articles and Editorials section
Go Back > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Slackware This Forum is for the discussion of Slackware Linux.


  Search this Thread
Old 03-07-2010, 05:10 PM   #1
Registered: Oct 2008
Distribution: Slackware 14 i686
Posts: 111

Rep: Reputation: 16
Question clearing commandline history

how would i clear my commandline history
at logon/logoff/startup time ??

it tried this : editing my /etc/rc.d/rc.local file like this
i know this is for system startup
# /etc/rc.d/rc.local:  Local system initialization script.
# Put any local startup commands in here.  Also, if you have
# anything that needs to be run at shutdown time you can
# make an /etc/rc.d/rc.local_shutdown script and put those
# commands in there.

#clear user history ~/.bash_history
echo "" > ~/.bash_history

#clear root history /root/.bash_history
echo "" > /root/.bash_history
but when i reboot, the history still remains.

Last edited by grimx; 03-07-2010 at 05:13 PM.
Old 03-07-2010, 05:12 PM   #2
Senior Member
Registered: Jan 2005
Location: Melbourne, Australia
Distribution: Debian Jessie (Fluxbox WM)
Posts: 1,380
Blog Entries: 52

Rep: Reputation: 355Reputation: 355Reputation: 355Reputation: 355
Try using the command
history -c
Old 03-07-2010, 05:32 PM   #3
Registered: Oct 2008
Distribution: Slackware 14 i686
Posts: 111

Original Poster
Rep: Reputation: 16
where would i put the command to clear roots
commandline history(when using su / sudo) ??
i have these alias in /etc/profile:
alias exit='history -c ~/.bash_history && history -c /root/.bash_history && exit'
alias clear='history -c ~/.bash_history && history -c /root/.bash_history && clear'


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
tcsh: can you save the history from multiple shells to one history file? BrianK General 2 04-23-2009 05:19 AM
ever had problems clearing konqueror's history? -=Graz=- SUSE / openSUSE 2 09-22-2006 04:52 AM
Clearing history AumDiar Linux - Newbie 7 01-03-2005 11:05 PM
clearing konsole history minm Linux - Newbie 5 08-23-2004 08:21 AM
Problems clearing Konsole history sergeantroach Linux - Software 2 11-01-2003 04:45 PM

All times are GMT -5. The time now is 01:18 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