jean-zay-doc
jean-zay-doc copied to clipboard
Document how to use zsh
- install zsh from conda-forge
-
source /gpfslocalsup/spack_soft/environment-modules/current/init/zsh
so that themodule
command works. - launch zsh directly when sshing to Jean Zay: either tweak
.bashrc
to launch zsh instead of bash (http://unix.stackexchange.com/a/136511) or maybe simpler useRemoteCommand
in~/.ssh/config
(https://unix.stackexchange.com/a/548057/174101) but that needs ssh 7.6 (see https://www.openssh.com/txt/release-7.6)
Hi @lesteve, just one comment here: the official shell on Jean Zay is bash. In particular, all system scripts are bash scripts. Additional shells are installed but we do not provide support for them yet. zsh might work very well (and I hope it will) but I just want to warn you that if there are some troubles when using it, this will be considered as a low priority issue.
Thanks a lot for the precision! I think I have seen it somewhere in your official doc that bash was the only supported shell indeed. I will make sure to mention that zsh
is not supported officially!
In practice I have not noticed any issue so far so I thought I would mention that if people are interested.
Just to explain, I am used to have a zsh
prompt and there are a few zsh
features or rather prezto features (a zsh framework similar to oh-my-zsh) that I can not live without (nice prompt, autosuggestions, Control-P matching anywhere in my history, Alt-P matching history with the whole beginning of my command, etc ...).
Basically this is a way to feel more at home and productive on Jean Zay!
It does work for fish too. I have a similar setup:
- install
fish
from conda-forge - to get the module command
source /gpfslocalsup/spack_soft/environment-modules/current/init/fish
- add
exec $PATH_TO_CONDA_ENVS/bin/fish -l
to your.bashrc
Excellent thanks for letting us know!
source /.../environment-modules/4.3.1/gcc-4.8.5-ism7cdy4xverxywj27jvjstqwk5oxe2v/init/zsh
so that themodule
command works. Probably needs something a bit more robust than this complicated name.
It would indeed to better to use /.../environment-modules/current/init/...
instead.
Yep I looked at my .zshrc
and that's what I have indeed (I edited my first post):
MODULE_INIT_ZSH=/gpfslocalsup/spack_soft/environment-modules/current/init/zsh
if [[ -s "$MODULE_INIT_ZSH" ]]; then
source "$MODULE_INIT_ZSH"
fi
In fact we even have an environment variable $MODULESHOME
but I am not sure if it's inherited by zsh?
In case someone doesn't want to use conda, zsh can be compiled from source without sudo (https://stackoverflow.com/a/15293565).
- Install zsh form source
wget -O zsh.tar.xz https://sourceforge.net/projects/zsh/files/latest/download
mkdir zsh && unxz zsh.tar.xz && tar -xvf zsh.tar -C zsh --strip-components 1
cd zsh
./configure --prefix=$HOME
make
make install
- Edit the
.zshrc
to enable themodule
command, in a new line add:source "$MODULESHOME/init/zsh"
- (zsh on login) Edit your
.bashrc
and add in a new line:exec zsh
PS: If something goes wrong after editing the .bashrc
, i.e., zsh
has not been properly installed or whatever, the shell will raise an error and close the ssh connection. The solution is to remove the problematic line (e.g. exec zsh
), but since the ssh connection is closed upon login, it's annoying. Simple "hacky" solution is to ssh into jean-zay and hit Ctrl+c
as soon as the authentification is done (when the welcome screen is printed). This will stop the execution of the .bashrc and gives you access the the shell.