⬆️ ⬇️

zsh

Hello!



Let's talk about the most convenient shell for Linux. Meet - this is zsh . Many Linux users will not trade bash for anything else, but, being inclined to experiment, I was not lazy and set zsh.



Surely it is in many distributions, so I will not delve into how to install it. I will say simply that with an accuracy of 95% you will find it in the repositories of your distribution.



Once installed, you can immediately make it the default shell: we find the line with your login in / etc / passwd and change / bin / bash to / bin / zsh. When you first start it prompts you to customize yourself - enable auto-completion to the maximum there. For those who are lazy, I share my ~ / .zshrc:

')

bindkey '\ e [3 ~' delete-char # del

bindkey '; 5D' backward-word # ctrl + left

bindkey '; 5C' forward-word # ctrl + right



autoload -U compinit promptinit

compinit

promptinit;



if [[$ EUID == 0]]

then

PROMPT = $ '% {\ e [1; 31m%}% n% {\ e [1; 34m%}% ~ #% {\ e [0m%}' # user dir%

else

PROMPT = $ '% {\ e [1; 32m%}% n% {\ e [1; 34m%}% ~% #% {\ e [0m%}' # root dir #

fi

RPROMPT = $ '% {\ e [1; 34m%}% T% {\ e [0m%}' # right prompt with time



alias ls = 'ls --color = auto'

alias grep = 'grep --colour = auto'



Reconfigure it for yourself when you try. True, I do not remember how, but still know how to use man;). Yes, about dukemation: there is a lot of it, you can customize a lot of things, if you want to figure it out.



benefits

1) advanced autocomplit. eg:

cd / u / l / sb + tab turns into cd / usr / local / sbin /



sudo - (+ tab) turns into

sudo -

-H - set HOME environment variable

-K - remove user timestamp

-L - list options from Default section

-S - read password from stdin

-V - show version

-b - run command in background

-h - show help

-k - invalidate user timestamp

-l - list allowed commands

-p - password prompt

-r - Kerberos realm

-s - run SHELL

-u - user name

-v - validate user timestamp



Unlike bash, pressing tab again will substitute the first argument. Click again - the second will be substituted.



2) setting up controls in the style of vi or emacs

3) 2 promt-a: for example, you can put a clock on the right

4) shared story

5) still a lot of everything that I have not yet mastered.



Finally, I note that after zsh I don't want to move on to anything else =)



- ps collective blogs with a rating system strain me a little, so I’m modestly writing about experiments in my LJ. If anyone is interested, then nickname pax13.

Source: https://habr.com/ru/post/42680/



All Articles