Score:0

How does `chsh -s $(which zsh)` work?

cn flag

I changed my shell recently to ZSH, I heard people say they liked it a lot more than the default BA shell or BASH. Everything went fine, followed a guide word for word, and the guide did not miss lead me, however; as is the problem with such guides, I didn't really know what I was doing, which always bugs me, so I went back through the instructions, attempting to interpret there "under the hood" mechanics, but I don't really understand one of the commands. Can someone better explain, what exactly the command below does, and how it does it (I know it has something to do with setting the user).



The instruction for using this command read:

If you are logged in on a shell you are on a standard user, simply change your shell by running:

chsh -s $(which zsh)

Perhaps the part I understand the least is the word which, like why use which?

muru avatar
us flag
https://askubuntu.com/a/799777/158442
Score:1
tr flag

chsh -> change shell

-s -> specify which shell

$(which zsh) -> run command which zsh and return it as operand to chsh -i

some distributions store binarys (like your shell) in different locations. so there is no one-fits-all tutorial for chsh. to make sure you give a valid path to chsh, you can search for zsh. this are 2 steps, combined in one command. 1. search for zsh ("which zsh is provided by system to me") 2. set it as your shell. the given command is failsafe and works on every linux (and unix) whith chsh and zsh installed, no matter in which directory/path it is installed.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.