terminalzshoh-my-zshiterm

How to prevent ohmyzsh to clear the terminal screen?


I'm using iTerm with ohmyzsh. When I exit a ssh connection it always clears my terminal screen and I find that super annoying. I only experience this behaviour since I have installed ohmyzsh on the connected machine as well, before I used normal bash on that machine. I'm not sure if this comes from iTerm, zsh or ohmyzsh.

Does anyone know how can I prevent my terminal to clear the screen when I'm exiting the ssh session?

I tried to google but don't know what's the problem cause.


Solution

  • The solution posted here helped: https://unix.stackexchange.com/questions/70955/preventing-the-screen-from-being-cleared-when-exiting-an-ssh-session

    The /etc/zlogout caused the clearance of the screen at logout of the ssh session to a zsh shell.

    I fixed it by creating a ~/.zlogout file and add:

    alias clear=""
    

    Or:

    echo 'alias clear=""' > ~/.zlogout