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

learn more… | top users | synonyms (1)

1
vote
1answer
35 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
38 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
356 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
108 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
38 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
42 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: ...
18
votes
5answers
16k 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 ...
2
votes
1answer
76 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
443 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
160 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
39 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
98 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
643 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
61 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 ...
2
votes
1answer
28 views

Get full path of current zsh startup file (e.g. zshrc or zshenv)

Is there a way to get the full path of the current zsh startup file being processed (e.g. zshrc or zshenv)? In other words, imagine I have a zshrc file that can either be located at ...
1
vote
3answers
2k views

zsh alias being overridden somehow

I'm on a system running OS X 10.8.5. I recently tried to alias ls to ls -G -la command. I opened up ~/.zshrc, put in the alias, relaunched the terminal, but the change didn't take effect. Upon ...
4
votes
2answers
452 views

Multi-month view in calendar (cal) in OS X

I am hoping to run some of the commands listed in this article, e.g.: cal -3 which is supposed to show me the last month, this month, and next month. This command does not work in OS X. $ cal -3 ...
1
vote
1answer
85 views

How to declare some aliases dynamically in zsh?

I would like to declare a few shortcut commands to switch between my various coding projects, so I have come up with the following script. projects=$(ls -d ~/Workspace/*/) ...
6
votes
2answers
242 views

What is causing `diff` to run `git diff`?

I'd like to use diff as described here and in the documentation I see when I type man diff. However, when I type diff, what I get is this: ~ ❯❯❯ diff usage: git diff --no-index <path> ...
4
votes
2answers
622 views

Thousands separator in printf in zsh

I have been trying to define a thousands separator in printf for a while now and I have discovered that zsh has some problems with it. In bash I can use something like: $ printf "%'d\n" 1234567890 ...
3
votes
1answer
126 views

What is the best way to pipe the output of a command through a pager if (and only if) it is too long?

I'd like to be able to be able to wrap a command so that if its output doesn't fit in a terminal it will be automatically piped through a pager. Right now I'm using the following shell function (in ...
1
vote
1answer
31 views

strange setopt behavior

For certain options, setopt doesn't have an effect. ➜ ~ setopt | grep history extendedhistory ➜ ~ setopt appendhistory ➜ ~ setopt | grep history # appendhistory apparently didn't get set ...
6
votes
2answers
7k views

How to display the name of the current Virtualenv?

I'm using virtualenv, virtualenvwrapper, zsh, oh-my-zsh, terminator, on Crunchbang. I'm trying to display the name of the current virtualenv like so workon example (example)... I've tried many ...
4
votes
1answer
144 views

How to create string with invalid unicode characters, in Zsh?

For some testing purposes I need a string with invalid unicode characters. How to create such string in Zsh?
5
votes
2answers
4k views

Spaces as line breaks from inline for loop command

Someone care to enlighten me as to why the spaces in the first command seem to be interpreted as line breaks? Also occurs substituting print for echo. $for l in $( find *.txt -exec head -1 {} \; ); ...
49
votes
5answers
10k views

How to use `which` on an aliased command?

Like most users, I have a bunch of aliases set up to give a default set of flags for frequently used programs. For instance, alias vim='vim -X' alias grep='grep -E' alias ls='ls -G' The problem is ...
2
votes
3answers
184 views

Repeating command with different filenames

Here's a layup for someone... I'm having to run a command repeatedly: $ wp input csv MyCSV01.csv directory_name $ wp input csv MyCSV02.csv directory_name $ wp input csv MyCSV03.csv directory_name ...
4
votes
1answer
332 views

/etc/paths in OS X and other Unices

Is /etc/paths read by every shell that I run in OS X? For example, if I use zsh, will it parse /etc/path to populate $PATH? What exactly is the sequence that OS X follows to populate $PATH? Does it ...
6
votes
3answers
414 views

${#array} vs ${#array[@]}

As far as I can tell both ${#array[@]} and ${#array} evaluate to the number of elements in $array. Is there any reason for preferring the longer form (${#array[@]})?
2
votes
3answers
416 views

Why rm exclude using ! doesn't work in zsh?

I have 10 files in current directory: 10test 1test 2test 3test 4test 5test 6test 7test 8test 9test I want to remove all file except 2test and 3test, but I run command rm !(2test|3test) doesn't ...
3
votes
1answer
94 views

move files based on pattern with zsh/zmv

How could I move files to subdirectories based on the common part of their names? For example, with files named as comment_LastName.pdf and comment_LastName.md and sub-directories named as ...
0
votes
1answer
48 views

How to create multiple dot files using brace expansion?

I want to create a bunch of dot files using brace expansion, but it doesn't work: touch .{a..h} the result is a file .{a..h} is created instead of .a .b .c ...
0
votes
2answers
85 views

Unexpected prompt in zsh

Can someone explain to me why I am getting this shell prompt when I'm in the /home directory, and how to get rid of it?  I am using zsh. I want it to display only the following: user@host ~ % but ...
9
votes
7answers
343 views

Check variable is an array in Bourne like shell?

In Bourne like shell which support array variable, we can use some parsing to check if variable is an array. All commands below were run after running a=(1 2 3). zsh: $ declare -p a typeset -a a ...
2
votes
2answers
244 views

Shell valid function name characters

Using extended Unicode characters is (no-doubt) useful for many users. Simpler shells (ash (busybox), dash) and ksh do fail with: tést(){ echo 34; } tést But bash, mksh, lksh, and zsh seem to ...
0
votes
0answers
32 views

Fill the name of last-run program in Bash

Suppose I execute some command: ls -l ~/some_dir. I would like to create an alias, such that I could execute man with the name of the last-run program as a parameter, i.e., man ls in this case. ...
1
vote
0answers
145 views

How to change theme with zsh

I am using this configuration on my mac(unix) to customize my shell. I am using zsh instead of bash and there are too many things along with zsh. This .dotfile configuration contains vim, zsh, git, ...
1
vote
2answers
51 views

how to grep for packages on basis of uncompressed file-size?

In Debian when you look at a package, you get lot of info. Including the uncompressed file size of the package. Is there a way to grep through the file-listing so that packages appear either from ...
7
votes
3answers
4k views

key bindings table?

Do we have a key bindings table that translates all the various ways of referring to a key press? I'm using zsh, but I presume that if there was such a table it would work for any shell. The reason I ...
9
votes
4answers
186 views

Right-to-left shell brace expansion

In zsh (and other shells), if I include an argument like (for example): {a,b,c}{d,e,f} brace expansion turns it into: ad ae af bd be bf cd ce cf For my purposes, the argument order is important, ...
5
votes
3answers
114 views

Is “Arithmetic Expansion” the expected action on vars inside `[[` tests?

This script: a=2 [[ "$a" -eq 2 ]] && echo yes1 [[ $a -eq 2 ]] && echo yes2 [[ a -eq 2 ]] && echo yes3 [[ "a" -eq 2 ]] && echo yes4 Does not work in dash (and ...
3
votes
2answers
79 views

Shebang line for “run with $SHELL”

I'm looking for what to put on my_zsh_script.sh's "shebang line" that would have the same effect, portably, as $SHELL my_zsh_script.sh IOW, I looking for the valid equivalent of #!$SHELL or ...
21
votes
0answers
688 views

How to combine zsh autocomplete for wrapper function arguments and existing command

I work mostly in gvim and many terminals. Originally, I preferred to open all my files in a single vim instance. To that end I used an alias to open files from my terminals in the current 'vim ...
0
votes
0answers
37 views

Setting tmux session title in zsh

There was a similar question about screen regarding this here, but I was unable to get this working with tmux. From what I understood printing a string with prepended with \033k and appended with ...
6
votes
1answer
164 views

Replace current process by its coprocess/child

I have a program P that expects to receive "Hello" and output "Why?" before providing a feature. This feature is used by other programs that are not aware that it is common courtesy to start a ...
16
votes
4answers
4k views

Share aliases and PATH setting between zsh and bash

The shell that I normally use is zsh. I have several aliases to enable color in some programs such as ls and grep. I've also set my custom path so that I can execute programs in non-standard place ...
5
votes
1answer
111 views

In zsh, what's the difference between &! and &|?

In my adventures with disown, I also discovered that in zsh, program &! starts and immediately backgrounds and disowns the program, so you can close the shell without the program getting a SIGHUP. ...
2
votes
2answers
41 views

Forcing the expansion of a global alias in part of a word

I have a couple of scripts /tmp/foo/bar.sh and /tmp/foo/baz.sh, the look like this: # /tmp/foo/bar.sh alias -g __FILE__='${(%):-%x}' alias -g __DIR__='${${(%):-%x}%/*}' printf "sourcing %s\n" ...
2
votes
0answers
20 views

On using $hash_array[$(global_alias)]

Identical code works on one system, fails on another: % zsh --version zsh 5.0.7 (x86_64-pc-linux-gnu) % typeset -A frobozz % alias -g foo='echo xyz' % frobozz[$(foo)]=9 % echo ${(kv)frobozz} xyz 9 ...