Re: Common History across Shell
- From: Atishay <contactatishay@xxxxxxxxx>
- Date: Tue, 10 Jul 2007 09:22:22 -0000
On Jul 10, 1:36 pm, quarkLore <agarwal.prat...@xxxxxxxxx> wrote:
AFAIK history in bash is implemented such that each bash instance
maintains its individual history in memory. As and when a bash session
exits it updates history file.
If there are multiple shells running together then commands entered in
one can't be accessed using history command from other shells.
I am looking for a feature where if a user has multiple shells and on
a special keystroke / command all shells get a common history which is
sum of all histories.
Does such a feature exist in bash or any other shell?
Can such a feature be implemented without changing the shell's code?
Yes. That is precisely what bash appears to be doing. .bash_history is
opened in read only mode and appends the commands to the file when
bash exits.
[root@braveheart]# truss -t open bash
open("/var/ld/ld.config", O_RDONLY) Err#2 ENOENT
open("/lib/libcurses.so.1", O_RDONLY) = 3
open("/lib/libsocket.so.1", O_RDONLY) = 3
open("/lib/libnsl.so.1", O_RDONLY) = 3
open("/lib/libdl.so.1", O_RDONLY) = 3
open("/lib/libc.so.1", O_RDONLY) = 3
open64("/dev/tty", O_RDWR|O_NONBLOCK) = 3
open("/proc/2546/psinfo", O_RDONLY) = 3
open64("/var/run/name_service_door", O_RDONLY) = 3
open64("/root/.bashrc", O_RDONLY) = 4
open64("/root/.bash_profile", O_RDONLY) = 4
open("/usr/share/lib/terminfo//x/xterm", O_RDONLY) = 4
open64("/root/.bash_history", O_RDONLY) = 4
open64("/root/.bash_history", O_RDONLY) = 4
open("/usr/share/lib/terminfo//x/xterm", O_RDONLY) = 4
[root@braveheart]# exit
exit
open64("/root/.bash_history", O_WRONLY|O_APPEND) = 4
open64("/root/.bash_history", O_RDONLY) = 4
open64("/root/.bash_history", O_WRONLY|O_TRUNC) = 4
[root@braveheart]#
There is no syncing of bash_history that happens if you have multiple
shells which are run by same user. I have verified that
.
- References:
- Common History across Shell
- From: quarkLore
- Common History across Shell
- Prev by Date: Re: A rookie's question concerning setenv
- Next by Date: Re: Common History across Shell
- Previous by thread: Common History across Shell
- Next by thread: Re: Common History across Shell
- Index(es):
Relevant Pages
|