LinuxQuestions.org
Visit Jeremy's Blog.
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 10-29-2008, 01:02 AM   #1
jsantosh_d
LQ Newbie
 
Registered: Oct 2008
Posts: 2
Blog Entries: 1

Rep: Reputation: 0
Smile Save history command in another file


Hi,
i am santosh!!
plz help me , how can i save the history command that were fired into another file ,

is this possible though scripting???

Regards
santo
 
Old 10-29-2008, 01:05 AM   #2
klearview
Member
 
Registered: Aug 2006
Location: London
Distribution: Debian, Kubuntu
Posts: 572

Rep: Reputation: 75
Simple:

history > file

(where file is anything you want)
 
Old 10-29-2008, 01:12 AM   #3
jsantosh_d
LQ Newbie
 
Registered: Oct 2008
Posts: 2
Blog Entries: 1

Original Poster
Rep: Reputation: 0
Smile History command

thanks for UR reply!!!


let me explain u

i want to save the history commands automatically in the desired file ,may be a script can be used !!!
also can we add the any entried in the crond ,for automation???

OR
is there any command to restrict the root not to clear the history file!!!

i.e " history -c"



regards
 
Old 10-29-2008, 02:01 AM   #4
klearview
Member
 
Registered: Aug 2006
Location: London
Distribution: Debian, Kubuntu
Posts: 572

Rep: Reputation: 75
Add 'shopt -s histappend' to your bashrc to get history appended on bash session exit, make sure you have 'export HISTCONTROL=erasedups' there to have no duplicate entries and finally use a large number in 'export HISTSIZE=<large_number>' i.e. 25000.

This will give you a large .bash_history file that you can search and back-up as needed.
 
  


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
how to save bash history between reboots? Kropotkin *BSD 1 01-16-2007 03:28 PM
save history from konqueror steelheat Linux - Desktop 1 09-10-2006 09:11 AM
Where does KDE's run command save history? ljubak Linux - Desktop 1 08-28-2006 04:21 PM
gnome-terminal command history file?? kushalkoolwal Debian 1 03-07-2006 06:39 PM
zaurus (OZ 3.3.5) can konsole save comand history? Brain Drop Linux - Laptop and Netbook 1 04-02-2004 09:40 AM


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

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration