LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 12-05-2014, 07:20 PM   #1
packets
Member
 
Registered: Oct 2005
Posts: 321

Rep: Reputation: 32
Run a command or script after successful login


I am planning to delete history after successful login. I tried putting history -c to /etc/profile, /etc/bashrc, ~/.bashrc and ~.bash_profile but still when I login and command history, I could still see my previous commands.

What is the proper way to delete history when logging in?
 
Old 12-05-2014, 09:33 PM   #2
Ztcoracat
LQ Guru
 
Registered: Dec 2011
Distribution: Slackware
Posts: 7,877
Blog Entries: 10

Rep: Reputation: Disabled
Hi:

The history -c (OR) history -cw are the only cmd's that I'm aware of; aside from just deleting the line your trying to get rid of.

http://www.howtogeek.com/179022/how-...x-or-mac-os-x/
http://stackoverflow.com/questions/6...story-in-linux

HTH
 
Old 12-05-2014, 09:59 PM   #3
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Debian, Mageia, and whatever VMs I happen to be playing with
Posts: 12,793
Blog Entries: 18

Rep: Reputation: 3318Reputation: 3318Reputation: 3318Reputation: 3318Reputation: 3318Reputation: 3318Reputation: 3318Reputation: 3318Reputation: 3318Reputation: 3318Reputation: 3318
Write a little script containing that command, make the script executable, then set that script to autorun using the method suitable to your distribution/window manager/desktop environment.
 
1 members found this post helpful.
Old 12-05-2014, 10:18 PM   #4
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Blue Ridge Mountain
Distribution: Linux Mint 17, Debian 8
Posts: 7,863

Rep: Reputation: 311Reputation: 311Reputation: 311Reputation: 311
I suggest that you try:

cp /dev/null /home/(user)/.bash_history

------------------
Steve Stites
 
  


Reply


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
RHEL 6 - Upon GUI Login Present successful and unsucessful User Login johnmccarthy Linux - Newbie 2 07-24-2013 01:38 PM
Unable to run another command from within shell script, when run from home directory blackray1 Linux - Newbie 7 07-01-2013 10:42 AM
[SOLVED] can't login after run su command sotitrox Slackware 4 12-05-2012 04:27 PM
[SOLVED] run ps|grep command by script/command line ... ERROR: Unsupported option (BSD syntax) masuch Programming 4 05-23-2012 05:13 AM
[SOLVED] I was successful in ns2 installation in fedora 9, but I can't run the example script sange Linux - Newbie 4 01-24-2012 07:18 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:48 AM.

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