ubuntu/unix command line "history"

ping songpingemail at gmail.com
Tue Oct 16 17:12:57 UTC 2012



On 10/16/2012 12:09 PM, Tony Arnold wrote:
> On 16/10/12 16:54, ping wrote:
>
>> what happens? each terminal maintains a seperate instance of command
>> line history? is there a method that I can always rely on to find out my
>> old command?
>
> By deafult when a shell exits, the history file gets over written
> completely so you lose any history from previous shell invocations.
>
> You can use 'shopt histappend' in your .bashrc file to cause the history
> file to be appended to when a shell exits instead of being over written.
>
> This is described in man bash under SHELL BUILTIN COMMANDS.
>
> I think this will help.
>
> Regards,
> Tony.
>

I already had that options:

    14 # append to the history file, don't overwrite it 

    15 shopt -s histappend 

    16

but looks doesn't help.

here for example, I have 2 different view of the history in 2 terminals:

//terminal 1
ping at 640g-laptop:~$ history | grep record
  3947  byzanz-record --x=0 --y=0 --width=800 --height=600 temp-byzanz.gif
  3949  byzanz-record --x=0 --y=0 --width=800 --height=600 temp-byzanz.gif
  3955  byzanz-record --help
  3956  man byzanz-record
  3957  sudo apt-get install recorditnow
  3958  recorditnow
  3959  byzanz-record --x=0 --y=0 --duration=30 --width=800 --height=600 
temp-byzanz.gif
  3961  byzanz-record --x=0 --y=0 --duration=30 --width=800 
--height=1000 temp-byzanz.gif
  3963  byzanz-record --x=0 --y=0 --duration=30 --width=800 
--height=1200 temp-byzanz.gif
  3965  byzanz-record --x=0 --y=0 --duration=30 --width=800 
--height=1200 temp-byzanz.gif
  3969  byzanz-record --x=0 --y=0 --duration=30 --width=800 
--height=1200 temp-byzanz.gif
  3971  byzanz-record --x=0 --y=0 --duration=30 --width=800 
--height=1200 temp-byzanz.gif
  3973  history | grep record


//terminal 2
ping at 640g-laptop:~$ history | grep record
  3950  byzanz-record --duration=60 --x=0 --y=0 --width=800 --height=600 
temp-byzanz.gif
  3952  byzanz-record --duration=60 --x=0 --y=0 --width=1200 
--height=600 temp-byzanz.gif
  3954  byzanz-record --duration=60 --x=0 --y=0 --width=600 
--height=1200 temp-byzanz.gif
  3957  history | grep record





More information about the ubuntu-users mailing list