Skip to main content
OverflowAI is here! AI power for your Stack Overflow for Teams knowledge community. Learn more

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
0 votes
1 answer
40 views

How do I make zsh auto-complete ".." into "../"

For example, cd ..<tab> doesn't autocomplete into cd ../ I on macOS, and I have tried running with a completely empty .zshrc. I have also tried adding a specific compdef for .., but that didn't ...
Cyberwiz's user avatar
  • 121
0 votes
1 answer
38 views

Shell script gives "command not found" but command works in terminal

I'm using the beets cli music library management software on my Mac. It works fine in the the terminal - commands like beet import ~/path/to/folder work fine and which beet outputs /opt/local/bin/beet....
simonw's user avatar
  • 3
1 vote
1 answer
98 views

Complete overview of Bash and Zsh startup files sourcing order

I was confused in what order my shells source which files. When researching this for myself, I came across several sources online and even read some parts of the manuals for both shells. But still, ...
Silas's user avatar
  • 39
2 votes
0 answers
62 views

Why is `~/.zlogout` not sourced when non-interactive ZSH shell runs `exit`?

My ~/.zlogout contains the following: echo '~/.zlogout!' Let's run the following script: su user -ls /bin/zsh -c 'echo kaasbier; exit' Nothing is echoed (besides the kaasbier). I am testing this in ...
Silas's user avatar
  • 39
0 votes
0 answers
18 views

How to make the ZSH suggestions better

Consider, the ZSH suggestions. It is based on most recent commands, which makes what I am about to say logical but also frustrating to work with. Say I have a folder app with two sub-folders - app-...
Dimitar Veljanovski's user avatar
0 votes
0 answers
51 views

MacOs equivalent of adding a user to the linux dialout group on for permissions setup for UART communication

I'm working on a project where I'm interfacing with some hardware and want to monitor the data from some sensors using a specific tool. The tool doesn't have official support for MacOS but I've ...
sobbingDev's user avatar
0 votes
2 answers
26 views

linux zsh forge alias for clear that prints executed commandline

I often find myself putting a clear; in front of a command that I expect to produce lot of output. That I regularly miss is the possibility to see the executed commandline at top. Is there some magic ...
vlad_tepesch's user avatar
0 votes
0 answers
46 views

How to format zsh completion "interactive" menu?

It is usually relatively straightforward to format zsh completion system results e.g., zstyle ':completion:*:warnings' format ' %F{red}-- no matches found --%f' When using the interactive menu mode (e....
Andy Harvey's user avatar
2 votes
1 answer
59 views

OhMyZsh causes cd to push to dirs stack. How can I revert it to original state?

I am using oh-my-zsh. With it enabled: source $ZSH/oh-my-zsh.sh the cd command acts like pushd on everything: ~ ➜ dirsv 0 ~ ~ ➜ cd Projects ~/Projects ➜ dirsv 0 ~/Projects 1 ~ ~/Projects ...
ekr990011's user avatar
  • 123
-1 votes
1 answer
374 views

Can't use terminal, I keep getting "zsh: command not found: npm" even after an OS re-install

I don't remember what I had done, but every time I attempt to run a command (npm install -g gulp) in terminal, it returns a zsh: command not found: npm. This is a command I previously had no issue ...
Arnold Palmer's user avatar
0 votes
1 answer
69 views

How to determine is wsl2 is running from an IntelliJ terminal in windows?

I have some settings in my .zshrc file that should run in a regular terminal, but not when the terminal is called from IntelliJ. I am currently using IntelliJ IDEA 2021.3.3 Ultimate Edition on Windows ...
Aserre's user avatar
  • 103
0 votes
0 answers
67 views

Touchbar doesn’t work on MacBook Pro (14,2 2017) with Debian install

I downloaded Debian 12 on my MacBook Pro (14,2 2017). I have tried the various reddit/form/blog post and instructions. I am really at my wits end trying to make this work. New to Linux but I know ...
Akanwrath's user avatar
1 vote
1 answer
87 views

Accessing file association information from shell in macOS Sonoma (14.3.1)

macOS used to use a plist at ~/Library/Preferences/com.apple.LaunchServices.plist to store file association information. Recently(ish) that file has moved and is now called ~/Library/Preferences/com....
DownUnder62's user avatar
2 votes
0 answers
38 views

Get last command in error trap in zsh

This function should show the last command when an error has occurred: TRAPZERR() { cmd=$_ echo command \'$cmd\' had an error } $_ just gives the last argument. $ false ...
hawk's user avatar
  • 285
0 votes
0 answers
56 views

using scp or echo in zsh with alias parameter print 'No such file or directory'

here zsh on MacOSX. I would like to point out that I have tried several ways, with and without quoting, single or double quoting, with and without brackets, with/out $variables. But I receive ever ...
Stefano Monti's user avatar
2 votes
1 answer
153 views

How to start tmux as the default when terminals opened exclude the terminal in Dolphin

I want to set tmux as the default when open terminals (eg. Yakuake, Konsole), but exclude the terminal in the Dolphin file-manager. I put the following snippet in the ~/.zshrc if [[ -x "$(command ...
Pelican Cyber's user avatar
1 vote
0 answers
63 views

Zsh handling of substring changed?

I have over a thousand directories holding MP3 files and text.  I work on one directory each day, assisted by zsh scripts.  I mostly use zsh on command line and in scripts.  The paths are in the form ...
WGroleau's user avatar
  • 804
1 vote
1 answer
217 views

Default shell zsh but responding bin/bash

I have no idea what I did! I was installing maven and one of the guides had me do something and now I'm stuck in default zsh. I've tried changing my terminal preferences to be /bin/bash, as well as my ...
beepbeepboop's user avatar
0 votes
1 answer
107 views

How do I Iterate over an array of spaced string pairs in zsh?

I was reading the post here and tried out the solutions. However, the following does not produce any output. What am I missing? arr=( '102 351' '576 324' '427 321' ) for str in "$arr[@]"; ...
kesarling He-Him's user avatar
0 votes
1 answer
125 views

Make zsh behave like bash for commands without trailing newline

Have a look at the following demo: [user@host ~]$ zsh user@host:~/ > echo -n test user@host:~/ > bash [user@host ~]$ echo -n test test[user@host ~]$ echo -n is an example for a command, that ...
Daniel Schmitz's user avatar
0 votes
0 answers
120 views

Cannot activate Python virtual environment from within shell script (zsh)

I cannot activate a Python virtual environment from within a shell script (zsh). I have tried the following: #!/bin/zsh conda create -n myenv python=3.10 conda activate myenv It sends me the error ...
NilsK's user avatar
  • 145
0 votes
1 answer
79 views

Script to install Anaconda and update conda

I want to write a shell script (zsh) that does the following: Installs Anaconda via Homebrew. Adds conda to PATH in .zshrc. Updates conda base environment. I have come up with the following solution:...
NilsK's user avatar
  • 145
0 votes
1 answer
493 views

How to automatically load multiple SSH keys on ZSH and PowerLevel10k

I'm trying to have my SSH keys loaded automatically when I start my computer (I'm running Archlinux). At the moment I have to use ssh-add [PATH]. I use ZSH, Oh my ZSH and PowerLevel10k. Here is my ....
Virgil فِرجِيل Вергилий's user avatar
0 votes
0 answers
73 views

How to recursively search for files starting with ".#" under a path in zsh?

In the current working directory, la -a returns, . .#program 2.py .DS_Store picker.py .#picker 2.py .#program 3.py hw1 temp.test .#picker.py .. hw2 I ...
scribe's user avatar
  • 206
0 votes
0 answers
66 views

Unsure what happening with my terminal but I'm getting a weird response

Whenever I run a python file, (vs code) or even open my terminal on mac I get a warning saying. /Users/ABC/.zshrc:1: command not found: “alias /Users/ABC/.zshrc:2: command not found: “alias /Users/ABC/...
Angus_U22's user avatar
0 votes
2 answers
256 views

How can I write my CPU temperature to a file on an Intel Mac?

I'd like to log my Mac CPU temperature to a disk file in the Mac terminal. I've tried: sudo powermetrics --samplers smc | grep -i "CPU die temperature" >> cpu_temps.txt ...and: sudo ...
VikR's user avatar
  • 113
2 votes
1 answer
63 views

What is the text in the frame header of Terminal on startup?

When I start up a Terminal window on macOS, the following text scrolls by in the frame header: I recognize a few of my brew'd packages like pyenv in there, as well as some basic posix packages, but I'...
shea's user avatar
  • 91
0 votes
1 answer
104 views

ZSH: how to make navigation in command line more bash-like?

I recently installed zsh and really like it but I just don't know how to navigate the command line. Home and End keys do not work and Ctrl-Left Ctrl-Right neither. I set it to vi mode since I am ...
JPT's user avatar
  • 200
1 vote
0 answers
45 views

Solutions for organising configuration files across devices and between categories [closed]

As a Linux user, I have a lot of non-GUI applications for which I configure their desired behaviour through config files. One of the troubles I have is that I have multiple devices from which I would ...
manoelpqueiroz's user avatar
0 votes
1 answer
74 views

Strange zsh startup command with "uh oh" spam

I am currently on macOS Sonoma 14.2 (Beta) and have a MacBook Pro 2021 with an M1 Max. I genuinely have no idea where to start on this problem. Whenever I open up a Terminal, I get this weird spammy ...
Htmlly's user avatar
  • 3
1 vote
0 answers
55 views

Why does zsh navigation behave differently in the VS Code terminal vs macOS terminal?

When I am using zsh in the inbuilt VS Code terminal, I can: a) use the up and down arrow keys to navigate through my command history when typing a command: zsh command navigation b) use all arrow keys ...
Staś Werno's user avatar
0 votes
0 answers
85 views

zsh syntax highlighter : Make corresponding parenthesis blink

I'm using the zsh-syntax-highlighting on MacOS (with iTerm2) and wonder whether I can configure it so that, if the cursor is on a parenthesis, the corresponding matching parenthesis on the command ...
user1934428's user avatar
0 votes
1 answer
138 views

Adding an empty line between the powerline/prompt line and the output line in ZSH?

I am using p10k, and I haven't seen any option other than # Add an empty line before each prompt. typeset -g POWERLEVEL9K_PROMPT_ADD_NEWLINE=true which that adds a line before the powerline/...
Centaro's user avatar
  • 11
1 vote
1 answer
207 views

Compress each directory to its own Zip file from command line

I have a directory of directories. I want to compress each of them in to its own zip file, keeping the same name. I don't want it to be recursive, I just want to compress dozens of folders in the same ...
Will Hanley's user avatar
3 votes
0 answers
194 views

Is there a good way to write a shell script compatible with both bash and zsh that addresses array elements?

The fact that bash is 0-indexed and zsh is 1-indexed can cause problems. For example the following will work as intended with bash, but not zsh (PS I am aware that I don't NEED to use an array for ...
Stonecraft's user avatar
0 votes
2 answers
828 views

How can I run a bash script in zsh?

I want to run a script written for bash in zsh. If I run which bash, I get /usr/bin/bash Following this answer I have created the following script #!/usr/bin/bash echo 'Hello' The file hello is in ...
Psionman's user avatar
  • 153
1 vote
1 answer
97 views

!$ not automatic in Kali Linux

Does anybody know how to change the behaviour of !$ in Kali Linux ? Right now, if I reference last argument using !$ I must enter the new command with the last argument instead of executing a new ...
cbdRedGG's user avatar
1 vote
0 answers
86 views

Autocomplete filepath or show suggestions when adding file using git in zsh

Let's say following is the output of my git status command. On branch LG-201 Your branch is up to date with 'origin/LG-201'. Changes not staged for commit: (use "git add <file>..." ...
Kartik Chauhan's user avatar
1 vote
0 answers
16 views

unwanted nvm manual printout during shell initialization

I have installed nvm using homebrew, and I have the default .zshrc file: export NVM_DIR="$HOME/.nvm" [ -s "$HOMEBREW_PREFIX/opt/nvm/nvm.sh" ] && \. "$HOMEBREW_PREFIX/...
Artur's user avatar
  • 153
0 votes
0 answers
87 views

Propagating zsh window title through tmux, then ssh, to terminal emulator/window manager

My zsh automatically sets my terminal emulator (kitty)'s window title to my current working directory, or whatever program is currently running within it. However, when I ssh to a remote host and run ...
kovas's user avatar
  • 1
0 votes
2 answers
59 views

How do i prevent websites from appearing in autocomplete in terminal?

I am running MacOS if it matters I am new to terminal and work in a lab at my uni, we have a server where we ssh into from our laptops. I am using ZSH as my shell and have no plugins besides git ...
Wex300's user avatar
  • 1
0 votes
0 answers
141 views

Tab completion not working in zsh with custom script to change iTerm profile

I am basically following this (rather dated) gist by Hector Leiva because I want my iTerm color scheme to change when I ssh to specific hosts. I am using ZSH and oh-my-zsh. Everything is working (i.e. ...
Andreas's user avatar
0 votes
0 answers
255 views

~/.oh-my-zsh/oh-my-zsh.sh:17: parse error near `done'

I am keeping to have this error: ~/.oh-my-zsh/oh-my-zsh.sh:17: parse error near `done' when I source ~/.zshrc... This is the file ~/.oh-my-zsh/oh-my-zsh.sh # ANSI formatting function (\033[<code&...
Lisa's user avatar
  • 31
0 votes
1 answer
99 views

Difference between './file' and 'sh file'

On macOS, in the zsh terminal, I ran the following commands: cd /tmp mkdir newdir cd newdir touch file1 ./file1 The last command returned zsh: permission denied: ./file1 But running sh file1 executed ...
Orian's user avatar
  • 3
1 vote
1 answer
413 views

zsh tab-completion for filenames works for some commands, but not others

I wrote a little shell script that lives in the current directory and I invoke it like this: ./import <command> <file>. When I try using tab to complete the filename, zsh just beeps at me. ...
Rick's user avatar
  • 135
0 votes
0 answers
101 views

Is there a best way to export from the Directory Utility?

I want to export all of the data from a page in the MacOS directory utility. In the edit section, it say's I'm looking at Users in node /Active Directory/XXXXX/All Domains. It lists all the users I ...
182exe's user avatar
  • 1
2 votes
1 answer
95 views

Change argument to -y, --yes, --assume-yes

Can anyone help me alter this script to automatically YES? y? I don't need to or want to confirm yes, I just want to pass yes into the shell shortcut. cat << "EOF" >> ~/.zshrc ...
Outer's user avatar
  • 23
0 votes
0 answers
154 views

Trouble using dscl to create and add user to group

I am working on a fix for a piece of software where the provider suggests we should create a user group with dscl and then grant the group ownership of a folder. Users in our environment are on macOS ...
user1849058's user avatar
3 votes
0 answers
269 views

How to shorten directory names in git branches with Powerlevel10k?

I’m using the Powerlevel10k theme for ZSH and I’ve set POWERLEVEL9K_SHORTEN_DIR_LENGTH=1 to shorten all directory names except for the current one. This works as expected: [~/Desktop/Codes/...
N00B_141's user avatar
0 votes
1 answer
70 views

zsh on MacOS catalina 10.15.17

I'm having a little trouble putting this all together... I want to make a simple shell script to organize and sort around 60 GB worth of music and movie files that are spread out over 3 or for 4 ...
ZJS_Spctr555's user avatar

1
2 3 4 5
29