Questions tagged [zsh]

Zsh is a shell with many advanced command-line and scripting features.

251 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
13
votes
1answer
2k views

zsh can't input to terminal when piping stdin and stdout with variable command that has tty output

System info: macOS Sierra 10.12.6 zsh 5.4.2 (x86_64-apple-darwin16.7.0) GNU bash, version 4.4.12(1)-release (x86_64-apple-darwin16.3.0) Scroll to the EXAMPLES at the bottom if you just want to dig ...
6
votes
1answer
879 views

zsh: SHARE_HISTORY or INC_APPEND_HISTORY breaks EXTENDED_HISTORY

I would like to both share history across terminals and keep track of elapsed time for history commands. The intuitive way seems to be to use both EXTENDED_HISTORY and SHARE_HISTORY, but this sets all ...
5
votes
2answers
390 views

Zsh: consistent history between machines

Use case: distribute zsh's history between machines in source control. Is that something that I can achieve with zsh's history -- put history in version control the sync between mahcines? This is to ...
5
votes
1answer
909 views

custom zsh autocomplete

I'd like to write a zsh completion for pytest. Where do I Start? I'm using oh-my-zsh. in .zshrc: fpath=($HOME/.mycompletions $fpath) autoload -U compinit && compinit -u in $HOME/....
4
votes
0answers
93 views

Why does ZSH finish executing a function after exit was called from a trap?

Consider the following script: trap "echo TRAPPEDTERM >&2; exit" TERM termself () { kill -TERM $$ echo "Survived TERM!" } termself echo "Bye." Executed ...
4
votes
0answers
131 views

Zsh CORRECT option is unaware of AUTO_CD and CDABLE_VARS

Is there a way to make the CORRECT option aware of AUTO_CD and CDABLE_VARS? In this example, I would expect correction to not be triggered. Could this be a bug? > setopt autocd > setopt ...
4
votes
0answers
371 views

Git completions for aliases only available after running `git reflog`

I have a few aliases that I want to autocomplete for git, e.g., the following alias gco="git checkout" When I was attempting to add completions for this alias, I looked around in my path and saw ...
3
votes
1answer
338 views

XFCE - Blank text in terminal

I've just performed a fresh install of Arch Linux on my laptop (ThinkPad A485, though that's probably not relevant here), and installed XFCE4. Everything seems to be working with the exception of one ...
3
votes
1answer
300 views

ZSH custom completion from command output

I am creating a custom completion for my command ipadd which will automatically complete all the network devices for OS X. It has a parameter --device which allows you to specify the network devices ...
3
votes
1answer
935 views

history shows only current session

This is what I see in my terminal in a fresh session: Agent pid 6847 Identity added: /home/eric/.ssh/id_rsa (/home/eric/.ssh/id_rsa) ➜ ~ history 1 history ➜ ~ I'm using Linux Mint 17.3 64 ...
3
votes
1answer
549 views

How to view current settings for all options?

I know that setopt with arguments will show the options that are set to values different from the default; e.g. % setopt interactive login monitor norcs shinstdin zle If you have memorized all the ...
3
votes
1answer
2k views

Making zsh filename completion case-insensitive everywhere

I have the following line in my zshrc to make filename completions case-insensitive: zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' This works most of the time but I’ve noticed that if I ...
3
votes
1answer
371 views

Why does select-word-style stop me from using backward-kill-word for leading whitespace?

If I have just some whitespace at be beginning of my zsh prompt, I can usually ^W (backward-kill-word) it away. However, as soon as I load select-word-style - even if I don't select any special style -...
3
votes
0answers
1k views

Powerline bash prompt not colorized in tmux

The bash/zsh commandline prompt is not displaying colors in tmux, even though I managed to get the powerline itself working (with colors). The prompt works fine in pure bash/zsh. I am getting the ...
2
votes
0answers
89 views

Funtoo Keychain keeps asking for password when logging in using SSH

I have followed the instructions here https://www.funtoo.org/Keychain and added eval `keychain --eval --agents ssh --inherit any id_rsa` to - I have tried both but the result was the same - .zshrc ...
2
votes
1answer
348 views

wine-platform-5-staging & wine-platform-runtime not found by shell

I'm running Kubuntu 20.04 64-bit with zsh as my shell. I installed wine-platform-runtime and wine-platform-5-staging as snaps. However, zsh doesn't recognize it's installed. The following 3 commands ...
2
votes
0answers
405 views

How can I enable colours in ZSH for root user?

I'm trying to move from Bash to ZSH, whichc is the new default shell on Mac OS Catalina. I have some bash settings in my profile, and I'd like to translate these settings into the ZSH, including my ...
2
votes
1answer
53 views

How to fix path typos?

When typing quickly, I often mistype cd ~/myfiles as cd ~?myfiles, resulting in: zsh: no matches found: ~?myfiles Is there a way ZSH can autocorrect such mistakes?
2
votes
1answer
149 views

How to save exit code in history?

So with setopt extended_history, extra information is saved in the history file (format: : <beginning time>:<elapsed seconds>;<command>). The information is certainly useful, but I ...
2
votes
1answer
694 views

sudo: unable to initialize PAM: No such file or directory after editing pam.d

I was playing around with the pam.d file in nano and for some reason along the way I lost root access. Whenever I try to use the sudo command, I get an error like this: [redacted]@[redacted] ~ % sudo ...
2
votes
2answers
701 views

zsh: locking failed for ~/.cache/zsh/zsh_history: file exists

I have a bind mount ~/.cache/zsh folder between multiple hosts with rw and defaults when doing mount. When I start both machine and zsh trying to lock zsh_history, it gives error zsh: locking failed ...
2
votes
0answers
253 views

Text gets messed up in history search(ctrl-r)

I using zsh. However, the command search history feature(ctrl-r) is giving me issues. Specifically, the text gets garbled. Everything executes correctly regardless, but UX it's a bad experience. ...
2
votes
0answers
2k views

Powerline Fonts for zsh in TTY

I'm using UBUNTU 16.04. In graphical terminals like "Terminal" "guake" and "terminator" I am using zsh with Powerline-Fonts. I looked around a bit but found no proper solution to activate powerline ...
2
votes
0answers
488 views

Change tmux window title dynamically to last line of command output

I would like that every stdout in a specific tmux window is dynamically redirected to any command | tmux window-rename That is, the last line of output always becomes the title of the window. I ...
2
votes
1answer
492 views

Color folders in ZSH based off directory depth

I'm currently editing the agnoster theme from oh-my-zsh to my preferences, and was wondering if there is some way to color the names of directories in the status bar based off depth. Something like... ...
2
votes
1answer
229 views

Is there a plugin or tool for multiple “profiles” in ZSH?

I use oh-my-zsh for all of my console goodness. Depending on what I'm working on, there are certain environment variables that I'm often overwriting either manually or through scripts to make my work ...
2
votes
1answer
154 views

Use all hosts completed by zsh for cssh

Is there any possibility to use all completed hosts with cssh? E.g: cssh www* This should establish three connections to www1, www2, www3 If I press Tab after www I get all three possibilities.
2
votes
0answers
683 views

zsh completion by history not working

I read the answer https://stackoverflow.com/a/13614816/4126652 and tried out the history-beginning-search-menu I added the the 3 lines to my zshrc autoload -Uz history-beginning-search-menu zle -N ...
2
votes
0answers
41 views

Testing that disk is parked

I run a command in zsh's preexec(), i.e. before every other command entered and accepted for run. Would like to skip doing this when I detect that the disk of current $PWD is parked. Can I do proper ...
2
votes
1answer
1k views

Python virtualenvwrapper and ZSH prompt

I am using archlinux with zsh and python simha@gauranga ~ % echo $SHELL /usr/bin/zsh simha@gauranga ~ % python3 --version Python 3.5.1 my .zshrc is export WORKON_HOME=~/.virtualenvs source /usr/...
2
votes
1answer
60 views

How did I get the git commits to show up in autocomplete?

Git tab completion on my mac: Git tab completion on my Ubuntu server: On my mac and my Ubuntu server I get very different output from tab completion despite having the same version of zsh, same ...
2
votes
1answer
379 views

Change color when changing directory

I have two folders called Documents and Downloads. In zsh, when I type cdSpaceDoTabc the color of Documents change from white to (hard to read) gray. How can I turn off this color change or control ...
2
votes
0answers
247 views

Can I prevent zsh slowing with a large history?

I've just migrated from bash to zsh. I converted ~/.bash_history for use in zsh. It's 150 000 lines long. bash is almost instantaneous to start up, but zsh is now fairly slow, taking half a second to ...
2
votes
1answer
79 views

Is there any plugin for zsh or bash that does heuristic filename completion?

Such as if $ ls program_v1.21.rb program_v2.01.rb program_v2.01_final.rb so when I $ echo progv2fin[TAB] it completes to $ echo program_v2.01_final.rb Sure there must be something, but I haven't ...
2
votes
0answers
1k views

Byobu - New window with same ssh session?

Is there a way to configure Byobu to use same ssh session in a new window. For e.g. Open Byobu window ssh into a remote host Press 'F2' to open a new window. This opens the terminal with my ...
2
votes
0answers
771 views

zsh/Prezto: difficulties with right prompt alignment

This may be stupidly simple, but... I am trying to make my own prompt for Prezto. I have been using numerous prompts for reference (I can post a list if necessary). My RPROMPT and cursor are refusing ...
2
votes
0answers
268 views

Corrupt files after extracting with Cygwin's GNU tar

I have a bunch of tarball backups which I just restored onto my new Windows 8.1 + Cygwin system using GNU tar: zsh$ for file in **/*.tgz; do tar xvzf $file; done To my surprise a lot of these ...
2
votes
0answers
341 views

zsh: Echoing every statement?

I have an odd problem with zsh when I switch between shells in a particular way: Option 1 (works well): I start a zsh shell. I switch to tcsh with /bin/tcsh, and I switch back to zsh with /bin/zsh ...
2
votes
0answers
53 views

Make zkbd ignore $DISPLAY

Is it possible to make zkbd ignore $DISPLAY variable? I have set up when I log in to different X sessions and it is annoying if suddenly I need to reenter/copy configuration (and I have no idea why $...
2
votes
2answers
502 views

ESC-q doesn't work in tmux with zsh

I use Escq a lot (stashing the current line while I execute another command), and it works fine with Gnome Terminal 3.6.0 + zsh. However, if I start tmux, then it stops working: the cursor just moves ...
1
vote
0answers
26 views

Change zsh tab size

I wanted to change the tab size (the amount of spaces a tab uses) used in my terminal, but it didn't work. I then found out, that my shell (zsh) inserts a fixed amount of 8 spaces instead of a tab. I ...
1
vote
1answer
69 views

How to use bash syntax in zsh

I've recently switched to zsh mainly for its auto-completion. However, zsh has syntax for scripting different from bash, and I use a lot of ad-hoc one-liners. For example, echo 'qwe\tasd' expands the \...
1
vote
1answer
19 views

what makes the different behaviour between zsh login init and manually sourcing profile script?

I want to add a function to precmd_functions at ZSH login and avoid duplication. Since /etc/zprofile source the /etc/profile, which then source all the *.sh script under /etc/profile.d/, my solution ...
1
vote
0answers
47 views

How to update my ssh known hosts list?

I changed my /etc/hosts, added something like this: 10.188.x.x client-1 10.188.y.y client-2 I used that setting for a while (ssh client-1), then I changed the file a second time to this: 10.188.x....
1
vote
0answers
37 views

How to update env before every command (literally)

I use many different VPNs for work and switch between them often using a script that sets up $http_proxy and $https_proxy for me. The issue is when I have a terminal open these variables won't update ...
1
vote
1answer
100 views

How to run Tmux when opening a terminal in ArcoLinux?

I already know there are other questions like this, but their answers don't help me. I want to run Tmux when I open the terminal in ArcoLinux, that is based on Arch Linux, so in order to do this, I ...
1
vote
1answer
358 views

zsh - change color for host and username

I just switched from bash to zsh and now I am trying to find out, how to colorize the Username and Host to have different color shemes. With bash my colorsheme looked like that: (orange)user (blue)@ (...
1
vote
0answers
93 views

Why I can not get Terminator to use the default defined shell?

I am using ZSH as my default shell and OhMyZsh as well as the following command shows: ❯ echo $SHELL /bin/zsh I have been following what it is found at https://askubuntu.com/a/253819 but with no luck ...
1
vote
1answer
66 views

Queue multiple jobs after current one in shell

On previous questions similar to mine, the proposed solutions are all involved suspending the current foreground task with Ctrl+Z and then running fg && ... or fg ; ... (and maybe sending the ...
1
vote
0answers
74 views

In zsh vim mode, when replacing multiple characters, backspace does not work as expected

I want to do the following: In the console, in vim mode, replace several characters (vim command R), while being able to revert the changes with backspace. In bash it works the same as in vim: bash ...

1
2 3 4 5 6