LinuxQuestions.org
Review your favorite Linux distribution.
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, 06:20 PM   #1
packets
Member
 
Registered: Oct 2005
Posts: 312

Rep: Reputation: 30
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, 08:33 PM   #2
Ztcoracat
LQ Guru
 
Registered: Dec 2011
Distribution: Slackware
Posts: 7,104
Blog Entries: 9

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, 08: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: 11,809
Blog Entries: 13

Rep: Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948
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, 09:18 PM   #4
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Blue Ridge Mountain
Distribution: Linux Mint 17, Linux Mint 18
Posts: 7,809

Rep: Reputation: 294Reputation: 294Reputation: 294
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 12:38 PM
Unable to run another command from within shell script, when run from home directory blackray1 Linux - Newbie 7 07-01-2013 09:42 AM
[SOLVED] can't login after run su command sotitrox Slackware 4 12-05-2012 03:27 PM
[SOLVED] run ps|grep command by script/command line ... ERROR: Unsupported option (BSD syntax) masuch Programming 4 05-23-2012 04: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 06:18 AM


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