1. Skip to Menu
  2. Skip to Content
  3. Skip to Footer>
Thursday May 2nd     7:27 PM PDT                                  

Configure Z-Shell (ZSH)

Written by Greg King Friday, 03 July 2009 16:20

In FreeBSD, a lot of everyday work is done in a command line interface called a shell. A shell's main job is to take commands from the input channel and execute them. A lot of shells also have built in functions to help with everyday tasks such as file management, file globbing, command line editing, command macros, and environment variables. FreeBSD comes with a set of shells, such as sh, the Bourne Shell, and tcsh, the improved C-shell. Many other shells are available from the FreeBSD Ports Collection, such as zsh and bash.

 

A NOTE OF CAUTION:  If you change your root shell to something, and then attempt to update the source for that shell, you could end up locking yourself out of your root account.  If you are going to do a port upgrade, and it includes an update to zsh, CHANGE YOUR ROOT SHELL to the basic shell first, then change it back after the port upgrade has concluded.  This happened to me once, and was NOT fun!  You have been warned!


Installation and configuration of the Z-Shell (ZSH)


The ZSH SHELL is great!  It has some cool PROMPTS and other neato-stuff. To use it, you first must install it.

# portinstall shells/zsh

NOTE: This procedure must be done for each user who wants to use this shell.

# cd /home/<user>
# nano .zprofile


----------START CUT & PASTE BELOW-------------------------------------------------------------

setopt AUTO_CD
setopt AUTO_MENU
setopt AUTO_LIST
setopt BEEP
setopt CORRECT
setopt CORRECT_ALL
setopt CSH_JUNKIE_HISTORY
setopt CSH_JUNKIE_LOOPS
setopt CSH_NULL_GLOB
setopt EXTENDED_GLOB
setopt EXTENDED_HISTORY
setopt FUNCTION_ARGZERO
setopt GLOB
setopt GLOB_COMPLETE
setopt GLOB_SUBST
setopt HIST_VERIFY
setopt HIST_FIND_NO_DUPS
setopt HIST_REDUCE_BLANKS
setopt KSH_GLOB
setopt LIST_TYPES
setopt MAIL_WARNING
setopt MARK_DIRS
EDITOR=nano
PROMPT='%B[%n@%m %C]%b %h %# '
RPROMPT='%D{%a %b %d} %B%D{%T}%b %D{%Z}'

--------STOP CUT & PASTE ABOVE-----------------------------------------------------------------

paste the above into your nano screen and save.  Let's change to that shell now...

# chsh -s zsh

Now, log off and back on for the new exciting prompt to take effect!

NOTE: For clarity & less confusion, configure user shell prompts with csh  and  root with zsh.



--More prompt tips can be found at: http://lantech.geekvenue.net/chucktips/
  FreeBSD Configuration
eXTReMe Tracker
Content View Hits : 405016