Questions tagged [zsh]

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

Filter by
Sorted by
Tagged with
1 vote
1 answer
403 views

How to programmatically get the list of directories that brew installs to?

I am writing a script that automates setting up my mac dev environment. I want to place the directories that brew installs first on my path, so that the default system commands are overridden by brew ...
2 votes
1 answer
379 views

Why does `echo | xargs > >(cat)` hang on my Mac?

This is reproducible in zsh and bash. Confusing me further, echo | ( xargs; : ) > >(cat) does not hang. This is also reproducible in zsh and bash. If I use GNU's xargs as provided by brew ...
0 votes
0 answers
77 views

Strange misbehavior of 'find'

WGroleau@MBP-WWG Music % Music find * -type d -name "*Andy*" -print ……/Patsy Cline/The Definitive Collection/13 Imagine That.mp3 I've used this method of locating a directory many times, and have ...
1 vote
1 answer
414 views

Migrating aliases from bash to zsh

I recently moved from bash to zsh. Everything is great, I love it! Except some of my old aliases are getting confused. I have a long list of aliases like this that I've just migrated wholesale from ....
0 votes
1 answer
35 views

Git alias changed on its own

I'm using macOS and zsh. Yesterday, when I typed gl, it was a shortcut for git pull. Now, all of a sudden, gl seems to refer to git log --graph --decorate ... Why is that? How can I make gl an ...
36 votes
2 answers
33k views

Shell SIGKILL Keybinding

How can I setup a keybinding to send a SIGKILL to the current foreground job? I already know that Ctrl+C is SIGINT and Ctrl+\ is SIGQUIT. I would like a more severe option. Is there anything ...
2 votes
1 answer
2k views

zsh history is not syncing immediately

I have zsh 5.7.1 (x86_64-apple-darwin19.0.0) and using iterm2 if it makes a difference with the following zshrc: HISTFILE=~/.zhistory HISTSIZE=10000 SAVEHIST=10000 setopt appendhistory The file ~/....
0 votes
1 answer
913 views

zsh: always buffer last command's output

Is there any way of buffering or saving into a variable the output of the last command? e.g.: % long_running_command <long output> <long output> <long output> <long output> &...
1 vote
1 answer
2k views

Copy single dotfile from a folder to another on local machine

Before you downvote, I have read the following solutions: How do I copy file named starting with a dot? How to copy with cp to include hidden files and hidden directories and their contents? Linux / ...
0 votes
1 answer
105 views

Piping your current $PATH to VSCode as a shortcut

My knowledge on shell usage, regular expressions and system processes is rather small. I know I can pipe de result of one command to another. Yet doing pwd | code or $PATH | code doesn't yield the ...
0 votes
1 answer
265 views

Absolutely NONE of my terminal commands are working: cd, ls, nano, pry, flutter, python3… Does anyone have any idea what's going on?

I can't think of what's recently changed, besides perhaps updating to a new version of Mac OS Catalina (10.15.2). All of these commands have been working for me up until today. First it was pry that ...
8 votes
1 answer
13k views

Increase the size of history for zsh

I've reached the maximum 10K lines of commands in my zsh history file, but I want to store more commands. So I set this, in my ~/.zshrc file: export HISTFILE="$HOME/.zsh_history" export HISTSIZE=...
1 vote
2 answers
307 views

zsh autocompletion of my own function

I'm trying to write a shortcut for a frequently visited directory so that I can eliminatecd (I know, I know, but I'm lazy). So I wrote a function in my .zshrc that does this: progs () { if [[ -z $...
0 votes
0 answers
115 views

Is there a BASH equivalent of zsh's $VENDOR variable?

In ZSH, I can get vendor using zsh$ echo $VENDOR apple However, it doesn't seem to be available in BASH (or sh). Is there anything equivalent in BASH? Or is there a quick way to get something ...
1 vote
1 answer
231 views

How much time has passed since first command in zsh

By executing this command, ❯ fc -l -1 | awk 'END{print $1}' 8845 I can see that I have 8845 commands in my history file. And I'm using zsh, so my history file looks like this: ❯ head $HISTFILE ...
20 votes
1 answer
10k views

How to expand aliases inline in zsh?

Similar to how to expand aliases inline in bash? I'm using zsh 5.7.1 (x86_64-apple-darwin19.0) and Terminal 2.10 (433). CTRL - ALT - E works for bash, what's the equivalent for zsh? (If Use Option ...
1 vote
1 answer
430 views

Change VLC interface style in terminal

I searched through the vlc docs (vlc -H --advanced --help-verbose) but couldn't find a way to do this. Is it not possible to change the interface style to dark in terminal? Bonus question: How about ...
0 votes
1 answer
1k views

File not showing in Git status when it is meant to be

Here is my .gitignore file: # Ignore everything by default. * # Zsh !.zshrc # Git !.gitconfig !.gitignore # Lock.sh !.config/lock.sh # Xresources !.Xresources but still when I do git add .config/...
15 votes
2 answers
13k views

How I can specify a separate file for my aliases in oh-my-zsh?

I'm preparing a bash script, that will set a bunch of handy shell aliases at once. I'm using a pair of iTerm2 and oh-my-zsh. I know that I can manually add aliases into ~/.zshrc. I also know that I ...
2 votes
1 answer
850 views

Auto quote arguments in zsh

It's a long shot, but I was wondering if there was a way in zsh, with certain commands, to automatically quote the rest of the line. Eg, for the command he he (foo*bar + baz)^2 I want it to parse ...
4 votes
1 answer
7k views

Change directory depending on start directory zsh

I am using the new Windows 10 terminal with the WSL ubuntu and zsh (oh-my-zsh) shell as the standard terminal inside. It is configured that the context menu (right-click) has the option "open terminal ...
0 votes
1 answer
176 views

Tab doesn't expand the path when using $_ to access the previously typed path

Consider the following scenario: I've used ls to list the contents of a directory, and I've used Tab to find the right directory, so I don't know the full path. And it's a potentially long path, so I ...
1 vote
1 answer
172 views

Disable any non-user changes to screen window titles with zsh

I upgraded my shell to ZSH recently on OS X and one behavior is driving me nuts. I've tried a few suggested fixes and haven't figured it out yet, so I figured I'd try here. When I start a GNU screen ...
9 votes
2 answers
3k views

Why does IGNOREEOF not work in Zsh?

I frequently use Ctrl-D to exit interactive python sessions but sometimes I would accidentally hit it when the python session was not on. This will result in sending an EOF to the shell and ...
7 votes
3 answers
7k views

Why do I see "Operation was denied because the current credentials do not have the appropriate privileges" when trying to chsh?

I'm setting up a new dev Macbook Pro, and trying to replace bash with zsh. I installed zsh and can run it to change shell in a session. When I use sudo chsh -s /bin/zsh username I get the error ...
0 votes
0 answers
101 views

zsh installed via cygwin makes the windows background sound with every command

So I have zsh.exe inside C:\cygwin64\bin and I recently integrated it as an integrated terminal for vs code. I have noticed it makes the windows background sound with every command I enter in the ...
2 votes
1 answer
272 views

What is a close option in zsh to readline's `completion-prefix-display-length`

When completing, if the typed part is long, this option replaces the same part in the completion menu items with ellipsis. Especially useful if the typed part is long and there are many candidates.
5 votes
1 answer
10k views

Migrating from bash to zsh for Mac OS Catalina

As some of you may know, after upgrading to Mac OS Catalina, Apple is prompting users to migrate to zsh as the default shell. Now, there is a warning that comes up every time bash is opened. It can ...
7 votes
5 answers
4k views

OS X 10.11 (El Capitan) Making Zsh Very Slow

I just freshly installed El Capitan on my MacBook Pro. I had trouble earlier with the my terminal being too slow while typing in simple commands. I thought it might have been that I need to format my ...
0 votes
0 answers
306 views

WSL zsh - Trim working directory if it contains a certain folder

I'm using WSL to run ohmyzsh on my win 10 machine. I have a repository folder in which I keep my git repositories, and it is my most common working directory. I want to be able to conditionally hide ...
0 votes
0 answers
2k views

Can't Run bash file inside ZSH

I've placed a bash file inside .zshrc and tried all different ways to run it every time I open a new terminal window or source .zshrc but no luck. FYI: it was working fine on .bashrc here is .zshrc ...
4 votes
1 answer
3k views

zsh: Select menu auto-completion with single Enter/Return press

Once finding the auto-completion I want to select from the completions menu, I currently need to hit <Enter> twice - once to add the selection to the terminal, and once to execute the command. ...
4 votes
1 answer
6k views

How do I convert .bash_profile to .zprofile

With OSX Catalina they want you to use zsh for the shell and I had a bash profile (that I "borrowed") that I like. But I'm not a shell expert and I don't know how to convert it. Below is the ....
19 votes
1 answer
9k views

Why does the dot command (source) not work on files without path in zsh?

I recently switched from bash to zsh. In bash, I used the dot alias . for the source command, e.g. . .bashrc It worked with . .bashrc, . ~/.bashrc, . ./.bashrc. However with zsh, the dot alias does ...
2 votes
1 answer
1k views

Remove ZSH/oh-my-zsh history substring search up-arrow functionality

I recently installed zsh and oh-my-zsh, which come with the history substring search up-arrow functionality that I would like to remove. Currently pressing the up arrow in my shell having already ...
1 vote
1 answer
1k views

UTF-8 not displaying correctly in Cygwin+zsh using ConEmu

I have installed the following things to use for development: ConEmu 15083c Recent Cygwin version Cygwin zsh-5.0.8 Oh-My-Zsh This theme Now, when choosing a theme I realized that the display of ...
0 votes
1 answer
1k views

How can I run a single Terminal window or tab with zsh in macOS?

As many of you know, macOS is switching to zsh from bash. Before converting, I would like to play with zsh a bit. Is there a way to open a single Terminal window or tab as a zsh shell, without having ...
5 votes
2 answers
2k views

zsh: What does hist_find_no_dups mean?

HIST_FIND_NO_DUPS When searching for history entries in the line editor, do not display duplicates of a line previously found, even if the duplicates are not contiguous. However, when I ...
1 vote
1 answer
731 views

zsh ignores HIST_FIND_NO_DUPS [duplicate]

I am trying to configure my Z shell to not show duplicate history entries with 'setopt HIST_FIND_NO_DUPS'. HIST_FIND_NO_DUPS When searching for history entries in the line editor, do not display ...
1 vote
1 answer
3k views

Unable to add $PATH in zshrc

I am trying to add the Hashicorp vault exec to my $PATH variable in ~/.zshrc. Below steps were followed: Edit the .zshrc $PATH as below: export PATH=/usr/local/mysql/bin:/Users/myuserName/Downloads/...
0 votes
1 answer
50 views

How to use $SHELL?

I'm trying to determine if the person running my script is in a bash shell or zsh (or gitbash). I thought I could do something like this: if [ $SHELL == *"zsh"* ]; then THIS_SHELL="zsh" ...
2 votes
1 answer
285 views

Bindkey persist between sessions

I am using the bindkey command that comes with zsh to change key bindings. Any time I close my terminal session and open a new one, all the changes I made by executing bindkey commands are gone. How ...
31 votes
4 answers
38k views

how to format the path in a zsh prompt?

I would love to have a readable colored path. For example, instead of simply using %~ to return ~/path/to/foo I would like to format it to ~$RED/$NOCOLORpath$RED/$NOCOLORto$RED/$NOCOLORfoo to ...
1 vote
1 answer
213 views

zsh-git-prompt customization of path

source ~/zsh-git-prompt/zshrc.sh PROMPT='%B%m%~%b$(git_super_status) %# ' I have the default configuration for zsh-git-prompt as shown above In my prompt it outputs: cmuench-air /Applications/MAMP/...
0 votes
3 answers
1k views

Iterate over all files in folder with bash

I have a bunch of markdown files in my folder which I would like to convert to html with pandoc. The command I typically use is pandoc Atten.md -f markdown -t html --css pandoc.css -o Atten.html ...
0 votes
2 answers
2k views

how to get bash and zsh setup correctly on macOS mojave

I'm running macOS (Mojave.) I'm wanting to make the switch from default bash to zsh/oh-my-zsh. Everything I install assumes I'm going to be editing my .bash_profile (or .bashrc.) I'm not 100% on how ...
30 votes
2 answers
11k views

Emacs keybindings in zsh not working (Ctrl-A, Ctrl-E)

My Emacs keybindings in zsh are not working (CtrlA, CtrlE). I use zsh on OS X. They might be bound to some other thing. I'm currently using oh-my-zsh. And my .zshrc is over here.
7 votes
2 answers
2k views

can zsh do 2 stage completion?

Let's say I have the following files in the directory: abc123ABC abc123QWE abc456 Now suppose I type a and hit TAB. In bash the completion as it usually works would just complete abc and stop with ...
0 votes
0 answers
166 views

Take my ~/.zshrc when make sudo in CentOS

In ubuntu and debian: when I go to root over sudo -E zsh it automaticali load my .zshrc. In CentOS after sudo I must type source ~my_user/.zshrc every time. How I can load my .zshrc automaticaly in ...
1 vote
1 answer
1k views

How can I set Tmux pane title, like "zsh-prompt : powerlevel9k"?

When I open many panes in Tmux, and do something like ls or git status, the screen has a lot of prompt like: I want to have this complex prompt on the top of pane, and only # on current line. Like: ...

1
11 12
13
14 15
29