Zsh is a shell designed for interactive use, although it is also a powerful scripting language.

learn more… | top users | synonyms

55
votes
1answer
42k views

How do i change my default shell from bash to zsh?

I want to change my shell from the default bash shell to zsh on my Amazon EC2 instances. How do I go about doing it? Thanks!
36
votes
6answers
15k views

How can I make tmux use my default shell?

On a new setup, tmux is using bash instead of my default (zsh). How can I force it to use zsh?
31
votes
3answers
10k views

Zsh not hitting ~/.profile

I've just installed zsh on my Ubuntu system. It seems zsh isn't executing ~/.profile on init. To my best understanding, this should be an automatic behavior. What am I missing?
30
votes
6answers
9k views

zsh starts incredibly slowly

ZSH takes about a second and a half from creating a new terminal window to being ready. I'm pretty sure that the culprit is compinit. I haven't been able to find good documentation on compinit, but ...
25
votes
3answers
5k views

How to partially disable the zsh's autocorrect

The autocorrection function of zsh is very helpful for me but it does't always gives a proper result. ~$ sudo vim somefile zsh: correct 'vim' to '.vim' [nyae]? Yet what I want is something like ...
24
votes
3answers
13k views

What are the differences between fish and zsh? [closed]

I'm a bash user willing to switch to a more friendly and advanced shell. I read a lot of good things about zsh, but I gave a quick test at fish and it seems great too. Both seem very close in term of ...
23
votes
6answers
6k views

What zsh features do you use? [closed]

I do a lot of work in the terminal so I have learned a lot about my shell of choice, zsh. What features of zsh do you use to make yourself that much more productive at work? One of my favorites is ...
21
votes
2answers
6k views

Tmux and ZSH custom prompt : bug with window name

I have customized my ZSH prompt with oh-my-zsh to make it more readable and add information about git if I'm in a repository. Example : bob@inf [~/docs] % bob@inf [~/src/nicest] master % (in a git ...
21
votes
4answers
8k views

Change iTerm2 window and tab titles in zsh

I want to label the window tabs of terminal sessions. I'm using the zshell in iterm2 on OSX. Is it possible to change the label of a window tab dynamically in the terminal?
19
votes
1answer
3k views

ZSH Completion colors and OS X

Consider this minimal .zshrc : export CLICOLOR=1; export LSCOLORS=exfxcxdxbxegedabagacad; # It is the default value on OSX, so this line can be omitted autoload -Uz compinit compinit zstyle ...
17
votes
3answers
7k views

How do I customize zsh's vim mode?

Ok, so I finally made the great change. In my .zshenv, I changed my EDITOR: export EDITOR=vim There are a couple of questions I have that are so minor that I didn't want to start separate ...
17
votes
4answers
6k views

Bash/ZSH: Undoing 'disown'

Is there a way to 'reattach' a process to the shells job table after it it has been 'disowned'? Edit: $SEARCHENGINE totally fails me. Doesn't look too good.
17
votes
3answers
3k views

invoke zsh, having it run a command, and then enter interactive mode instead of exiting

i'd like to start zsh similar to zsh -c 'my_prog option1 option2' but instead of exiting after running that command, leaving me at the propt of the invoked zsh (not wherever it is being called ...
16
votes
1answer
3k views

oh-my-zsh history completion

I have recently switched to zsh, using robbyrussell's oh-my-zsh. Before that i used bash with a lot of custom stuff and i am only missing one thing because zsh is trying to be 'too smart': If i type ...
15
votes
9answers
5k views

Zsh: Open a new tab in the same directory

Say you are in /very/cool/and/deeply/nested/folder . And you want to open a new terminal tab in the same folder. How would you do that? I use Mac OS and Zsh.
15
votes
1answer
9k views

zsh with Cygwin

How can I configure zsh to be the default shell under Cygwin?
13
votes
5answers
15k views

How can I do a recursive find and replace from the command line?

Using a shell like bash or zshell, how can I do a recursive 'find and replace'? In other words, I want to replace every occurrence of 'foo' with 'bar' in all files in this directory and its ...
13
votes
9answers
3k views

Cygwin/Git Bizarre Terminal Issue

Alright, this is weird. First off, this is mintty running on up-to-date cygwin, with git pulled from cygwin's setup.exe. I am running zsh. $ git clone ...
13
votes
1answer
3k views

What are the differences between oh-my-zsh and prezto?

I understand both Oh-My-Zsh and Prezto are a collection of files meant to assist setting up your zsh (Z Shell) configuration. Could someone please explain what they're doing that is different to the ...
12
votes
2answers
4k views

Resume Zsh-Terminal (OS X Lion)

OS X Lion has "Resume" feature, i. e. when you reopen an app it restores all windows and their contents. That works for Terminal as well. But if you use Zsh instead of Bash it doesn't restore opened ...
12
votes
2answers
396 views

Is it possible to use different zsh menu selection behaviour for different commands?

I'm using the menu select behaviour in zsh, which invokes a menu below the cursor where you can see the various possibilities. The .zshrc option i have set for this is zstyle ':completion:*' menu ...
11
votes
4answers
7k views

how to format the path in a zsh prompt?

I would love to have a readable colored path. For example, instead of simply using %~ to return ~/path/to/foo I would like to format it to ~$RED/$NOCOLORpath$RED/$NOCOLORto$RED/$NOCOLORfoo to ...
11
votes
1answer
3k views

How to switch comfortably to vi command mode on the zsh command line?

In vi, I have mapped 'jj' to escape to be able to switch to command mode without using the annoying escape key. Now I want to have the same for command line editing for which I use vi-mode. I already ...
11
votes
1answer
1k views

How can I selectively disable zsh's version control integration when my CWD is on a remote filesystem?

I'm running zsh on OSX and on occasion I have to work on a mounted sshfs volume. However, git is REALLY slow over sshfs mounts. My prompt makes use of the vc mode stuff that zsh provides built in, but ...
10
votes
4answers
1k views

How is zsh pronounced?

How is zsh pronounced? Is it 'Zee - Shell', 'Zed - Shell' or is it said pronounced like it's written 'zsh'?
10
votes
1answer
1k views

ZSH only displaying last 16 or so commands with history. HISTSIZE & SAVEHIST are 500

In ZSH when I type history I'm only displayed the last 16 or so commands. I would like history to display all the existing commands in the history file. When I look in my .zsh_history (my history ...
10
votes
1answer
935 views

Binding Fn-Delete in zsh on Mac OS X

In zsh, whenever I press Fn+Delete (which is forward delete) a tilde (~) gets inserted. This indicates zsh doesn't have the key bound. How do I bind it, and make it behave normally (delete in front ...
9
votes
3answers
4k views

How can I do Ctrl-Z and bg in one keypress to make process continue in background?

So I realized I follow this pattern of suspending the task and then letting it to continue too often with the Ctrl-Z bg sequence, I was wondering is there any way to compress that to single keypress? ...
9
votes
1answer
2k views

Exceptions to zsh correctall feature?

I am using the correctall option in zsh, and I am generally quite happy with it. There are, however, few situations where I find this feature highly annoying. For example, lets say I have a file ...
9
votes
2answers
3k views

Tweaking zsh git autocompletion

I just switched from bash to using zsh 4.3.4 on Ubuntu Hardy. I'm developing with git and I find myself constantly fighting with the default git completions: filename completion tries to be smart by ...
9
votes
1answer
2k views

How to 'source' a shell script using bash from zsh?

I am using zsh and like it very much, but work a lot with Android source which has compilation scripts that require bash to be evaluated correctly. These scripts need to be sourced prior to ...
8
votes
3answers
2k views

Change the output format of zsh's time

I've just switched to zsh. However, I really don't like how the time builtin command also outputs the command that it's timing. I much prefer the bash style output. Anyone know how to switch it ...
8
votes
1answer
3k views

Command history in zsh

Currently I have zsh set up in such a way that command history is shared between all sessions immediately. Say I have a terminal emulator open with two tabs, each with a zsh session, A1 and A2. If I ...
8
votes
2answers
885 views

Can I use Vim editing mode on the command line without losing recursive history search?

I'm uzing zsh and, because I'm an avid Vim user, I just switched to using Vim-style editing on the command line. (That means if I type ls foo/bar and decide I want to cd instead, I can hit Esc ^ to ...
8
votes
2answers
2k views

zsh right-justify in ps1

I'd like a multi-line zsh prompt with a right alined part, that will look something like this: 2.nate@host:/current/dir 16:00 -> I know about ...
8
votes
2answers
374 views

oh-my-zsh turned on autopushd? How can I turn it off?

It appears that I have autopushd turned on (I know I didn't turn it on) and it is rather annoying because I prefer to pick and choose when to use the directory stack. How can I turn off autopushd? I ...
8
votes
8answers
616 views

Per-directory bash/zsh history log files

I find I do a lot of work on a project in a set directory. Sometimes — a few months down the track — I need to redo something on that project but I can't remember what I did. I use ...
8
votes
4answers
1k views

Using VIM keys in shell (zsh or bash)

I want to use vim editing keys in my shell (zsh). With bindkey -v i get VI keys, but i want visual and more advanced key shortcuts (like change inner word (ciw), which i use all the time) btw, is ...
7
votes
4answers
7k views

Parallel shell loops

I want to process many files and since I've here a bunch of cores I want to do it in parallel: for i in *.myfiles; do do_something $i `derived_params $i` other_params; done I know of a Makefile ...
7
votes
2answers
2k views

How can I make zsh's vi mode behave more like bash's vi mode?

I am really liking the general speed of zsh, but two things are annoying the heck out of me. I have to hit wait a moment between hitting escape and hitting slash to get to the history search (if it ...
7
votes
1answer
1k views

ZSH tab completion of git commands is very slow. How can I turn it off?

If I type: rm <TAB> I'll see possible completions almost instantly. However, if I type: git rm <TAB> It'll hang for several seconds if it's in a git repo, or fail to show any ...
7
votes
1answer
5k views

How can I configure the color of 'ls' directory under zsh

I am using 'zsh'. In some directory, when I do 'ls --color=tty'. I see some directories have 'blue text' with 'green background', which makes them hard to read. Can you please tell me how to ...
7
votes
1answer
1k views

How to prevent a command in the zshell from being saved into history?

In Bash I know putting a space before a command prevents it from being kept in the history, what is the equivalent for the zshell?
7
votes
1answer
1k views

ZSH - output whole history?

I recently switched from bash to zsh. In bash, one way (besides recursive search) that I used to find previously-run commands was history | grep whatever, where whatever is the bit of command I ...
7
votes
1answer
3k views

How can I put a newline in my zsh prompt without causing terminal redraw issues?

I'm trying to fix a minor (but annoying) issue with my zsh prompt. The problem I'm seeing is that when I'm using a terminal in a GUI OS environment (for example, Terminal.app or iTerm 2 on OS X ...
7
votes
2answers
583 views

Separate up arrow lookback for local and global ZSH history

Is it possible to... Step up local ZSH shell history (actions only happened in that prompt) Step up global ZSH history (shared history is on) - default what happens when you press UP arrow when ...
7
votes
2answers
683 views

reverse history search with regular expressions

I'm looking for a tool to allow reverse incremental searching with simple regular expression (or just multiple matches) support. For example, if I want to find the command 'foo bar baz', I could do ...
6
votes
2answers
1k views

Writing shell scripts that will run on any shell (using multiple shebang lines?)

I've just started getting deeper into shell scripting, and I've always just thrown my script in a file, marked it chmod +x and then done /path/to/script.sh and let whatever interpreter is the default ...
6
votes
1answer
1k views

how do I correctly negate zsh globbing expressions?

I want to list all files but those ending with owp: Hence I tried: ls -l *.(^owp) zsh: unknown sort specifier ls -l *(^owp) zsh: unknown sort specifier ls -l *[^o][^w][^p] # does not work ...
6
votes
2answers
982 views

zsh, up arrow only repeats unique commands?

I'm looking for a setting that will make it so that when i hit the up arrow, zsh shows commands i have recently edited. The catch is, i only want unique commands. Currently, if i type echo "hello ...