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

learn more… | top users | synonyms

3
votes
2answers
42 views

zsh - preview parent directory names when 'cd ../../../'

Anyone knows of a way to make zsh show me a preview of the parent directory I would be in if I hit return right now? For instance, if I'm very deep down a directory tree, and I start typing .... ...
14
votes
3answers
5k 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 ...
16
votes
3answers
3k views

zsh (z shell) numpad/numlock doesn't work

I just upgraded to zsh/oh-my-zsh. Almost immediately I notice on my machine that the 10-digit numpad is not working. It was working in bash and fish shell. Oddly, if I hold down the fn/function key ...
1
vote
1answer
50 views

tmux - get pwd of another pane in a bash script?

Is there anyway to find out information about the current working directory of any pane from within a tmux session? I'd like to write a bash script that changes the directory of the current pane to ...
3
votes
2answers
328 views

ZSH+gnome-terminal and VI input mode: Show ibeam or block cursor

Different methods exist to show if you're in insert or normal when using VI key binding in ZSH. Gnome-terminal also allows you to change the caret from block █ to ibeam | with a call to gconftool-2. ...
0
votes
0answers
25 views

Zsh compdef for apt-get install, or other 2 part commands

How can I use a compdef for zsh completion such that a custom written function uses a 2 part command for the completion? Example: my_function () { sudo apt-get install $@ } compdef ...
1
vote
1answer
54 views

.zshrc doesn't export variable for anaconda

I installed Anaconda Python on my Mac today and following line was added to .bash_profile by Anaconda. Since I am using zsh so I moved this line to .zshrc. However, it doesn't work properly even if I ...
9
votes
2answers
2k views

Bash autocomplete like zsh

I'm using bash, but I'd like to have zsh style autocomplete (you hit tab and it tabs through the possibilities), rather than what bash seems to do, which is display a list of possibilities but not ...
1
vote
5answers
1k views

zsh: automatically set environment variables for a directory

Let's say I have a project in: ~/working_dir Whenever I run commands from this directory, I need to have certain environment variables set. So I can export them like so: export VAR=value ...
0
votes
1answer
45 views

How to remove “No mail for user” notifications in Zsh?

Every time I open Zsh I get a “No mail for user” notification. How can I stop them?
1
vote
2answers
56 views

Should I ignore .bash_rc, .bash_profile etc if I'm using Zsh?

Zsh configs go into the ~/.zshrc file. That’s where I’ve been putting my aliases, etc… But I want to know if I should be ignoring .bash_profile and those other files, and putting everything into the ...
1
vote
2answers
69 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 ...
4
votes
2answers
1k views

What is the difference between .zshrc and .zshrc-e

I've recently switched to using zsh instead of bash and I installed both zsh and oh-my-zsh. while messing with my configuration I noticed that there is a file named ".zshrc-e" in addition to the ...
1
vote
1answer
28 views

Some characters in zsh don't show until the key is released

When inputting specific characters in zsh shell (in my case e and ;) they don't show up immediately after pressing the key. Instead they only show up a short time after releasing the key. When these ...
48
votes
5answers
18k 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?
1
vote
1answer
70 views

How to make zsh always show environment variable name instead of the path?

I have an environment variable set to my projects folder like this: PROJ=$HOME/projects When I want to open a project folder i just type PROJ/project_name and the shell opens the directory and my ...
56
votes
6answers
26k 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?
26
votes
4answers
7k 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 ...
16
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 ...
2
votes
4answers
4k views

Change the sudo su shell

Whenever I run sudo su from my normal zsh (which uses the oh-my-zsh framework), I'm forced to use the old Bourne shell (sh) by default (obviously; this is standard behaviour on most *nix-like ...
1
vote
1answer
23 views

How can echo the previous command I ran to a file?

I tried running echo '$(!!:p)' > /tmp/tmptxt.txt, however I just get $(!!:p). The previous command may have unescaped characters so I i need to escape it.
2
votes
2answers
237 views

How to delete old $PATH echo in Mac

After i changed my Mac username(using the way supplied by Apple Documents), I found that when echo $PATH, there are some old paths in it. ...
0
votes
0answers
27 views

Readline stops working randomly

For some reason every 1-3 hours (depending on work load) my shell read command stops accepting input and hitting return renders the ^M character. Something like: Continue? After answering: ...
12
votes
1answer
6k 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 ...
2
votes
2answers
57 views

Setting the variable $USERNAME has no effect

Setting the variable USERNAME has no effect. Accessing the variable always returns the current logged in user. james@localhost:~$ USERNAME=foo james@localhost:~$ echo $USERNAME james I could not ...
0
votes
2answers
24 views

Executing control statements in zsh?

This feels like a dumb question but I'm on a mac using iterm with zsh and I've been reading the zsh manual and am trying to execute ^Xh to query the completion parameters, but whenever I do ls ^Xh ...
2
votes
2answers
87 views

How do I signify repetition in a ZMV regex?

I'm trying to manually pull the digests off of Rails assets (don't ask). I was directed to ZMV for easy regex-based find/replace. But the normal {32} syntax for specifying an amount of repetition does ...
0
votes
1answer
55 views

How to create a command shortcut in BASH or ZSHRC shells?

I know how to create an alias or a PATH however those are both used to navigate folders. How would you create a shortcut to say quickly type the following commands every time? alog = tail -f ...
0
votes
1answer
21 views

Get word at cursor in zsh function

I'm trying to set up some fancy zle completion that requires passing the word at point to a subprocess. Zsh obviously knows about the current word/token/directory, and I can see how to bind things ...
1
vote
2answers
55 views

ZSH PS1 adding spacing when tabbing

I'm having an issue with zsh/oh-my-zsh with my custom PS1 prompt (that I brought across from bash). When I use the built-in zsh/oh-my-zsh prompt and tab for auto-completion, this works as expected. ...
0
votes
1answer
93 views

zsh completion for all executables in path

I have written a script which itself takes as an argument any arbitrary executable in my $PATH. Is there a way to create a zsh (or bash) completion function such that I would be able to type myFunc ...
2
votes
2answers
205 views

Set urxvt shell without chsh?

I want to use bash as my default shell (so that it's simpler in tty) but I want to use zsh when I'm in X using urxvt. Is there a way to do this?
0
votes
2answers
1k views

Share history in multiple zsh shell

I am trying to setup zsh so that it shares command history between different zsh sessions: in multiple tabs in multiple gnome-terminals in different screen sessions I have put this in .zshrc #To ...
1
vote
1answer
460 views

How do I get the aws cli completion to work with zsh on ubuntu?

I installed aws console cli following the instructions here: http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-set-up.html#install-bundle-other-os I want to get completion working ...
1
vote
1answer
42 views

Execute a program in tmux without scrolling

I use tmux (with zsh, if that helps). I have a pretty good setup, but often I find myself running a program with a lot of output, and then entering copy mode and reverse searching for the line I typed ...
0
votes
1answer
30 views

Stop `exit` from running

When I run terminal within Pathfinder, typing exit is just a mistake (blocks the Window for nothing). How may I Figure out I'm in Pathfinder Suppress exit in Zshell if I am in Pathfinder?
0
votes
1answer
228 views

Running .bat file in zsh (in Windows)

On a Windows machine I want to avoid using cmd.exe at all cost. I'm trying to use babun (mintty 1.1.3) to run a batch file in a Windows folder. This works: { ~ } » ./file.bat -o /path/to/files.xml ...
2
votes
0answers
25 views

zsh complete cd with two arguments

Context for those who know about zsh completion but not all its features: One of the unique and really useful features of zsh is as follows: [/usr/dir1/dir2/dir3/]$ cd dir1 dirnew ...
2
votes
1answer
26 views

How can I swap patterns in filenames?

I have a folder of files with names like thing.y.big.png thing.y.small.png thing.xxx.big.png thing.xxx.small.png and I would like to rename them so that the 2nd and 3rd "fields" are swapped. In the ...
1
vote
2answers
103 views

Is there a way to have sh/bash/zsh “case” use a variable for a test value?

I'd like to have something like the following: #!/bin/sh # ... other stuff ... # some relatively static possibilities (srsp): srsp='this|or|that|the|other' # more other stuff case $something in ...
1
vote
2answers
1k views

rename file with zmv

I just discovered zmv this morning. To test it i have created a few files. test1.txt test2.txt test3.txt I'm trying to rename them with zmv I'd like to get this output: test-1.txt test-2.txt ...
0
votes
0answers
20 views

How to match zsh full history when reverse searching?

I wanted to execute a command from a couple of days ago so I used ctrl-R to search for it. I could only see very recent entries. I checked the history file for the command and it was there, several ...
1
vote
1answer
22 views

zsh: set option for a single command

Can I set a zsh option (like extendedglob) for a single command? Something like: setopt extendedglob param="${foo%%[0-9]##}" With the command used above, I believe enclosing in () would not be a ...
0
votes
1answer
73 views

Can't find executable (pipsi) in my PATH even though my PATH is set correctly and permissions are also correct in ZSH

I have just installed pipsi. I'm on Mac OS X Yosemite and I'm using iTerm and running zsh via oh-my-zsh. My problem is that I get the following: ~ >>> pipsi zsh: command not found: pipsi ...
11
votes
1answer
2k 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 ...
0
votes
1answer
96 views

How to delete all files in the folder which exists in the tar.gz archive

Typical mistake for me, is exctraction in the wrong directory. After i realize that, i want to delete all this file, and extract again. But how to automate this delete-all-this-crap operation? Any ...
1
vote
2answers
102 views

Iterating over inline array in zsh

I'm trying to figure out how to do a command to multiple items. For example: mycommmand fileA; mycommand fileB; mycommand fileC; I can do it like this: files=(fileA fileB fileC) for fl in $files; ...
0
votes
1answer
35 views

Zsh prompt's history number sometimes increments after ignored commands

When displaying the history number of the next command in zsh's prompt (I'm on version 5.0.2), it is unexpectedly incremented after ignored histignorespace and histnostore commands (and then only ...
0
votes
2answers
56 views

PHPStorm Built in Terminal - How do I backspace words?

I love PHPStorm's built in terminal, all my zsh aliases work properly and it's super convenient. The only thing it's missing is the ability to backspace by words (like I can in OSX's default ...
0
votes
1answer
30 views

zsh: Ubuntu like prompt for helping installing software

I run xubuntu and am switching from bash to zsh as the default shell. It works great - only thing I miss from the bash days is this: when I execute a command which isn't installed, bash would tell me ...