Skip to main content

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
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?
shmichael's user avatar
  • 3,293
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 ...
Saaru Lindestøkke's user avatar
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?
re5et's user avatar
  • 2,363
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 ...
Leon Gaban's user avatar
  • 2,615
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 ...
Nathan Long's user avatar
  • 26.8k
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 ...
gak's user avatar
  • 8,797
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 ...
Nathan Long's user avatar
  • 26.8k
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
juanpablo's user avatar
  • 7,254
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 ...
Henrique Barcelos's user avatar
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 ...
Eli's user avatar
  • 1,113
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?
bneil's user avatar
  • 2,087
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 ...
Nick Tomlin's user avatar
  • 1,097
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, ...
Lynob's user avatar
  • 5,450
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 ...
Damon's user avatar
  • 2,769
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?
bneil's user avatar
  • 2,087
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 ...
BradGreens's user avatar
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 ...
Gabor Marton's user avatar
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 ...
Gordon Seidoh Worley's user avatar
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 ...
Patrick Oscity's user avatar
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)....
Autoplectic's user avatar
  • 1,288
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 ...
shouya's user avatar
  • 2,657
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 ...
Art's user avatar
  • 1,251
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:~/* ~/ ...
Morgan's user avatar
  • 821
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 ~ ...
Aaron's user avatar
  • 521
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}%...
yossi.ittach's user avatar
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?
jordelver's user avatar
  • 2,321
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 ...
Peter Ajtai's user avatar
  • 1,282
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.
Nerian's user avatar
  • 1,307
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 ...
Ortix92's user avatar
  • 1,011
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 ...
Adrien Coquio's user avatar
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 ...
Shnatsel's user avatar
  • 552
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'...
Philip's user avatar
  • 1,625
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 ...
michael's user avatar
  • 5,985
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 ...
Mikko Ohtamaa's user avatar
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 ...
Paul's user avatar
  • 523
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 ...
baxbear's user avatar
  • 516
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, ...
justingordon's user avatar
  • 1,633
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?
marflar's user avatar
  • 533
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 ...
drewrobb's user avatar
  • 901
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 $ ...
Anton Kastritskiy's user avatar
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 ...
gyaani_guy's user avatar
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.
nisc's user avatar
  • 1,112
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 ...
Mikko Ohtamaa's user avatar
35 votes
7 answers
37k views

zsh with Cygwin

How can I configure zsh to be the default shell under Cygwin?
simao's user avatar
  • 903
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 ...
Frew Schmidt's user avatar
  • 1,261
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 ...
user avatar
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 ...
scanny's user avatar
  • 735
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 ...
michael's user avatar
  • 5,985
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 ...
Casey Rodarmor's user avatar
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 ...
Lee Olayvar's user avatar

1
2 3 4 5
29