Questions tagged [zsh]
Zsh is a shell designed for interactive use, although it is also a powerful scripting language.
1,429
questions
293
votes
5
answers
237k
views
Zsh not hitting ~/.profile
I've just installed zsh on my Ubuntu system. It seems zsh isn't executing ~/.profile on init. To my best understanding, this should be an automatic behavior. What am I missing?
244
votes
3
answers
60k
views
Why are tar.xz files 15x smaller when using Python's tar library compared to macOS tar?
Context
I'm compressing ~1.3 GB folders each filled with 1440 JSON files and find that there's a 15-fold difference between using the tar command and Python's built-in tarfile library on macOS or ...
225
votes
13
answers
195k
views
How can I make tmux use my default shell?
On a new setup, tmux is using bash instead of my default (zsh).
How can I force it to use zsh?
166
votes
5
answers
1.2m
views
Where is the .zshrc file on Mac?
I’m using iTerm and wanted to customize the look of my terminal window using Oh My ZSH!. And according to the documentation I need to change the ~/.zshrc file and add a ZSH_THEME value:
Once you ...
162
votes
10
answers
226k
views
How can I do a recursive find and replace from the command line?
Using a shell like bash or zshell, how can I do a recursive 'find and replace'? In other words, I want to replace every occurrence of 'foo' with 'bar' in all files in this directory and its ...
127
votes
2
answers
67k
views
How to fix and recover a "corrupt history file" in zsh?
After a reboot, I started seeing a message when loading the shell:
zsh: corrupt history file /home/myusername/.zsh_history
How can I recover from this situation and potentially recover some of the ...
126
votes
4
answers
135k
views
ZSH - output whole history?
I recently switched from bash to zsh. In bash, one way (besides recursive search) that I used to find previously-run commands was history | grep whatever, where whatever is the bit of command I ...
111
votes
6
answers
99k
views
scp with zsh : no matches found
when I try scp over zsh, I get
scp hostA:Descargas/debian-6.0.4-* [email protected]:Escritorio/Software/
zsh: no matches found: hostA:Descargas/debian-6.0.4-*
the same command work in bash
107
votes
3
answers
57k
views
What exactly is <() in bash (and =() in zsh)?
I'm pretty comfortable with bash, but recently I ended up in a substitution I didn't know.
What exactly is <(command) in bash?
How does it compare to the =(command) in zsh?
I understand that this ...
101
votes
16
answers
80k
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 ...
83
votes
2
answers
38k
views
How to prevent a command in the zshell from being saved into history?
In Bash I know putting a space before a command prevents it from being kept in the history, what is the equivalent for the zshell?
76
votes
3
answers
45k
views
ZSH: Read command fails within bash function "read:1: -p: no coprocess"
Edit:
Seems to work within bash. It appears the problem is related to zsh. If there is a better site to post this issue on let me know.
I am writing a simple script that creates a series of ...
74
votes
3
answers
82k
views
Zsh says "no matches found" when trying to download video with youtube-dl
I downloaded youtube-dl using pip on CrunchBang (a Debian Wheezy distro). When I run
youtube-dl {video URL}
I get
zsh: no matches found: {video URL}
I guess it has something to do with zsh, ...
67
votes
3
answers
85k
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 ...
65
votes
9
answers
61k
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?
61
votes
6
answers
16k
views
zsh (z shell) numpad/numlock doesn't work
I just upgraded to zsh/oh-my-zsh. Almost immediately I notice on my machine that the 10-digit numpad is not working. It was working in bash and fish shell.
Oddly, if I hold down the fn/function key ...
60
votes
4
answers
35k
views
How to remove zsh alias?
I have an alias which is predefined by an oh-my-zsh plugin.
-> % alias gcm
gcm='git checkout master'
I'd like to remove it, i.e. I'd like alias | pcregrep "\bgcm\b" return 1.
I've tried with ...
59
votes
4
answers
63k
views
Bash autocomplete like zsh
I'm using bash, but I'd like to have zsh style autocomplete (you hit tab and it tabs through the possibilities), rather than what bash seems to do, which is display a list of possibilities but not ...
59
votes
2
answers
50k
views
oh-my-zsh history completion
I have recently switched to zsh, using robbyrussell's oh-my-zsh. Before that i used bash with a lot of custom stuff and i am only missing one thing because zsh is trying to be 'too smart':
If i type ...
59
votes
5
answers
55k
views
invoke zsh, having it run a command, and then enter interactive mode instead of exiting
i'd like to start zsh similar to
zsh -c 'my_prog option1 option2'
but instead of exiting after running that command, leaving me at the propt of the invoked zsh (not wherever it is being called from)....
57
votes
5
answers
26k
views
How to partially disable the zsh's autocorrect
The autocorrection function of zsh is very helpful for me but it does't always gives a proper result.
~$ sudo vim somefile
zsh: correct 'vim' to '.vim' [nyae]?
Yet what I want is something like the ...
56
votes
3
answers
45k
views
Command history in zsh
Currently I have zsh set up in such a way that command history is shared between all sessions immediately.
Say I have a terminal emulator open with two tabs, each with a zsh session, A1 and A2. If I ...
55
votes
3
answers
40k
views
Using wildcards in commands with zsh
Using commands such as rsync and scp with ZSH I've run into trouble. Instead of the (normal) behaviour of giving me all matching files, it won't run and returns:
➜ ~ rsync -azP user@server:~/* ~/
...
52
votes
1
answer
29k
views
How can I make zsh tab completion fix capitalization errors for directories and files?
I switched to zsh completely on a previous arch install and I LOVED it mainly because arch is one of the distros that capitalizes your Documents, Downloads, Music and such directories in your ~ ...
51
votes
6
answers
54k
views
Add timestamp to oh-my-zsh robbyrussell theme
I want to add a timestamp to my command prompt in oh-my-zsh. This is the current theme prompt (robbyrussell):
local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ %s)"
PROMPT='${ret_status}%...
49
votes
2
answers
62k
views
zsh config - to export or not to export?
When setting variables in my ~/.zshrc I can either use export
export PATH=/some/path
or not
PATH=/some/path
How do these differ and which should I use?
49
votes
4
answers
19k
views
ZSH only displaying last 16 or so commands with history. HISTSIZE & SAVEHIST are 500
In ZSH when I type history I'm only displayed the last 16 or so commands. I would like history to display all the existing commands in the history file.
When I look in my .zsh_history (my history ...
48
votes
11
answers
35k
views
Open a new tab in the same directory
Say you are in /very/cool/and/deeply/nested/folder . And you want to open a new terminal tab in the same folder.
How would you do that?
I use Mac OS and Zsh.
48
votes
4
answers
40k
views
UTF8 characters in windows 10 bash terminal
I have installed the new bash shell on windows 10. I'm using it together with ZSH. However, none of the utf8 characters work, they appear as square blocks. How do I enable utf8 character encoding in ...
45
votes
4
answers
20k
views
Tmux and ZSH custom prompt : bug with window name
I have customized my ZSH prompt with oh-my-zsh to make it more readable and add information about git if I'm in a repository.
Example :
bob@inf [~/docs] %
bob@inf [~/src/nicest] master % (in a git ...
45
votes
2
answers
24k
views
What's the ZSH equivalent of BASH's $PROMPT_COMMAND?
BASH supports a $PROMPT_COMMAND environment variable that defines a command to be executed before any first-level interactive prompt. I'm looking for a ZSH equilvalent of that.
The documentation says ...
44
votes
3
answers
19k
views
Iterating over keys (or k/v pairs) in zsh associative array?
In zsh, I want to iterate over an associative array. I need both keys and values. But when I iterate over the associative array normally (for x in $assoc_array), I get only values.
All examples I'...
44
votes
3
answers
104k
views
How can I configure the color of 'ls' directory under zsh
I am using 'zsh'. In some directory, when I do ls --color=tty. I see some directories have
'blue text' with 'green background', which makes them hard to read.
Can you please tell me how to configure ...
42
votes
6
answers
29k
views
ALT+arrow moving between words in zsh and iTerm2
I logged in on one of hosting provider servers and noticed ALT + left and ALT + right moved between words in a shell prompt in GNU Screen.
What kind of key bindings I need to configure and where to ...
42
votes
5
answers
10k
views
Typing 'git log --oneline' in oh-my-zsh pipes to 'less'
I just switched to Oh My Zsh and I'm using the Avit theme.
When I type git log --oneline my output seems to be piped to less. It does this for whatever theme I use.
When I used bash shell, it never ...
39
votes
1
answer
3k
views
Accidentally deleted log file of running process `python something.py 2>&1 | tee .log`. Is there a way to still save the output on the tmux-pane?
Accidentally deleted log file of running process python something.py 2>&1 | tee .log. The script is running in a tmux pane on zsh. The process is still running but not logging. The output ...
39
votes
1
answer
17k
views
Any way to get list of functions defined in zsh (like alias command for aliases)
I can type
alias
and get a list of defined aliases in zsh
How can I get a list of function names defined in zsh?
When I type "functions", my shell window hangs after displaying lots of functions, ...
38
votes
4
answers
8k
views
Does the Shellshock bug affect ZSH?
Does the Shellshock Bash bug affect ZSH?
Is upgrading Bash the only solution?
38
votes
2
answers
34k
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 ...
36
votes
4
answers
93k
views
Zsh prompt with current working directory
In bash I have my PROMPT set like so
PS1="$(scutil --get ComputerName) \W\\$ "
Where I only see the computer name and only the name of the current directory that I am in, not the full path and a $ ...
36
votes
5
answers
31k
views
How to change the default shell in Cygwin?
I am trying to change my default shell from bash to zsh in cygwin.
The normal unix command chsh isn't available on cygwin
The etc/passwd file it seems isn't used anymore in existing versions of ...
36
votes
5
answers
25k
views
Bash/ZSH: Undoing 'disown'
Is there a way to 'reattach' a process to the shells job table after it it has been 'disowned'?
Edit: $SEARCHENGINE totally fails me. Doesn't look too good.
36
votes
7
answers
10k
views
Separate up arrow lookback for local and global ZSH history
Is it possible to...
Step up local ZSH shell history (actions only happened in that prompt)
Step up global ZSH history (shared history is on) - default what happens when you press UP arrow when ...
35
votes
7
answers
37k
views
zsh with Cygwin
How can I configure zsh to be the default shell under Cygwin?
34
votes
6
answers
12k
views
What zsh features do you use? [closed]
I do a lot of work in the terminal so I have learned a lot about my shell of choice, zsh. What features of zsh do you use to make yourself that much more productive at work? One of my favorites is ...
34
votes
2
answers
25k
views
Searching through history with up and down arrow in zsh
When I first switched to ZSH when I would use the up arrow key to move through history it would filter the history based on what I had already typed so if I type mysql and then up I would be stepping ...
34
votes
1
answer
3k
views
How stop zsh from eating space before pipe symbol?
When I type a space followed by the pipe symbol '|' on the zsh command line, zsh eats the space, placing the pipe symbol directly up against the prior word. How do I stop it from doing that? I'm not ...
33
votes
2
answers
112k
views
In zsh how can I run a script which is written for bash
I have switched to zsh, how can I run a script which is written for bash?
I don't want to modify the script to put #!/bin/bash in the beginning for the script since it is version controlled.
Is ...
33
votes
4
answers
13k
views
ZSH tab completion of git commands is very slow. How can I turn it off?
If I type:
rm <TAB>
I'll see possible completions almost instantly.
However, if I type:
git rm <TAB>
It'll hang for several seconds if it's in a git repo, or fail to show any ...
33
votes
2
answers
9k
views
zsh, up arrow only repeats unique commands?
I'm looking for a setting that will make it so that when i hit the up arrow, zsh shows commands i have recently edited. The catch is, i only want unique commands. Currently, if i type echo "hello ...