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

learn more… | top users | synonyms

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 ...
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!
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?
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 ...
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.
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 ...
7
votes
2answers
590 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 ...
5
votes
2answers
604 views

Access Finder's “Open With” menu from the commandline (for tab completion)

On Mac OS X, I know one can open a file from the commandline with its default application with open, and with other applications with open -a <application name>. Thus, open movie.avi open -a ...
10
votes
1answer
936 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 ...
5
votes
3answers
2k views

Problem with Ctrl-Left/Right bindings in oh-my-zsh

For some reason I am unable to bind Ctrl-Left Arrow and Ctrl-Right Arrow to move between words in ZSH after installing oh-my-zsh on my MacBook Pro. In iTerm2 I have my keybindings configured to "Send ...
3
votes
1answer
1k views

How do I change my default shell on a remote server?

I tried changing it the way recommended in How do i change my default shell from bash to zsh?, as shown below: chsh -s $(which zsh) but that gave me an error. The system asks me to use ypchsh ...
1
vote
1answer
62 views

Zsh not recognizing file changes with search path

I'm using ZShell with Oh-My-Zsh on OS X 10.8. Updates within my search path aren't immediately recognized. My search path: [~]$ echo $PATH ...
1
vote
1answer
121 views

put in bash or zsh history absolute path to files I working on

I have found that in bash i frequently use something like that: vim ./somefile1 less less ./dir1/dir2/somefile2 cp some_other_relative_path_to_file and so on After that when I trying to find a ...
1
vote
2answers
2k views

On OS X, how do I start Cocoa emacs *and* bring it to front?

I wrote a little zsh function to allow me to run emacs from the command-line: function emacs() { /Applications/Emacs.app/Contents/MacOS/Emacs $@ & } This works perfectly, but it seems to ...
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?
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 ...
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 ...
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 ...
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 ...
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
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.
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 ...
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 ...
5
votes
1answer
2k views

Where is my zsh getting its git completion settings?

My zsh does git completion, but I did not configure this myself. How can I figure out where these settings are coming from?
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 ...
5
votes
3answers
16k views

How to delete files on the command line with regular expressions?

Lets say I have 20 files named FOOXX, where XX is the number of the file, eg 01, 02 etc. At the moment, if I want to delete all files lower than the number 10, this is easy and I just use a wildcard, ...
3
votes
1answer
1k views

zsh cdpath and autocompletion

My CDPATH in zsh looks like this: export CDPATH='.:..:../..' Unfortunately, this means that when I try to autocomplete after typing 'cd ', there're way too many irrelevant autocomplete options, ...
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? ...
2
votes
3answers
1k views

ALT+arrow moving between words in ZSH and iTerm 2

I logged in on one of hosting provider servers and noticed ALT + left and ALT + right moved between words in a shell prompt in a screen. What kind of key bindings I need to configure and where to get ...
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 ...
5
votes
4answers
944 views

How to rename a file inside a folder using a shell command?

I have a file at some/long/path/to/file/myfiel.txt. I want to rename it to some/long/path/to/file/myfile.txt. Currently I do it by mv some/long/path/to/file/myfiel.txt ...
4
votes
2answers
649 views

Strange zsh autocomplete behaviour

Every time I use tab autocompletion with zsh instead of completing the current string, it gives me a new string + options to complete. It's hard to explane, so here is an example. This is what would ...
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'?
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 ...
2
votes
1answer
590 views

Why does grep return no results (list all files in directory)

I'm trying to count all files in a directory that match a pattern, recursively, using ls: ls -R | grep *.{cpp,h} | wc However, I get: zsh: no matches found: *.cpp ls -R does return results, ...
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 ...
4
votes
3answers
2k views

Get Function Into PS1 (Zsh)?

This works in Bash (parse_git_branch is a defined function) export PS1="\$(parse_git_branch)" but I cannot figure out the equivalent in zsh. Note: If I do PROMPT="$(parse_git_branch)" it seems ...
3
votes
3answers
2k views

scp with zsh : no matches found

when I try scp over zsh, I get scp hostA:Descargas/debian-6.0.4-* user@192.168.1.154:Escritorio/Software/ zsh: no matches found: hostA:Descargas/debian-6.0.4-* the same command work in bash
2
votes
3answers
224 views

How do you set alias sudo='nocorrect sudo ' correctly?

Until Recently I had alias sudo='sudo ' in my .zshrc file. Today I ran into this error on trying to do sudo mv: ➜ ~ sudo mv nginx.conf.orig nginx.conf.orig2 sudo: nocorrect: command not found Now ...
2
votes
1answer
16 views

How to disable the confirmation of history expansions like `!!`

Zsh takes real good care of me, and at times it can get a bit too much. One of the times where I'd rather have it stay out of my business is when it "wants to make sure I want to execute the given ...
2
votes
1answer
504 views

zsh autocompletion not working on cygwin

I am on win7 64b, with cywgin 1.7. I have added zsh shell to the installation. If I start a shell like with bash: bash --login -i autocompletion works fine straight away. But if I start a zsh: ...
2
votes
1answer
666 views

using custom command from old .inputrc in zsh?

I used to have this in my .inputrc when I used bash but it doesn't work in ZSH because ZSH doesn't read the .inputrc (AFAIK): $if Bash # Meta+O can be made to load the previous # command and ...
1
vote
1answer
379 views

Mac OSX Mavericks - ZSH can't 'source ~/.zshrc', too many open files

I can't source any changes to my .zshrc (or my .bash_profile for that matter), because I get this error when I try: /Users/ME/.zshrc:source:100: too many open files: /Users/ME/.zshrc I've tried ...
1
vote
1answer
791 views

How do I use sudo with alias in zsh?

Say I have these two in my .zshrc: alias sudo='nocorrect sudo' alias boot27='grub-reboot 4 && reboot' boot27 gives boot27: command not found. If I change the alias to 'nocorrect sudo ' ...
1
vote
1answer
421 views

How can I list directories first in the terminal with zsh / ls command in Mac OSX?

Most of the similar questions / answers here don't work in Mac/OSX because there is not such a thing as --options. I am using the ZSH shell, I've been trying commands said here: ...
1
vote
3answers
168 views

Piping file to a command that doesn't implement piping

$ cat foo foo bar Now if I do: $ some_program foo It's working. But if I try: $ cat foo | some_program It's not working. I'm looking for a clean way to pipe input to some_program without ...
1
vote
1answer
197 views

Repeat last command matching “two words” zsh

I want to repeat the last command that matches foo bar. Using !! doesn't work (it's not the last command I used), and neither does !foo, because my history looks something like foo bar dee zep foo ...
1
vote
2answers
1k views

Load RVM environment in Screen and ZSH

This topic has been driving me nuts for a while now, and I'd like to be able to figure out what's going wrong. I use zsh with screen in my terminal, and have been for a while. However, for whatever ...
0
votes
2answers
1k views

How to check what slows down my terminal startup?

Is there a way to check what slows down my terminal startup? I'm using zsh with ohmyzsh on iTerm2. It takes about 10 second to open a new window :( This is my zshrc file: export ...
0
votes
2answers
603 views

^C not working in zsh on Mac OSX

Ctrl-C stopped working for me at the terminal when using zsh (on mac osx). I didn't notice the exact moment that it happend so I can't be sure what caused it. I didd't update zsh in a while though. ...