11

Yesterday I installed Zsh, and tried to configure some things, but somehow everything is messed up. A lot of commands do not work, I've done PROMPT in ~/.zshrc but it does not work correctly either.

For example when I am trying to search for something: enter image description here

Now as you can see I also don't have the prompt name even though I added the PROMPT="...." configuration in the ~/.zshrc file.

Is it possible to somehow reset the whole configuration?

zsh  echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/mosquito/HP_Fortify/HP_Fortify_SCA_and_Apps_3.80/bin:/home/mosquito/HP_Fortify/HP_Fortify_SCA_and_Apps_3.80/bin

zsh cat /etc/shells /etc/shells: valid login shells /bin/sh /bin/dash /bin/bash /bin/rbash /bin/zsh /usr/bin/zsh

8ctopus
  • 158
  • 6
  • That seems to be an XY problem. What are "a lot of commands"? Your find is working, but just does not do what you excpected: Because the * are not quoted ('escaped'), zsh is trying (and failing) to find files matching *zsh* in the current directory (~, hidden files - like ~/.zshrc - are excluded). Try find / -name '*zsh*' instead. As for resetting: if you only ever changed ~/.zshrc you may just delete it and start from fresh. – Adaephon Jun 16 '14 at 07:33
  • You are right sir about find. Anyways, I deleted zshrc, how do I get fresh one? – user1880405 Jun 16 '14 at 07:38
  • From your terminal type echo $(which zsh) please and post result. – RCF Jun 16 '14 at 07:43
  • I updated main question with info you asked. Also zsh does not do anything. ➜ zsh echo $(which zsh) /usr/bin/zsh – user1880405 Jun 16 '14 at 07:47
  • Ok, you path is good and your zsh appears to be OK except for your .zshrc. Having deleted the file from Terminal just enter "zsh" and see if it will prompt you with the "new user screen" – RCF Jun 16 '14 at 07:49
  • As I said zsh does not have any effect sir. – user1880405 Jun 16 '14 at 07:50
  • I tried chat and it failed so I have to post here. echo $SHELL, if the result is zsh, then enter ls -la from your home directory and check for .zshrc file. – RCF Jun 16 '14 at 07:52

4 Answers4

11

To reset your zsh configuration, remove all instances of .zshrc and any .zshrc.??? swap files you may have left over from previous edits.

rm -f ~/.zshrc*

Then, close your terminal session and re-open. You should get the "new user" screen. Select the options from the menu prompts to create a new recommended starting point for your .zshrc configuration and add any prompts or other options you need.

That should do it.

Just be sure that zsh is in /etc/shells file.

which zsh

Will verify the path to your zsh shell.

Set the default shell to zsh, if not already done with

chsh -s $(which zsh)

Verify your FPATH contains the zsh functions and site-functions folders.

Hopefully, all is well.

RCF
  • 2,097
  • 4
  • 19
  • 25
4

I would just like to add, that in case you are using something like oh-my-zsh, then instead of just deleting the .zshrc file, You need to copy the standard default .zshrc file.

Use this command instead:

cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc

4

I ended up copying the contents from the template file in the github repo into my ~/.zshrc file that I'd messed up, found here: https://github.com/robbyrussell/oh-my-zsh/blob/master/templates/zshrc.zsh-template

DonnaLea
  • 141
0

I know this is an old question, but it seems there is now (in zsh 5.8) a 'proper' method to reset the configuration wizard (for want of a better word).

I've just used rm .zshrc to reset the wizard on a new install as described in the accepted answer. After I logged out and back in, the wizard ran again, allowing me to set the various options. After I saved everything, it told me:

The function will not be run in future, but you can run
it yourself as follows:
  autoload -Uz zsh-newuser-install
  zsh-newuser-install -f

I haven't tried either method myself, but it looks like they will do the job. I don't know what the difference between the two methods is, but I'd guess that the first one will run the next time you log in and that the second one will run immediately.

The set-up instructions also mention these, showing the message in an image of the terminal when the set-up is complete.