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

learn more… | top users | synonyms

1
vote
1answer
10 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
17 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
1answer
15 views

Running .bat file in zsh (in Windows)

In 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 ...
1
vote
0answers
11 views

Can one read input into a element of a associative array? [migrated]

I want to use read to put data into a particular element of an associative array, so I wrote the following: typeset -Ag aa aa[key]='initial value' ... read aa[key] which produces an error: no ...
0
votes
0answers
7 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
6 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
23 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
15 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 ...
23
votes
4answers
12k 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?
0
votes
0answers
8 views

Zsh - dnf autocompletion

Since Fedora will use dnf as default package manager in its next release, is there available autocompletion for zsh/oh-my-zsh/zpretzo? If not, is there somebody willing to do it? :D
1
vote
2answers
14 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
25 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
17 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
18 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 ...
1
vote
1answer
42 views

oh-my-zsh (terminal) how to change prefix & suffix of new prompt window

Installed on my Mac running Yosemite is a few packages to make life in the terminal (iTerm 2) a bit better. I have oh-my-zsh (only plugin I have id antigen for oh-my-zsh) along with oh-my-git ...
0
votes
1answer
15 views

Zsh alias complex string quote escaping

I am trying to define an alias (alias gsl="...") for the following command, but can't get the escaped quotes right. git stash list | awk -F: '{ print "\n\n\n\n"; print $0; print "\n\n"; system("git ...
1
vote
1answer
14 views

How to see old history in zsh

I am using zsh with Prezto, my question is why I only see a limit number of my history: ~ >>> history2651 git checkout -- modules/prompt/functions/prompt_sorin_setup 2652 git diff ...
0
votes
1answer
18 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 ...
0
votes
1answer
25 views

How can I make shell autocomplete the beginning of a filepath?

I have a project with a deeply nested folder structure. Most of the time I know the name of the file I want to work with, but the folder path is too long/complicated to type when I want to edit it, ...
0
votes
0answers
13 views

Can't use numbers and similar keys (0-9, -, etc.) in zsh without pressing fn?

Running zsh on a macbook air. Everything used to work normally until this morning - I don't even think zsh updated or anything like that. I can't type numbers, -, ., or / without holding fn. It does ...
0
votes
1answer
69 views

iTerm/zsh not reading .bashrc OR .bash_profile

In ~/.bash_profile I have : if [ -f ~/.bashrc ]; then source ~/.bashrc fi In ~/.bashrc I have some aliases When I load a new iTerm window, my aliases do not work. If I source ~/.bashrc they ...
0
votes
0answers
15 views

Is it possible to reuse functions I defined in .bashrc from zsh?

I am using bash on my Mac and I spent a lot of time customising functions in there. One things stops me from adopting zsh fully on Mac: I am not that proficient in zsh so I am pretty sure I can ...
1
vote
1answer
507 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: ...
1
vote
2answers
2k views

iTerm2 zsh oh-my-zsh open tab with same directory

Hi i just installed iTerm2 and tried to open a tab with the same directory as the tab that open it. I tried Zsh: Open a new tab in the same directory answer but still can't get the directory ...
2
votes
1answer
13 views

Zsh auto completion from man page

I noticed that fish has a feature to auto update auto completion scripts from man page. Does zsh have a similar script to do this?
0
votes
1answer
13 views

Alias options in zsh

When using the zsh alias command, what does the -s flag do (for example, lines 83-87 of oh-my-zsh's common-alias plugin?
0
votes
0answers
32 views

How to change default shell for a network user?

I am working with Ubuntu and I would like to change my default shell to z shell. I cannot use the chsh -s /bin/zsh or chsh-s /bin/sh myuser command since my user name does not exist in /etc/passwd and ...
1
vote
2answers
182 views

How to copy all the files from a folder but the symlink

I'd like to copy everything recursively from a folder but the files symlinked from an other directory, how can I achieve that?
0
votes
1answer
26 views

Is it possible to 'source' the output of a python script

I have a large python codebase that knows a lot about my working environment. I would like to use it to set up my ZSH session when i open a terminal window. The python script would output text that ...
0
votes
1answer
30 views

how to migrate bash prompt \#/\! to zsh

My bash prompt currently starts with the following variables : \#/\! which means \# The command number of this command. \! The history number of this command. So \# is specific to each ...
5
votes
1answer
2k views

Better way to read a line of user input in zsh? (e.g. with zle?)

Zsh's read for some reason is echo'ing ^M's instead of accepting them as <Enter> keystrokes. (If -d is set, then they are recognized as <Enter>'s, but still echoed.) It also doesn't ...
0
votes
1answer
70 views

Cannot copy from Vim under Tmux into clipboard using "+p on Ubuntu

I'm using zsh, tmux, and Vim and for some reasons recently, I've noticed I cannot copy from Vim to X clipboard under tmux using "+y. Any idea how I can troubleshoot this issue? It used to work before. ...
2
votes
1answer
86 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. ...
6
votes
1answer
304 views

Why are some (often long) commands garbled in bash & zsh?

Many times when I enter a long command in bash or zsh (these are the only two shells I am positive I have seen this in) the cursor warps to somewhere in the middle of the string I am entering, can ...
1
vote
1answer
51 views

Screen window title using zsh

I would like to make vim screen tabs name more useful. I've turned on the screen plugin, and tried several approachs. One that I would enjoy most was to make the screen name fixed using another load ...
2
votes
2answers
52 views

Rename selfdefined function

Having a precmd() that does quite a lot, like checking for VCS information, I want to disable it when I'm navigating on slow mounted network drives. I came up with the following with which I can say ...
3
votes
1answer
24 views

reload all running zsh instances

I typically have on the order of a dozen zsh processes running. When I edit my config files, I'd like a clean way to get them all to re-initialize. Ideally, this would not mean completely killing them ...
2
votes
1answer
73 views

Set timeout on zsh autocompletion

I like ZSH's autocompletion feature, but often it hangs my terminal. I'd like to set timeout on autocompletion so it cancels (kills) itself after n miliseconds.
0
votes
1answer
24 views

Bash: immediately disown job after it is started (Bash inbuilt equivalent of Z Shell's &!)

Is there a Bash equivalent of Z Shell's &! (or &|), i.e., immediately disown a job after it is started? I looked in Bash Reference Manual and searched in Google but can't seem to find anything ...
34
votes
7answers
11k 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 ...
4
votes
1answer
616 views

How can I get zsh to display international characters properly?

I just started using zsh, and love it. However, I've stumbled upon an annoyance when it comes to international characters: ➜ ~ touch åäö.txt ➜ ~ ls ...
0
votes
1answer
7 views

Zsh backward-delete-word does not recognize “/” character

I want ctrl-W on Zsh to stop when it encounters the "/" character. I have the following in my .zshrc file, but it doesn't stop on "/". What is going on? default-backward-delete-word () { local ...
2
votes
1answer
190 views

Is there a way to print out execution time (wall time) in zsh when it exceeds certain configurable threshold?

@mpy 's comment was correct. So I'm rephrasing my question. I really like REPORTTIME feature in zsh, but it only reports time when user+system time is greater than $REPORTTIME according to zsh doc. Is ...
1
vote
3answers
835 views

How do I set the Android bash path in ZSH?

Looking through the Cordova Android docs, I see this line You need to add the path to your Android SDK platform-tools and tools directory. In my example I will use ...
0
votes
2answers
74 views

How to draw a line between commands in zsh shell

Does anyone know how to draw lines in between the commands in zsh? Here is an example with MobaXterm:
1
vote
1answer
20 views

Start zsh with a prompt specified on the command line

Is it possible to start an interactive zsh session with a specific prompt without modifying a configuration file? I tried things like that: zsh -c 'autoload -U prompt; prompt adam1; zsh -i' But ...
0
votes
1answer
12 views

On MacOS setting zsh as shell using chsh does not change $SHELL

chsh -s /usr/local/bin/zsh The abover changes my default shell to ZSH, however even after starting a fresh session $SHELL is still set to /usr/local/bin/fish, my previous shell. So if I do exec ...
2
votes
0answers
36 views

focus to newly opened terminal

I am using gnome-shell 3.14 on archlinux 3.17.3-1. I have a keyboard shortcut (ctrl+alt+T) to open an xfce4-terminal. My issue is that when I triger this shortcut the focus is not set the the newly ...