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

learn more… | top users | synonyms

1
vote
1answer
32 views

What is the ZSH equivalent of 'expr'?

The expr utility evaluates an expression and writes the result on standard output. What is the canonical ZSH way to evaluate an expression, and print the result? Solution: I believe the answer is ...
1
vote
2answers
260 views

zsh completion doesn't work under Cygwin for other drives

I'm on Win7 x64, Cygwin 1.7 and zsh (and using oh-my-zsh). Zsh newbie here. I've reviewed zsh autocompletion not working on cygwin and tried the solution there but no luck. My mount table: C: on ...
4
votes
3answers
1k views

Using wildcards in commands with zsh

Using commands such as rsync and scp with ZSH I've run into trouble. Instead of the (normal) behaviour of giving me all matching files, it won't run and returns: ➜ ~ rsync -azP user@server:~/* ~/ ...
4
votes
2answers
263 views

How to bind command key in zsh?

It is possible to bind Command Key from mac os x in zsh? I can't find any information about that.
2
votes
1answer
44 views

ZSH: Is it possible to get file completion to display results in a case-sensitive order?

Here's an example of what I mean: In my home dir, I have three directories starting with "work": $ ls | grep ork WorkProjects workspace workspacepython Notice that "WorkProjects" starts with a ...
0
votes
0answers
72 views

How to restore my iterm2/zsh session after restart?

I use oh-my-zsh with iTerm2 on osx and I'd like them to retain the same tabs with the same directories and hopefully the same textual history after a restart. Currently after a restart iTerm reopens ...
4
votes
3answers
844 views

Pipe to grep not working in zsh

I am doing something I always do in Bash: set | grep -i path and the output is Binary file (standard input) matches What's wrong? grep --help works, and set | more works too.
0
votes
2answers
41 views

Zsh: how to auto complete after a command?

everyone. It's a little difficult to explain what I want to do. I want to create a script 'example', which can input long commands for you after you run it with short parameters. For example, $ ...
2
votes
1answer
143 views

What's the ZSH equivalent of BASH's $PROMPT_COMMAND?

BASH supports a $PROMPT_COMMAND environment variable that defines a command to be executed before any first-level interactive prompt. I'm looking for a ZSH equilvalent of that. The documentation says ...
3
votes
1answer
168 views

Iterating over keys (or k/v pairs) in zsh associative array?

In zsh, I want to iterate over an associative array. I need both keys and values. But when I iterate over the associative array normally (for x in $assoc_array), I get only values. All examples ...
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 ...
2
votes
1answer
70 views

zsh tab completion to run scripts in current folder (.<TAB>scr<TAB>)->./script.sh

I have an issue with zsh (or oh-my-zsh): When I want to run a script in current directory, I do ./script.sh. In bash I could do .<TAB> and it would give me ./ where I could continue typing the ...
1
vote
0answers
58 views

OSX Mavericks .zshrc cannot source

I am trying to source my zshrc. It sources fine when before I add this line: . ~/Dropbox/configs/aliases Then I get this: /Users/mkrell/.zshrc:.:13: too many open files: Dropbox/configs/aliases ...
0
votes
2answers
74 views

Parse Git Branch Stopped Working (OSX)

I use a method called parse_git_branch which is called by my PROMPT. I'm using zshell, but I don't understand why this would stop working. Here's the function: parse_git_branch() { ...
0
votes
2answers
76 views

git using different version of vim than zsh

I've got a plugin called YouCompleteMe installed in vim. When vim starts with this plugin installed, it will raise a warning if the version of vim is under the minimum required. I'm using vim ...
0
votes
1answer
32 views

mdfind -onlyin not working in hidden directories recursvily? How to use it properly?

I am trying to find all files named doc.py in one of my virtualevns (called data_science), which are all in hidden directory .virtualenvs under /Users/adni and so I go: mdfind -onlyin data_science ...
2
votes
1answer
180 views

Redirect stdout/stderr of a background job from console to a log file?

I just run a job (assume foo.sh). ./foo.sh [Press Ctrl-Z to stop] bg # enter background And it generate output to stdout and stderr. Is there any method to redirect to stdout and stderr to other ...
4
votes
1answer
29 views

ZSH autolearn completition plugin

Is there something like "autolearn" command/plugin for zsh? By this I mean when I type command option option1 ... and zsh don't know about options for this particular command I want zsh to remember ...
2
votes
2answers
167 views

Key bindings in zshrc do not take any effect

I have just switched to zsh, and I would like to bind Home, End and Delete keys such that they would act similar to how they do in bash. I have found some commands that work if I enter them directly ...
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?
3
votes
3answers
52 views

Can I cycle through the history of shell commands that have only been used from current directory?

So when using arrow up/down to cycle through prior commands, is there any way I can limit those to the commands used from the current directory? This would make my life 10 times easier...
0
votes
2answers
31 views

the same tr translate failed on some of machine

I use the following code and failed. $ echo $TERM xtermc $ v=/bin:/usr/bin:/usr/local/bin ; echo $v | tr ':' '\n' /binn/usr/binn/usr/local/bin It seems skip my '/'. I don't know how to solve this. ...
0
votes
1answer
18 views

Disable automatic capitalisation of git checkout BRANCH_NAME in ZSH/oh-my-zsh

I'm using zsh 5.0.2 with oh-my-zsh plugin and whenever I do tab completion on git checkout f it comes out as: git checkout Feature\ For some reason it's automatically searching uppercase branch ...
2
votes
2answers
75 views

env -i zsh | How is this magic possible?

I'm currently working, for school, on a home-made shell, therefore I'm kind of curious nowadays about how shell vars are set. Yes, this can be really exciting ! Anyway, we obviously have to deal with ...
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 ...
6
votes
3answers
457 views

Removing the useless space at the end of the right prompt of zsh ($RPROMPT)

In zsh, there is always a space character at the right of my right prompt. I tried with a very simple .zshrc such as: PROMPT="#" RPROMPT="*" There is a always a space after the * on the right of ...
1
vote
3answers
654 views

After switching back to bash can't access root

I'm new to Linux and using Debian 7. I was using bash, but tried out zsh by using chsh. Initially probably entered a bad shell name but eventually switched to zsh successfully. Now I switched back to ...
3
votes
2answers
403 views

How to search *upwards* for file? (reverse find)

I'd like to search "upwards" for a file in shell script, e.g. check $PWD, then $PWD/.., then $PWD/../.., etc. until hitting the root. Before I go and roll my own, is there some builtin bash/zsh/find ...
4
votes
1answer
194 views

Emacs key for Home & End

I'm running Emacs in urxvt with zsh as shell: ~ % echo $TERM && echo $SHELL rxvt-256color /bin/zsh ~ % My current problem is that I can't get Home key & End key working properly in ...
1
vote
1answer
26 views

Is there a syntax in ZSH for creating multiple aliases at once?

I.e., if I'd like to alias both proxychains & prch to proxychains4, is there something equivalent to this?: alias prch='proxychains'='proxychains4'
1
vote
2answers
19 views

ZSH browse content of zip file

Is there any way or plugin for zsh where I can browse content of zip files in place instead of unzipping zip file and than making zip again? I want to achieve same behavior as in Midnight Commander ...
0
votes
0answers
22 views

ZSH and Passwordless access with SSH in a shared home environment

I have a small cluster with some nodes which share their home folder through NFS. I allow passwordless SSH access to the users with this script: if [[ -e $homeDirs/$username/.ssh/id_rsa.pub ]]; then ...
4
votes
1answer
18 views

zsh warning before executing file

I frequently find myself accidentally running python files as shell scripts, e.g. $ ./test.py This has potential to cause lots of damage if there was no shebang line at the start of the file, so I ...
1
vote
2answers
40 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 ...
0
votes
1answer
20 views

zsh how to backspace through quotes

How can I backspace and move through quotes in zsh? Pressing left or backspace does nothing at the start of the quote after I hit enter after typing ': $ echo ' quote> The ...
0
votes
1answer
93 views

zsh (or maybe oh-my-zsh) history gets confused with multi-line commands

if I use the up arrow in a zsh session, as you'd expect I get previous commands, from newest to oldest. Now (whether it's zsh or oh-my-zsh doing this I don't know), but if I type the start of a line ...
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 ...
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 ...
1
vote
1answer
91 views

How can I call multiple commands as arguments to a function?

I want to write a "forever" function that I can run multiple commands until I manually kill it with Ctrl-C. Basically, from the zsh command line, I know I can do this, and this works fine: $ while {} ...
1
vote
1answer
323 views

Searching through history with up and down arrow in zsh

When I first switched to ZSH when I would use the up arrow key to move through history it would filter the history based on what I had already typed so if I type mysql and then up I would be stepping ...
5
votes
2answers
380 views

bash wildcard completion

Is it possible to make bash expand wildcards on tab completion in the same style as zsh? So imagine the following: mkdir new touch new/1.txt new/2.txt new/3.log Now, ls new/*.txt<TAB> ...
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 ...
2
votes
1answer
61 views

Binding caps lock to escape in z-shell

I want to rebind the Caps Lock to escape in z-shell to make better use of the vi-mode in the z-shell line editor. I don't want to rebind it for the entire system. Is this possible? (if that matters, ...
0
votes
1answer
103 views

ZSH: Where to place environment variable so that launched application can pick it up?

I need an environment variable KEY="value" made available to a GUI application before starting it. The launcher file (the one that places the icon on the desktop and sidebar in Ubuntu) has a value of ...
1
vote
2answers
107 views

Zsh not recognizing ls colors

I just was introduced to Zsh and so far I am really liking the customizability. I use the following line to set up colors in .zshrc: zstyle ':completion:*' list-colors '' This gives me these ...
0
votes
0answers
32 views

Zsh prompt produces an error

I have the default prompt for oh-my-zsh, which is great when I have a git repo, but if there is no git repo its actually failing instead of putting nothing. I trapped an ascii image to err just for ...
2
votes
2answers
41 views

Locating the source of a function in zsh

I have this annoying issue in my zsh shell where a function is being declared somewhere and that function is named "cp" so it's overriding the normal cp behavior. I'm trying to locate the function ...
0
votes
1answer
55 views

zsh function cannot be used in tmux

I wrote up a special function to wrap a command, in ZSH, so it doesn't output any warnings and runs the process in my background. This command works great without tmux, but when I try to use it in a ...
1
vote
1answer
114 views

Why does my zsh prompt wander upwards when window is too narrow?

I have a weird behaviour that seems to be a combination of zsh and maybe urxvt (?) My setup is this: I start urxvt -e 'tmux' to get myself a terminal which launches zsh as the default shell. I then ...
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!