Zsh is a shell with many advanced command-line and scripting features.

learn more… | top users | synonyms (1)

0
votes
1answer
42 views

watch equivalent in zsh

In bash, watch (e.g. watch -n 5 ls -l) could be used to repeat the command at fixed intervals. This command seem to be missing on zsh. Is there an equivalent?
3
votes
1answer
186 views

(2x) zsh: command not found

I've finally decided to take the plunge and try out zsh...Running on a CentOS 7 machine. The only thing I find strangely aggravating is that for some reason each time I enter an unknown command, I get ...
0
votes
1answer
29 views

Execute a function before specific programs

This began with the want of adding SSH keys to ssh-agend on demand, but because this isn't possible with OpenSSH, I came up with this zsh script instead. But for a reason I can't figure out, instead ...
1
vote
1answer
56 views

How can I get zsh's completion working in the middle of the filename?

This works Normally, zsh's tab completion works well. $ touch foo-1-bar foo-2-bar $ touch f<Tab> $ touch foo--bar ^ cursor here Pressing Tab again brings up a menu from which I ...
2
votes
2answers
1k views

Configure tmux to use zsh

Right now I have my iTerm session configured to use zsh (/usr/local/bin/zsh), but I'm trying to configure tmux to use zsh as well, instead of /bin/bash/, which it's currently defaulting to. So far ...
4
votes
1answer
133 views

Append (alter) each array element via parameter expansion (i.e. without printf)?

Let the script below exemplify my quandary.. #!/bin/zsh STUFF=( moose-hoof ovary clydsedale ) echo ${MINE=$(printf "MY-%s " $STUFF)} echo ${MINE_EXP=${STUFF/^/MY-}} MY-moose-hoof MY-ovary MY-...
4
votes
1answer
378 views

How to trigger a 2nd command when a specific command is run in the shell?

I'll explain my question with example. I run $ python manage.py to perform some action. I want to run another command $ xyz , just when any user runs the previous command. Thus, from now on, ...
1
vote
1answer
124 views

How to programatically send break signal (Magic SysRq) through serial terminal

I have following setup - I have 2 computers connected by serial connection (null modem) emulating vt220. I'd like to send break signal (Magic SysRq) from shell script - is it possible without writing ...
1
vote
0answers
41 views

Can I prevent zsh slowing with a large history?

I've just migrated from bash to zsh. I converted ~/.bash_history for use in zsh. It's 150 000 lines long. bash is almost instantaneous to start up, but zsh is now fairly slow, taking half a second to ...
0
votes
1answer
72 views

How can I delete to a slash or a word in zsh?

Bash behaviour I've just migrated from bash to zsh. In bash, I had the following line in ~/.inputrc. "\e\C-?": unix-filename-rubout Hence, Alt+Backspace would delete back to the previous slash, ...
1
vote
1answer
84 views

copy&paste in zsh

I've build myself this little script for zsh, to copy & paste within zsh to the system clipboard (basically got everything from here: zsh copy and paste like emacs) x-yank() { zle copy-region-...
1
vote
1answer
16 views

zsh jump to the end of copy from X clipboard

I would like to get Ctrl + V and Ctrl + X to paste / copy from zsh to X11. I found the following snippet to work but zsh does not jump to the character after paste. How could I do that. copy-to-...
3
votes
4answers
74 views

Sticky entries in shell history

Is there a way one could make some commands "sticky" in a shell history? I want to save some favourite commands that would be searchable with Ctrl+R, like the rest of the history, but they should ...
3
votes
0answers
88 views

No zsh-syntax-highlighting within tmux

I experience proper zsh-syntax-highlighting (see here) when first opening a shell session, but as soon as I enter tmux, the syntax highlighting no longer appears. I found this Github issue ...
6
votes
2answers
1k views

zsh: Disable “file exists:” warning with redirection

How can I override the file exists: warning from zsh? > echo > newfile.txt > echo > newfile.txt zsh: file exists: newfile.txt In these cases I prefer my shell to not complain and ...
6
votes
2answers
338 views

In zsh, how can I more quickly disown the foreground process?

My method for disowning the foreground process takes too much effort. Suppose I have a process in zsh's foreground. I want to disown it, so I can close the shell without the process being sent a ...
3
votes
2answers
2k views

Disown won't take -h option

I'm running a command that I now realize I'd like to leave running after I close my SSH session. I didn't start it with a & argument, but I have put it in the background (CTRL-z, bg). Now I'm ...
1
vote
0answers
41 views

tmux start process if not already running

In my .zshrc, I have a bit of logic that will automatically start a tmux session or, if sessions are already running, prompt to attach to one of them or create a new one and attach to that. This all ...
0
votes
2answers
21 views

Looking for a (preferably “all-zsh”) alternative to printenv that can handle Unicode in variable names

zsh supports variable names with Unicode characters (if the multibyte option is set), but printenv (at least GNU's version 8.23 thereof) doesn't seem to be able to handle such variable names. For ...
0
votes
1answer
28 views

Why don't subshell expressions in ~/.zshenv lead to infinite regress?

I understand that ~/.zshenv gets sourced every time that an instance of zsh starts. This implies that having the following line ~/.zshenv would result in an infinite regress: (echo "$$ $(date)" >&...
5
votes
1answer
1k views

Combining zsh’s tab completion with case insensitivity

I have zsh 5.0.7 configured to use case-insensitive tab completion with zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' The problem I’m having is that this case insensitivity often leads ...
5
votes
4answers
642 views

Why does `==` behave differently inside `[ … ]` in zsh and bash?

I get what I expected when doing this in bash: [ "a" == "a" ] && echo yes It gave me yes. But when I do this in zsh, I get the following: zsh: = not found Why does the same command (/...
3
votes
1answer
36 views

Looking for a map of the xinit/startx rabbithole

Can someone point me to an authoritative guide to the X11 initialization sequence that also explains how it dovetails with the shell's initialization? I'm trying to figure out how to make some ...
4
votes
0answers
28 views

How do I write a custom filename completer for specific directories in zsh?

I've found that file names with dates before the title are difficult to tab-completion. I'd like to write custom completion functions for these directories. How do I specify that the completer should ...
10
votes
3answers
651 views

How to implement “generators” like $RANDOM?

The special variable $RANDOM has a new value every time it's accessed. In this respect, it is reminiscent of the "generator" objects found in some languages. Is there a way to implement something ...
0
votes
1answer
62 views

bash-like last command in history using up-down arrow keys in zsh [duplicate]

In bash, we can use the up and down arrow keys to get the last or nth previous command in history. Can we do this in zsh?
4
votes
2answers
120 views

How can I kill my backticked yes process?

I was playing around in my terminal, which runs zsh. I typed the following: $ ` bquote> yes bquote> ` And then, yes started to run in the background, I think. Neither Ctrl + C nor Ctrl + \ ...
1
vote
1answer
26 views

Can I auto-complete by tab in zsh with regular expression

I use oh-my-zsh configuration. When I want to auto-complete, I need to first type correctly the initial letter. For example go, then tab will give google-chrome. If I type *le-ch*. It didn't work. How ...
3
votes
1answer
26 views

command-click git commit ID in Terminal, and be taken to that commit in github?

I'm running a Mac and use iTerm with ZSH as my shell. Currently I can command-click (⌘+click) on links or directories in my iTerm window, and that directory or web link will open. Is there a way (...
3
votes
2answers
224 views

How to open new tab in the current gnome-terminal window?

I ran gnome-terminal --working-directory=$DIR but it opens in a new window, not tab. Things I've tried: --tab -T --add-tab Running RHEL5 with zsh
-3
votes
1answer
86 views

Works in Bash but not ZSH? … alias ls='ls -lh' [closed]

alias ls='ls -lh' Previously used this in bash to achieve default ls arguments Trying to move to ZSH but have discovered this trick does not work. Is there a preferred way to do this in ZSH? ...
0
votes
0answers
14 views

Why is zsh seemingly ignoring no_list_beep?

I have zsh (5.1.1) on OS X (10.10.4), and am using oh-my-zsh with various plugins. When I type e.g. ls z in a directory with multiple items starting with z, zsh beeps and then displays an ...
3
votes
0answers
77 views

Suspend a process silently with ctrl-z

With my current workflow, I frequently use CTRL-z to suspend Vim so I can enter a quick few commands before resuming editing my code with fg (actually, it's CTRL-z again, thanks to the handy ZSH tip ...
11
votes
2answers
732 views

Is there a reason why the first element of a Zsh array is indexed by 1 instead of 0?

From my experience with modern programming and scripting languages, I believe most programmers are generally accustomed to referring to the first element of an array by 0 as index. Are there any ...
2
votes
1answer
40 views

Cancel an option used in aliased command?

Suppose for example, the following implementation of ll: alias ls="ls -F -G" # colourise and display dir,exec,etc. icons alias ll="ls -l -h -o" # long-list, use KB,MB,etc. sizes, no ...
1
vote
1answer
40 views

Why are some ZLE sequences being remapped to “self-insert”?

I've been tinkering with my dotfiles lately, and at some point I lost use of the default ^A and ^K keymappings, which I use frequently. bindkey -L | grep '\^[AK] # bindkey -R "^A"-"^C" self-insert # ...
0
votes
1answer
43 views

What's the equivalent wildcard operator in Zsh to Bash's *

I have just started using Zsh and I have noticed that the asterisk (*) wildcard operator does not seem to work in it. For example, running cd ~/Doc* does not change me into the ~/Documents directory ...
10
votes
3answers
365 views

Defining an alias and immediately use it

In zsh this works fine: alias foo=ls foo But this does not: alias foo=ls; foo Pressing enter an extra time is not an issue when running interactively. But when running through ssh it suddenly ...
3
votes
1answer
124 views

Shell function to check if there is a suspended process that's a child of this shell?

I'd like to add an indicator to my PS1, showing whether there is a process suspended with ctrl+z. In order to do so, I'll need a function that is able to check for this situation. I'm not even sure ...
1
vote
1answer
46 views

zsh-newuser-install not working

I recently started using zsh as my default shell on my Fedora system. Today I installed a fresh CentOS 6.7 system and changed the shell after installing zsh on it for userx using: [tu3@TestC001 ~]$ ...
0
votes
0answers
48 views

Set a ZSH shell variable using mintty?

I have configuration files that I use to make my PS1 fancy. The design depends on the presence of a particular font. If the font isn't present, the PS1 looks ugly. I share access to a webmaster ssh ...
8
votes
2answers
1k views

Gnome-terminal and Zsh: keep current directory on new tab/window

I'm running gnome 3.10.1 on Arch with Zsh. I'm facing that problem that when I create a new tab or window from a terminal window, it resets the current dir to my home dir. I've already tried this: ...
21
votes
5answers
18k views

Making zsh default shell without root access

I am using my school's computers and would like to use zsh instead of bash. I'd like to make it default, but I cannot run a command such as $ chsh -s $(which zsh) because I don't have admin privileges....
2
votes
1answer
89 views

How to configure Ctrl+w as delete word in zsh

I want to delete a word by Ctrl+W in zsh like. vim /foo/bar^W vim /foo/ And found a solution for bash, but bind is not in zsh function. Is it possible to configure ctrl-w (delete word)? How can I ...
4
votes
1answer
451 views

Disable the configuration tool in Zsh

When there is no .zshrc file in a user's home directory and zsh is started, an interactive configuration utility is run instead of directly giving access to the shell prompt. I set up zsh to be the ...
4
votes
1answer
186 views

Zsh prompt filling whole width with user input in next line

I'd like to have the left and right prompt in one line and a background color spanning the full line. The user input should be in the next line. hostname | ~/path/to/cwd ...
1
vote
1answer
40 views

What's the intended use case for COMPLETE_ALIASES in zsh?

For some months now, I have had setopt completealiases in my .zshrc. I haven't the faintest idea why I added it - most other things have comments or can be understood from neighbouring settings. ...
3
votes
2answers
107 views

How to know why and where the $PATH env variable is set?

I'm using zsh 5.0.8 version in iterm2 on OSX. I start my computer and printenv shows me the $PATH variable: /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin from my understanding, ...
1
vote
1answer
716 views

Installing powerline fonts for zsh + Prezto theme

I am currently using Zsh + Prezto for my scripting shell configuration. I have been using the sorin theme but am a little dissatisfied with it. I'd like to switch to the paradox theme! It is supposed ...
0
votes
1answer
66 views

Zsh theme not being applied [closed]

I want to use zsh and the hassle starts already with setting the theme. I have .oh-my-zsh on my ~ I have a .zshrc file with the following line: ZSH_THEME="3den" I changed my standard-shell to zsh ...