Questions tagged [zsh]
Zsh is a shell designed for interactive use, although it is also a powerful scripting language.
1,274
questions
0
votes
0
answers
7
views
modules installed with nvm can't be found by zsh
I'm using zsh and have recently installed node using nvm.
The nvm binary and which version of the node command I invoke can be found without a problem.
However, node modules installed using the -g ...
0
votes
0
answers
19
views
Make Terminal Remember last visited folder after closing it on MacOS
I am a beginner with the terminal and I don't know to fix this.
I'm working on some projects that are placed in drastically different paths. Because I'm very messy it happens that I close the terminal ...
1
vote
0
answers
9
views
Configure git completion for checkout to only show local branches?
I'm not sure where git completion is implemented but I'm on MacOS, running zsh, and oh-my-zsh. If I type git branch -v I see I have 4 local branches
> git branch -v
dangling-pointer ...
0
votes
1
answer
20
views
In new version of MacOS I had to switch to zsh, now I have to add double quotes around parameters otherwise it wont work
I would like to get old bash behavior back is this possible ?
With bash I was writing simple:
youtube-dl https://www...
Now I have to write:
youtube-dl "https://www..."
Also in other ...
0
votes
0
answers
9
views
How to bindkey alt+delete to kill word forward in zsh?
I want to bindkey alt+delete to kill word forward in zsh. Also, I use ohmyzsh for configuration, and I have found that use "bindkey ^U backward-kill-line" to kill line backward like bash. I ...
1
vote
0
answers
31
views
zsh starts up in ~0.4 seconds most of the time but sometimes takes ~3 seconds
Recently, I got around to speeding up my terminal start times (which were regularly taking an excess of 8 seconds) by profiling my .zshrc. Then, I removed stuff I didn't need; lazy-loaded things like ...
0
votes
0
answers
36
views
Most homebrew installed commands outputs "zsh: killed"
When I type brew,
I get the output:
zsh: killed brew
Writing out the whole path still gives the same output, so it doesn't seem like a path problem.
Furthermore, running /bin/bash gives the ...
0
votes
1
answer
12
views
How do I add export CLI='docker run -it --entrypoint cardano-cli -e NETWORK=testnet ...' so I can run CLI on Mac OS Monterey zshrc
I have tried adding the following
export CLI='docker run -it --entrypoint cardano-cli -e NETWORK=testnet -e CARDANO_NODE_SOCKET_PATH=/ipc/node.socket -v cardano-node-ipc-testnet:/ipc inputoutput/...
0
votes
0
answers
36
views
Poetry completion is not working in macOS Monterey
On a pristine macOS I followed the steps listed here ending with a .zshrc file like this:
export PATH="/Users/canciobello/Library/Python/3.9/bin:$PATH"
fpath+=~/.zfunc
compinit
The zsh ...
2
votes
1
answer
27
views
Hide zsh vcs_info on default branch?
I want to add Git branch information to my terminal prompt with ZSH but I want to hide that when I am on the default branch, such as "main" or "master". Is there a mechanism to ...
1
vote
2
answers
91
views
Can I output `curl` response while also checking for presence of ERROR string?
I have a command I am running with curl. The curl command always resolves successfully even when the server response includes the string ERROR somewhere.
Can I somehow detect this response with some ...
0
votes
0
answers
24
views
execute zle widget without binding it [duplicate]
I would like to execute a zle command without binding it to a key.
The only solution I currently see is something like this.
cmd() { RBUFFER="some text to enter into the prompt" }
zle -N cmd
...
0
votes
0
answers
14
views
iTerm/zsh? list colors just won't change
I just want to change the color of the completion list in my iTerm.
I am using zsh, but when I change the theme, the list colors stay in this ugly red with gray background. Can someone help? I have ...
2
votes
0
answers
13
views
Use expansion globs {a..z..2} in zsh like in bash
Both in zsh and bash you can:
> echo {1..10}
1 2 3 4 5 6 7 8 9 10
> echo {a..z}
a b c d e f g h i j k l m n o p q r s t u v w x y z
> echo {1..10..2} #range 1 to 10 in steps of 2 (i.e. ...
0
votes
0
answers
26
views
Up Down Arrows keys to scroll history on ZSH is not working
I am on macOS (12.3.1 Montrey) and I use ZSH.
When I press UP Arrow on my terminal/iTerm, it gives me an "alert" sound and then I would have to press it again to go to the previous command. ...
0
votes
0
answers
13
views
What is this zsh feature called (related to autocomplete) and how to use it?
I apologize in advance for what may be a simple question for many of you. I am using a Kali VM image that uses zsh and it has an interesting feature where when you start to type a cmd it will try to ...
1
vote
1
answer
95
views
How to use zsh in flatpak vscode
I have Visual Studio Code installed in flatpak, I run it with:
flatpak run --command=sh com.visualstudio.code
I want to change the shell to zsh, but I can't find how to, I tried multiple thing in my ...
0
votes
2
answers
97
views
"Command not found: complete" message appears every time I open the terminal
I was setting up my development environment on Ubuntu 20.04 following a video on Youtube and after running the command
$ echo -e '\n. $HOME/.asdf/completions/asdf.bash' >> ~/.zshrc
Every time I ...
0
votes
0
answers
111
views
Zsh-like syntax highlighting on PowerShell
I've been using Zsh for a long time and have installed a syntax highlighting extension such that, as shown in the picture below, when I enter the name of a program that doesn't exist on the console, ...
1
vote
1
answer
55
views
/bin/sh: TexturePacker: command not found (while zsh works) macOS Monterey
I have a small Adobe Animate extension that uses TexturePacker to pack sprites onto sprite sheets. I've successfully added TexturePacker to $PATH (/Applications/TexturePacker.app/Contents/MacOS) so it ...
1
vote
1
answer
25
views
special characters not rendering well in zsh
I'm running rxvt-unicode, with zsh + ohmyzsh.
I just installed firacode, verified font name with fc-cache and set URxvt*font: xft:FiraCode in ~/.Xresources, and ran xrdb ~/.Xresources.
Then I ...
1
vote
1
answer
35
views
ZSH Colorize the PWD output in aliases
NOTE: Yes, This is on Mac OS 11.6.2 Big Sur.
Right now I have zsh aliases in the .zshrc file to make terminal navigation easier. I thought I'd try to colorize the PWD output, but what happens is that ...
0
votes
0
answers
11
views
Default directory for zsh (cygwin) terminal is home, not working directory VSCode on Windows
I have setup custom profile for zsh via Cygwin in VSCode as below:
"terminal.integrated.profiles.windows": {
"zsh": {
"path": "C:\\cygwin64\\bin\\bash....
1
vote
0
answers
24
views
zsh change RPROMPT time on enter
I have found resources on configuring zsh's right prompt (RPROMPT) to be the date and time and this works great.
However the time the prompt renders (after the last command) and the time that I press ...
0
votes
1
answer
157
views
How to automatically rename tmux window to an aliased command
I have set up multiple aliases to ssh to different servers
alias sa="ssh user1@server1"
alias sb="ssh user2@server2"
alias sc="ssh user3@server3"
When I run these ...
1
vote
1
answer
40
views
Is there a way to reach iCloud's Pages folder via the Terminal?
You can get to iCloud drive from the Terminal using cd ~/Library/Mobile\ Documents/com~apple~CloudDocs/, but that doesn't show you all the same folders you see when you click the iCloud Drive link in ...
0
votes
2
answers
18
views
Printing the KeyMap pressed in zsh/bash
Is there a way for zsh/bash to print out the keymap of the next received keystroke ?
I would press a key combination on my keyboard, and it would print, say
keymap :
^A
0
votes
0
answers
9
views
What are some options to emphasize/indicate line breaks and/or soft-wraps in zsh?
Sometimes when a lot of data comes through stdout at once in the terminal, it can be confusing to sort out when a line break occurs. I am looking for a solution that would emphasize when soft-wraps ...
0
votes
0
answers
14
views
aliases for terminal commands not loading on session start [duplicate]
my ~/.bashrc and ~/.zshrc both files have following aliases
# exa to ls
alias l='exa'
alias la='exa -a'
alias ll='exa -lah'
alias ls='exa --grid --color=auto --icons'
# bat alias to cat
alias cat='...
0
votes
0
answers
10
views
Wildcard (*) is not matching files in another user's folders in zsh on macOS [duplicate]
Logged in as user 1, I am trying to delete all files in a folder belong to user 2, using * as a wildcard. I know there is a file in the folder.
% sudo ls /Users/Guest/Documents
.localized file
% ...
2
votes
1
answer
90
views
Bash or zsh conditional patterns and variable expansions
Suppose I want to generate a filename based on some given variables.
track=01
title="Some title"
album="Some album"
echo ${track}. ${title} (${album})
-> 01. Some title (Some ...
0
votes
0
answers
54
views
zsh-autosuggestions: Get Next/Previous suggestion
When using zsh-autosuggestions, is it possible to see more than one suggestion by rolling to the next/previous suggestion? i.e. if I type:
ls
I might get ls -l as a suggestion - is there a keyboard ...
0
votes
0
answers
45
views
How do I tell Mac Terminal which of two Zero/0 characters to use?
My question arises from my Mac Terminal's response to commands like cal and date. I use ZSH and UTF-8.
As you know, most monospace fonts, including Apple's own SF Mono, offer at least two choices for ...
1
vote
1
answer
32
views
DTerm (macOS one-stroke quick terminal) > Issues with $PATH in ZSH
I’ve been using DTerm for a long time as a fast and convenient way to get to a “path aware” terminal prompt in macOS - but since upgrading to BigSur/ZSH, the $PATH in DTerm and Terminal.app/iTerm ...
0
votes
0
answers
94
views
How to change the font color in the title of iTerm 2?
Does anyone know what option should I put in .zshrc to change the font color in the title of iTerm from grey to white? I spent 24h and still couldn't find the right option because there are a lot of ...
2
votes
1
answer
51
views
Having your shell commands run after consecutive ssh
I have a function in my zsh source file ~/.zshrc:
function cr() {
ssh -p 5022 myname@ssh.mylaboratory.fr
ssh servername2
screen -ls
}
However, everything after the first ssh seems to be ...
1
vote
0
answers
103
views
Zsh: Passing multiple arguments to command (ls) from a variable ($LS_OPTIONS)
I am trying to customize ls command adding arguments to $LS_OPTIONS
The ls alias and LS_OPTIONS are defined in the default config file:
export LS_OPTIONS='--color=auto'
...
alias ls='ls $LS_OPTIONS'
...
1
vote
0
answers
132
views
compgen on zsh returns a different result than on bash
I am trying to make bash completions work properly in zsh.
I am aware of the need to load these in ~/.zshrc:
autoload -Uz +X compinit && compinit
autoload -Uz +X bashcompinit && ...
1
vote
1
answer
110
views
Pressing Tab Key in Terminal Enters a Space Instead of Triggering Autocomplete
First time asking on this site, please let me know if I can improve the question :)
I'm helping a student configure her mac development environment.
We've got zsh setup, which I believe should come ...
0
votes
1
answer
52
views
How to write a bash function that calls a command with the same name?
I want to write a wrapper around a command that checks a condition before executing the underlying command. I can't figure out how to execute the underlying command without invoking the current ...
1
vote
1
answer
31
views
/usr/bin/MAKE simultaneously present and not present
I'm using macOS Monterey 12.0.1. When I run the Terminal app, it informs me "The default interactive shell is now zsh." Okay.
Today I ran make to build a program, except my caps lock was on ...
0
votes
1
answer
56
views
How to refresh terminal after function call
I've written a simple function to search the current folder when I press ctrl+f with exa and peco, after I choose a directory I want to cd into it.
(ll is modified version of ls)
pecofunc() {
ll | ...
0
votes
0
answers
29
views
How to implement zsh directory entry and exit hooks?
I want to implement a function, when I enter a directory through cd, it will automatically scan whether the alias.sh file exists in the directory.
If the file exists, source it to load it. alias.sh is ...
0
votes
0
answers
22
views
How to get windows terminal to open Ubuntu at correct location?
I have windows 11. I installed Ubuntu 20 LTS and have it running as a nested environment. When I click the Ubuntu app it opens a new terminal (on Windows Terminal) at the Linux location home/<user-...
0
votes
1
answer
21
views
Using git completion inside function
I use ZSH and have git completions working, provided by brew install git (installed to /opt/homebrew/share/zsh/site-functions).
If I git commit [TAB], it will autocomplete paths which have been ...
0
votes
1
answer
28
views
quote mark (U+0027) in perl substitution
I need to put two spaces between sentences in a large number of text files.
A sentence ending is defined as period, exclamation, or question, maybe a close-quote, and then a space. Tabs and line ...
0
votes
0
answers
26
views
Terminal constantly changing shell – slower response
So I did a format of my mac, new install (Mac OS 12.1). Since then my terminal (2.12) has been switching shells without any command. My default shell is zsh. Basically for some reason every time I run ...
0
votes
0
answers
86
views
How can I create a FAT32 disk with 'newfs_msdos'?
I'm using terminal on a mac.
I tried to create a FAT32 disk with 'newfs_msdos', but I got the following error and cannot create it.
I was able to create a FAT32 disk by running the command 'diskutil ...
0
votes
2
answers
196
views
zsh: keep all command outputs on terminal screen
I'd like to know how can I get zsh to behave like bash regarding this:
I want command outputs to always show up right below these commands in terminal.
For example, when I run the following command ...
0
votes
0
answers
69
views
How can I redirect the output of a command that only writes to a file, not stdio?
There’s a command I want to run that writes to a specified file. Is it possible to redirect the output of this command to the stdin of another command?
The command looks like this:
foo -o filename
I’...