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

learn more… | top users | synonyms

36
votes
5answers
23k 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?
18
votes
4answers
8k 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 from)...
17
votes
3answers
7k views

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

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? My shell is ...
27
votes
6answers
8k 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
3answers
11k 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
2answers
5k 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 ...
31
votes
9answers
11k views

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.
16
votes
3answers
2k 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 ...
41
votes
7answers
44k 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 ...
5
votes
2answers
902 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 ...
9
votes
1answer
2k views

Zsh says “no matches found” when trying to download video with youtube-dl

I downloaded youtube-dl using pip on CrunchBang (a Debian Wheezy distro). When I run youtube-dl {video URL} I get zsh: no matches found: {video URL} I guess it has something to do with zsh, ...
1
vote
2answers
301 views

How to make Zsh not store failed command

Problem I'm using oh-my-zsh and Antigen to manage my Zsh. Sometimes I will accidentally enter a wrong/failed command into Zsh and it is very annoying when the zsh-autosuggestions plugin throws up ...
17
votes
1answer
2k 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 ...
12
votes
2answers
4k 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
1answer
3k 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
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 ...
61
votes
5answers
28k 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?
46
votes
8answers
19k 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 ...
38
votes
3answers
11k 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 ...
33
votes
2answers
9k 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 ...
22
votes
1answer
6k 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 ':...
9
votes
3answers
33k 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, ...
9
votes
2answers
4k 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 ...
6
votes
1answer
3k 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?
5
votes
4answers
3k views

ALT+arrow moving between words in zsh and iTerm2

I logged in on one of hosting provider servers and noticed ALT + left and ALT + right moved between words in a shell prompt in GNU Screen. What kind of key bindings I need to configure and where to ...
10
votes
1answer
3k 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 ...
3
votes
1answer
2k 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, ...
16
votes
3answers
9k 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
9
votes
1answer
19k 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 ...
3
votes
2answers
7k views

change default shell from zsh to bash

I'm trying to change my default shell in RHEL5 from zsh to bash. I tried to the methods mentioned in this thead. By typing sudo /usr/bin/chsh -s /bin/bash, the system says sudo: /usr/bin/chsh: ...
12
votes
4answers
3k views

How is zsh pronounced? [closed]

How is zsh pronounced? Is it 'Zee - Shell', 'Zed - Shell' or is it said pronounced like it's written 'zsh'?
4
votes
2answers
897 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 ...
2
votes
2answers
2k 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 PATH=/usr/local/...
5
votes
2answers
656 views

How can zsh be configured to autocomplete directory name with camelcase matching?

Eclipse and Resharper have a nice way of navigating files. If I have the following folders (or files) in my current directory MyReallyLongName MyReallyLongAndFunName MyReallyLongAndNotReallyFunName ...
5
votes
2answers
237 views

Escape not idempotent in zsh's vi emulation?

I have zsh configured to use vi keybindings. I've noticed some unexpected behavior with "escape". In vim (I haven't tested vanilla vi) if I hit escape twice, I can hit 'i' once to return to insert ...
3
votes
2answers
839 views

Why is my $PATH different in the executed script?

echo $PATH inside gnome terminal: /home/pc/less.js/bin:/home/pc/local/bin:/home/pc/local/bin:/home/pc/.rvm/gems/ruby-1.9.2-head/bin:/home/pc/.rvm/gems/ruby-1.9.2-head@global/bin:/home/pc/.rvm/...
2
votes
1answer
535 views

Invoke zsh, then *source* another file (while entering interactive mode)

This question is of course related, but different to the one about executing a command. That questions’ solutions involve either starting a subshell – which isn’t possible due to the requirement of ...
2
votes
1answer
1k 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, ...
2
votes
1answer
57 views

Why does `zsh` insert a `~` when I press the delete key?

I have set my zsh to use vim style for editing command lines. However, when I use the Delete key, it inserts a ~ character. Have I misconfigured my zsh? How do I turn this off? Do I need to go ...
5
votes
3answers
4k 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 ...
5
votes
1answer
1k 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 ...
4
votes
2answers
1k 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 ...
3
votes
3answers
390 views

In ZSH line editor, how to insert a new line?

Say I am editing a single line, with my cursor at the indicated position: $ abc ꕯ def ghi I would now like to split into two lines and continue editing (like hitting ENTER would do in a text editor)...
3
votes
1answer
1k views

zsh - variable assignment isn't working

I have this line in a function I'm adapting from a bash function into zsh function: local info=( $(command df -P $fs | awk 'END{ print $2,$3,$5 }') ) Whenever I call it in the func I get this: ...
3
votes
2answers
402 views

PATH set before /etc/zshenv

I am trying to find which file adds /opt/texbin folder to my PATH variable on Ubuntu. It is not present in my /etc/environment file. sudo grep -lr texbin . 2>/dev/null outputs nothing in the /etc ...
2
votes
1answer
2k 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: http://www.rayninfo....
2
votes
1answer
958 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
159 views

Is administrator account necessary in order to use shells such as zsh and fish?

I have a weird situation. I’m using Mac OS X 10.11 (El Capitan) and iTerm2. Zsh is listed by default in /etc/shells as /bin/zsh, and this allows me to use Zsh without any issues on my standard ...
2
votes
1answer
942 views

How do I get zsh's autocomplete to complete wildcards like bash does?

In zsh and in bash, if I type ls c<TAB> it displays every filename starting with c. If instead I type ls c*<TAB>, bash behaves the same way, but zsh replaces the c* with the list of every ...
1
vote
2answers
197 views

OS X El Capitan 10.11 Terminal 2.6 won't open new tabs with same working directory

I am using the default settings for Terminal, but when I create a new tab my working directory is always set to my home folder instead of the current working directory of the previous tab. Here's an ...