Preserve tcsh history in multiple terminal windowsPreserve bash history in multiple terminal windowsPreserve...

How would an order of Monks that renounce their names communicate effectively?

How do I tell the reader that my character is autistic in Fantasy?

How exactly is a normal force exerted, at the molecular level?

What exactly did Ant-Man see that made him say that their plan worked?

Was it really unprofessional of me to leave without asking for a raise first?

Meaning of じゃないんじゃない?

Who voices the character "Finger" in The Fifth Element?

Movie in a trailer park named Paradise and a boy playing a video game then being recruited by aliens to fight in space

Graph problems as integer programs

How to describe POV characters?

I'm reinstalling my Linux desktop, how do I keep SSH logins working?

Is there a legal way for US presidents to extend their terms beyond four years?

Which is better for keeping data primary partition or logical partition?

Do launching rockets produce a sonic boom?

Company threatening to call my current job after I declined their offer

How to answer "write something on the board"?

Are gliders susceptible to bird strikes?

In native German words, is Q always followed by U, as in English?

I hit a pipe with a mower and now it won't turn

Can a function nowhere continuous have a connected graph?

My colleague is constantly blaming me for his errors

Do the 26 richest billionaires own as much wealth as the poorest 3.8 billion people?

Why won't the ground take my seed?

How can a valley surrounded by mountains be fertile and rainy?



Preserve tcsh history in multiple terminal windows


Preserve bash history in multiple terminal windowsPreserve bash history in multiple terminal windowsTrouble adding date to tcsh historyHow do I set an unlimited size to the history file for tcsh?How to preserve bash history in multiple terminal windowsWhat do you use to manage your shell history?Is there a way to make the history when pressing up in bash shared between shells?How to sync terminal session command history in bash?bash history truncated to 2000 at new login after upgrade to ubuntu 16.04Hitting up-arrow does not cycle through historytcsh multiline prompt/rprompt






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







8















How can we preserve or maintain the same history across multiple terminals?



The same question, but for bash shell , were discussed in the below link



Preserve bash history in multiple terminal windows



let me know the corresponding settings for tcsh shell ?










share|improve this question

























  • For more information on tcsh's history, see man tcsh. Searching for history -S should jump you to the most relevant part.

    – Randall
    Dec 28 '17 at 21:05


















8















How can we preserve or maintain the same history across multiple terminals?



The same question, but for bash shell , were discussed in the below link



Preserve bash history in multiple terminal windows



let me know the corresponding settings for tcsh shell ?










share|improve this question

























  • For more information on tcsh's history, see man tcsh. Searching for history -S should jump you to the most relevant part.

    – Randall
    Dec 28 '17 at 21:05














8












8








8


3






How can we preserve or maintain the same history across multiple terminals?



The same question, but for bash shell , were discussed in the below link



Preserve bash history in multiple terminal windows



let me know the corresponding settings for tcsh shell ?










share|improve this question
















How can we preserve or maintain the same history across multiple terminals?



The same question, but for bash shell , were discussed in the below link



Preserve bash history in multiple terminal windows



let me know the corresponding settings for tcsh shell ?







command-history tcsh






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Apr 13 '17 at 12:36









Community

1




1










asked Aug 30 '13 at 9:34









user1228191user1228191

3211 gold badge5 silver badges10 bronze badges




3211 gold badge5 silver badges10 bronze badges













  • For more information on tcsh's history, see man tcsh. Searching for history -S should jump you to the most relevant part.

    – Randall
    Dec 28 '17 at 21:05



















  • For more information on tcsh's history, see man tcsh. Searching for history -S should jump you to the most relevant part.

    – Randall
    Dec 28 '17 at 21:05

















For more information on tcsh's history, see man tcsh. Searching for history -S should jump you to the most relevant part.

– Randall
Dec 28 '17 at 21:05





For more information on tcsh's history, see man tcsh. Searching for history -S should jump you to the most relevant part.

– Randall
Dec 28 '17 at 21:05










2 Answers
2






active

oldest

votes


















7














These variables set the history to merge itself instead of overwrite, and not save duplicates:



set history=1000
set histdup=erase
set savehist=(1000 merge)


the secret sauce is this line:



alias precmd 'history -S; history -M'


which will save and merge your history prior to printing the prompt - i.e. after each command you type.



all of the above should be added to your .tcshrc file.






share|improve this answer
























  • When I added this alias precmd 'history -S; history -M' nothing occurred when I wrote any command. Is there something else that should be done?

    – Ayman Salah
    Mar 14 '17 at 11:53











  • @AymanSalah what occurs is not obvious - it's the .history file (or histfile shell variable value, if set) getting written to disk. Without the precmd alias set, ls -l .history will show the .history file as a untouched. With precmd set as above, ls -l .history will show the updated timestamp and size, as it gets written with each command.

    – Randall
    Dec 28 '17 at 20:21











  • @Randall Thank you for pointing that out. I had problems then with the shell session. What you're saying is 100% correct.

    – Ayman Salah
    Jan 1 '18 at 9:53



















0














In addition to Idan answer, I want to add that alias precmd 'history -S; history -M' potentially can mess up the history file, since it also records SIGINT and EOF signal (Ctrl+C and Ctrl+D).



enter image description here



A better way would be save and merge current shell history before running a command, and save after a comment.



You can achieve it by this setup below instead, because the tcsh doesn't recognize SIGINT or EOF as a command.



alias precmd        "history -M"
alias postcmd "history -S"





share|improve this answer








New contributor



berong91 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






















    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "106"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f88838%2fpreserve-tcsh-history-in-multiple-terminal-windows%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    7














    These variables set the history to merge itself instead of overwrite, and not save duplicates:



    set history=1000
    set histdup=erase
    set savehist=(1000 merge)


    the secret sauce is this line:



    alias precmd 'history -S; history -M'


    which will save and merge your history prior to printing the prompt - i.e. after each command you type.



    all of the above should be added to your .tcshrc file.






    share|improve this answer
























    • When I added this alias precmd 'history -S; history -M' nothing occurred when I wrote any command. Is there something else that should be done?

      – Ayman Salah
      Mar 14 '17 at 11:53











    • @AymanSalah what occurs is not obvious - it's the .history file (or histfile shell variable value, if set) getting written to disk. Without the precmd alias set, ls -l .history will show the .history file as a untouched. With precmd set as above, ls -l .history will show the updated timestamp and size, as it gets written with each command.

      – Randall
      Dec 28 '17 at 20:21











    • @Randall Thank you for pointing that out. I had problems then with the shell session. What you're saying is 100% correct.

      – Ayman Salah
      Jan 1 '18 at 9:53
















    7














    These variables set the history to merge itself instead of overwrite, and not save duplicates:



    set history=1000
    set histdup=erase
    set savehist=(1000 merge)


    the secret sauce is this line:



    alias precmd 'history -S; history -M'


    which will save and merge your history prior to printing the prompt - i.e. after each command you type.



    all of the above should be added to your .tcshrc file.






    share|improve this answer
























    • When I added this alias precmd 'history -S; history -M' nothing occurred when I wrote any command. Is there something else that should be done?

      – Ayman Salah
      Mar 14 '17 at 11:53











    • @AymanSalah what occurs is not obvious - it's the .history file (or histfile shell variable value, if set) getting written to disk. Without the precmd alias set, ls -l .history will show the .history file as a untouched. With precmd set as above, ls -l .history will show the updated timestamp and size, as it gets written with each command.

      – Randall
      Dec 28 '17 at 20:21











    • @Randall Thank you for pointing that out. I had problems then with the shell session. What you're saying is 100% correct.

      – Ayman Salah
      Jan 1 '18 at 9:53














    7












    7








    7







    These variables set the history to merge itself instead of overwrite, and not save duplicates:



    set history=1000
    set histdup=erase
    set savehist=(1000 merge)


    the secret sauce is this line:



    alias precmd 'history -S; history -M'


    which will save and merge your history prior to printing the prompt - i.e. after each command you type.



    all of the above should be added to your .tcshrc file.






    share|improve this answer













    These variables set the history to merge itself instead of overwrite, and not save duplicates:



    set history=1000
    set histdup=erase
    set savehist=(1000 merge)


    the secret sauce is this line:



    alias precmd 'history -S; history -M'


    which will save and merge your history prior to printing the prompt - i.e. after each command you type.



    all of the above should be added to your .tcshrc file.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Apr 29 '15 at 5:02









    IdanIdan

    861 silver badge2 bronze badges




    861 silver badge2 bronze badges













    • When I added this alias precmd 'history -S; history -M' nothing occurred when I wrote any command. Is there something else that should be done?

      – Ayman Salah
      Mar 14 '17 at 11:53











    • @AymanSalah what occurs is not obvious - it's the .history file (or histfile shell variable value, if set) getting written to disk. Without the precmd alias set, ls -l .history will show the .history file as a untouched. With precmd set as above, ls -l .history will show the updated timestamp and size, as it gets written with each command.

      – Randall
      Dec 28 '17 at 20:21











    • @Randall Thank you for pointing that out. I had problems then with the shell session. What you're saying is 100% correct.

      – Ayman Salah
      Jan 1 '18 at 9:53



















    • When I added this alias precmd 'history -S; history -M' nothing occurred when I wrote any command. Is there something else that should be done?

      – Ayman Salah
      Mar 14 '17 at 11:53











    • @AymanSalah what occurs is not obvious - it's the .history file (or histfile shell variable value, if set) getting written to disk. Without the precmd alias set, ls -l .history will show the .history file as a untouched. With precmd set as above, ls -l .history will show the updated timestamp and size, as it gets written with each command.

      – Randall
      Dec 28 '17 at 20:21











    • @Randall Thank you for pointing that out. I had problems then with the shell session. What you're saying is 100% correct.

      – Ayman Salah
      Jan 1 '18 at 9:53

















    When I added this alias precmd 'history -S; history -M' nothing occurred when I wrote any command. Is there something else that should be done?

    – Ayman Salah
    Mar 14 '17 at 11:53





    When I added this alias precmd 'history -S; history -M' nothing occurred when I wrote any command. Is there something else that should be done?

    – Ayman Salah
    Mar 14 '17 at 11:53













    @AymanSalah what occurs is not obvious - it's the .history file (or histfile shell variable value, if set) getting written to disk. Without the precmd alias set, ls -l .history will show the .history file as a untouched. With precmd set as above, ls -l .history will show the updated timestamp and size, as it gets written with each command.

    – Randall
    Dec 28 '17 at 20:21





    @AymanSalah what occurs is not obvious - it's the .history file (or histfile shell variable value, if set) getting written to disk. Without the precmd alias set, ls -l .history will show the .history file as a untouched. With precmd set as above, ls -l .history will show the updated timestamp and size, as it gets written with each command.

    – Randall
    Dec 28 '17 at 20:21













    @Randall Thank you for pointing that out. I had problems then with the shell session. What you're saying is 100% correct.

    – Ayman Salah
    Jan 1 '18 at 9:53





    @Randall Thank you for pointing that out. I had problems then with the shell session. What you're saying is 100% correct.

    – Ayman Salah
    Jan 1 '18 at 9:53













    0














    In addition to Idan answer, I want to add that alias precmd 'history -S; history -M' potentially can mess up the history file, since it also records SIGINT and EOF signal (Ctrl+C and Ctrl+D).



    enter image description here



    A better way would be save and merge current shell history before running a command, and save after a comment.



    You can achieve it by this setup below instead, because the tcsh doesn't recognize SIGINT or EOF as a command.



    alias precmd        "history -M"
    alias postcmd "history -S"





    share|improve this answer








    New contributor



    berong91 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.
























      0














      In addition to Idan answer, I want to add that alias precmd 'history -S; history -M' potentially can mess up the history file, since it also records SIGINT and EOF signal (Ctrl+C and Ctrl+D).



      enter image description here



      A better way would be save and merge current shell history before running a command, and save after a comment.



      You can achieve it by this setup below instead, because the tcsh doesn't recognize SIGINT or EOF as a command.



      alias precmd        "history -M"
      alias postcmd "history -S"





      share|improve this answer








      New contributor



      berong91 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















        0












        0








        0







        In addition to Idan answer, I want to add that alias precmd 'history -S; history -M' potentially can mess up the history file, since it also records SIGINT and EOF signal (Ctrl+C and Ctrl+D).



        enter image description here



        A better way would be save and merge current shell history before running a command, and save after a comment.



        You can achieve it by this setup below instead, because the tcsh doesn't recognize SIGINT or EOF as a command.



        alias precmd        "history -M"
        alias postcmd "history -S"





        share|improve this answer








        New contributor



        berong91 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        In addition to Idan answer, I want to add that alias precmd 'history -S; history -M' potentially can mess up the history file, since it also records SIGINT and EOF signal (Ctrl+C and Ctrl+D).



        enter image description here



        A better way would be save and merge current shell history before running a command, and save after a comment.



        You can achieve it by this setup below instead, because the tcsh doesn't recognize SIGINT or EOF as a command.



        alias precmd        "history -M"
        alias postcmd "history -S"






        share|improve this answer








        New contributor



        berong91 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.








        share|improve this answer



        share|improve this answer






        New contributor



        berong91 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.








        answered 1 hour ago









        berong91berong91

        11 bronze badge




        11 bronze badge




        New contributor



        berong91 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.




        New contributor




        berong91 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f88838%2fpreserve-tcsh-history-in-multiple-terminal-windows%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Taj Mahal Inhaltsverzeichnis Aufbau | Geschichte | 350-Jahr-Feier | Heutige Bedeutung | Siehe auch |...

            Baia Sprie Cuprins Etimologie | Istorie | Demografie | Politică și administrație | Arii naturale...

            Nicolae Petrescu-Găină Cuprins Biografie | Opera | In memoriam | Varia | Controverse, incertitudini...