Syncing Command History Across Many C Shell Terminals
I haven't been able to find an answer to this question after looking into it for almost a week. Please help me, Linux Questions, you're my only hope. Working on Red Hat Enterprise Linux Workstation, Release 6.6.
For work, I remote into a Linux server (using Remote Desktop) that uses C Shell rather than BASH (I'm not allowed to switch to BASH either). While in a session (lets call it session 1) I'll open up many tabs in a given terminal and type commands throughout all of them. I'll also sometimes open up additional sessions with Remote Desktop (lets call them session 2 and session 3) with many tabs in their respective terminals and type many commands throughout all of them. I have noticed that the "history" command when invoked in any tab of any terminal across any session does not include all of the commands I have used across all of the tabs and sessions. Only some of the commands are saved. Or alternatively, if I press the up arrow in one terminal, I get a command that is different from when I press the up arrow in another terminal. I would like a history that:
I've found solutions for BASH Shells, but not C Shell. I've found some information about C Shell on my own and have tried to implement solutions on my own without success. I've tried adding the following to the ".cshrc" file: Code:
set history=10000 Code:
set history = 10000 It's been super frustrating, especially because I've been at this problem for a week. Even if I could get the history to sync up across terminal tabs in a single session, I would be happy. Having this capability would seriously speed up my learning process. |
Each terminal session tab has its own buffer that is accessed by the up & down arrows.
Each session has its own access to the history for saving and then it only writes to the history when that session is properly closed, i.e. when each tab has been closed by 'exit' and the last tab is closed by exit. Thus the order of entries in the history shows, not in the order the commands were used, but in the order the commands were used combined with the order the tabs were closed. If you want the history to show everything done and in the order it was done you will need to limit your sessions and tabs to one of each and exit that one before you open the next. |
The bash soluitions, iirc, require the shell to write out the internal history each time you press enter (and also read it back into memory?).
My guess is that it will be pretty much the same on csh. |
If that is true then the history file when using multiple terminal windows/tabs would have commands mixed from those different terminal sessions. I am not sure what the OP expected but it seemed he did not want them mixed like that. I don't think he really has an option though.
|
I’m too busy/lazy to look it up right now, but I believe there are switches to cause the history to write to/read from disk. See your man page.
Personally, I’m OK with the per-session histories… |
^ Yep. What scasey said.
Quote:
|
computersavvy, I found this solution which apparently would give me everything I want if I was working in a BASH shell:
Code:
# Avoid duplicates It looks like this solution appends a command to the history file the moment it is written, so commands would essentially be organized chronologically. So while the commands would be "mixed" from different terminals, there would be some order to them. This kind of order is exactly what I am looking for. scasey & shruggy, I took a look at the man page by typing "man history" at the terminal and now I am really confused. Firstly, the manual seemed to be for BASH: The top of the manual read "BASH_BULITINS(1)" and the bottom of the document read "GNU Bash-4.0...2004 Apr 20...BASH_BULITINS(1)". Typing "ps" at the terminal confirms that I'm running a C Shell, so why is there a bash manual? Secondly, I found no mention of "savehist" in this manual. There are options for the history command namely: Code:
-c: Clear the history list by deleting all the entries. All, what if I added something like this to the ".cshrc" file: Code:
alias postcmd 'history -a; history -c; history -r' |
The manual page for tcsh is obviously tcsh(1). The quoted part is from Builtin commands because... well, history is a builtin command.
Until not so long ago, man history would result in Code:
No manual entry for history |
All times are GMT -5. The time now is 06:15 AM. |