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

learn more… | top users | synonyms (1)

1
vote
4answers
35 views

What is '“^[b” backward-word' When trying to configure ZSH?

I am on a MAC, and I am trying to figure out shortcuts for my ZSH running on Iterm2. When I type bindkey in the shell, I see (among other mappings), the following: "^[b" backward-word "^[f" ...
4
votes
1answer
279 views

preventing the screen from being cleared when exiting an ssh session

I have rdist set up to push out some of my dot files to all the remote machines that I need to ssh into. I also have zsh as my default shell on all of those machines. When I ssh into a machine and ...
0
votes
1answer
34 views

Installing oh-my-zsh without git

How can I install oh-my-zsh from master on the machine behind firewall and without git and internet access?
13
votes
4answers
2k 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 ...
1
vote
2answers
1k views

Extending history search in zsh

How to extend Ctrl+R search in zsh? It cannot find entry despite it is in history file. Edit: My .zshrc: setopt AUTO_CD setopt CORRECT_ALL setopt EXTENDED_GLOB # History SAVEHIST=10000 ...
8
votes
2answers
162 views

Precedence of && vs & in bash and zsh

Answering this question I discovered a very funny (and subtle) difference between behavior in bash and zsh: In bash: romano@RRyS:~$ pwd /home/romano romano@RRyS:~$ alias x="cd /bin && ...
3
votes
2answers
200 views

Aliasing 'python' to 'ipython' only when 'python' is run without args

I thought it would be nice to have an alias (in ~/.zshrc) to have 'python' aliased to 'ipython' ONLY when 'python' is run without args (otherwise, programs won't launch). First of all, how to express ...
2
votes
2answers
27 views

Clear or disable aliases in zsh

I installed oh-my-zsh to make terminal use a bit easier. One thing that bugs me though is the prolific aliases added by it, like "ga", "gap", "gcmsg", "_", which are harder to remember than the ...
1
vote
1answer
36 views

Stop zsh from completing parent directories

I am using zsh with grml's zshrc as a base. As part of my work I access network path regulary (e.g NFS. AFS.) If I write /a/long/network/path/on/the/other/side/of/the/world press TAB twice it is ...
1
vote
3answers
227 views

Building zsh without admin priv: No terminal handling library found

I am trying to install Zsh without root privileges on a Linux machine. I downloaded the source tarball and run: ./configure --prefix=<my_installation_path> but then I got: configure: ...
-1
votes
0answers
19 views

history - bash, dash, zsh and .profile [duplicate]

For a long time I have been wondering about the existence of many shells in GNU/Linux. To make the question a bit focused I have used only three shells - bash, dash and zsh. From wikipedia articles ...
0
votes
1answer
26 views

Arch Linux running Openbox, with Urxvt, zsh and oh-my-zsh: strange behavior in terminal? (scrot included) [closed]

I'm using Arch with Openbox. Compton as composite manager, ẅith the open source Xf86-video-ati driver, URxvt as terminal emulator (with the perl extension collection, more specifically ...
0
votes
3answers
750 views

Read first line of a command's output. Command connects me to a remote terminal

Part 1 Say I have a command my_command that outputs multiple lines. I would like to capture the first line of my_command's output as soon as it's ready in a script, while keeping my_command ...
2
votes
3answers
145 views

Where are zsh and mksh incompatible with bash?

To what extent can other POSIX-compatible shells function as reasonable replacements for bash? They don't need to be true "drop-in" replacements, but close enough to work with most scripts and support ...
22
votes
0answers
562 views

Completing avfs fake directories in zsh

How can I tweak zsh's completion system to complete “fake” files in some circumstances? More precisely, the AVFS filesystem exposes archives as directories by creating a “fake directory” next to ...
1
vote
1answer
27 views

How can I keep the trailing slash after choosing a directory from the zsh completion options?

In zsh, when I press tab 2 times to enter the "completion menu", select a directory and press enter, it first adds the chosen directory with a trailing slash to the command, but as soon as I press ...
2
votes
2answers
61 views

JSON parsing on the shell

How can I parse JSON output on the shell? For example, Amazon Web Services provides a CLI to retrieve the status of your instances: $ aws ec2 describe-instances <my_instance_id> But the ...
1
vote
1answer
20 views

zparseopts with associative array in older version of zsh

I am confused by the differing behavior of zparseopts in two different versions of zsh. Basically I am trying to set a list of default option values in an associative array and overwrite these ...
2
votes
1answer
53 views

Apply parameter expansion flags to string or array literal in zsh

Sometimes I'd like to apply parameter expansion flags to a string or array literal in zsh. As an example use case, say that I want to split some comma-delimited string $arglist on commas, but prepend ...
34
votes
2answers
5k views

Rebuild auto-complete index (or whatever it's called) and binaries in $PATH cache in zsh

After installing new software, an already opened terminal with zsh won't know about the new commands and cannot generate auto-complete for those. Apparently opening a new terminal fix the problem, but ...
1
vote
2answers
34 views

In zsh how to set an alias for `less` to get stderr output?

I find that there is a "global alias" for zsh. so when I set alias -g L='| less' command L will be replaced with command | less. But it seems that it cannot work with stderr output when I set ...
0
votes
1answer
32 views

I ran `zsh -v` and now I have no shell history [closed]

I just installed zsh today to try it out. I was trying to check my zsh version and I accidentally entered zsh -v which is the verbose option. Now I can't seem to use reverse search on history. How ...
3
votes
2answers
46 views

Sorting strings with ANSI escape codes

I am trying to print a sorted list of all zsh options, with set options colored green and unset options colored red. I cannot get sort to work properly with on the colored lines though.The below ...
14
votes
4answers
1k views

Do we have more history for cd?

cd - can move to the last visited directory. Can we visit more history other than the last one?
0
votes
1answer
43 views

Sourcing files in ZSH doesn't work

Because my .zshrc got quite big I chose to just source other files, but I encounter some errors after logging in to ssh now: /home/rob1nn/.r_inc/exports:13: parse error near `\n' ...
0
votes
1answer
26 views

colors not being expanded in zsh print -P

I have a zsh prompt script that uses print -P to perform prompt expansion. The script does not work properly on a particular remote system that I ssh into. The color directives in the prompt print ...
1
vote
2answers
40 views

Howto include output of a script into the zsh prompt

I would like to add the output of a Python script into my zsh prompt but I am not sure how to do it? Is this done by what is called "PROMPT EXPANSION" in the man pages? Please someone set me on the ...
5
votes
4answers
457 views

How to cd automatically after git clone?

I want to automatically cd to the directory created by the clone command after I git cloned something. Shell: ZSH if that matters.
2
votes
1answer
25 views

search files using group permission

If i need to search files using group permission I use the following command echo **/*(AIE) where AIE stand for read/write/execute. For owner and group permissions the qualifier used are rwx and ...
1
vote
1answer
44 views

Export multiple options in $GREP_OPTIONS

I use ZSH with "OH MY ZSH". In "OH MY ZSH" variable $GREP_OPTIONS exports with multiple value: $ echo $GREP_OPTIONS --color=auto --exclude-dir=.cvs --exclude-dir=.git --exclude-dir=.hg ...
0
votes
1answer
52 views

Neither `less` or `less -X` clear screen on exit

Neither less or less -X clear screen on exit. At the same time, vim does.... Env iTerm2, protocol mosh, server Centos + tmux + zsh iTerm2: report term as xterm-256color tmux: set -g ...
0
votes
1answer
50 views

How do I switch from bash to zsh? [duplicate]

I can start zsh with zsh. How can I make it be the default for new terminal windows? Will it be ok to copy my .bashrc to .zshrc to get things like my customized PS1 prompt.
1
vote
2answers
26 views

open tab in gnome-terminal

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
2answers
49 views

zsh solutions to “the argument list is too long”

I read in this answer from @Gilles the following: In zsh, you can load the mv builtin: setopt extended_glob zmodload -Fm zsh/files b:zf_\* mv -- ^*.(jpg|png|bmp) targetdir/ as a solution to ...
2
votes
2answers
311 views

remove a host from the completion list for ssh in zsh

I once had some hosts named 'myhost', 'myhost1', etc. And now all those except 'myhost3' become invalid. I removed those from /etc/hosts and ~/.ssh/known_hosts, but zsh still completes them for me. Is ...
3
votes
2answers
65 views

zmv command to rename file after matching pattern

I was trying to figure out a solution for this question using zmv. I am unable to find an exact solution using zmv. This is what I could come up with so far. From here, I could rename all files like ...
28
votes
5answers
2k views

When do you use brace expansion?

I understand what brace expansion is, but I don't know how best to use it. When do you use it? Please teach me some convenient and remarkable examples if you have your own tip.
2
votes
3answers
198 views

How can a zsh script test whether it is being sourced?

The accepted answer for a similar question for bash does not seem to work for zsh. In fact, if I copy basically the same code given in that answer, to produce the script #!/usr/bin/zsh - # test.sh ...
3
votes
1answer
32 views

In zsh, what is the meaning of the '$==*' idiom

I have found the $==* idiom in several zsh solutions that I use. It seems to be equivalent to $argv. But I don't know how it gets interpreted. Could you explain?
1
vote
1answer
54 views

zsh syntax highlighting for files

I use zsh-syntax-highlighting package and it colorize all files with the same color as directories (path). I think one should have possibility to customize these colors or at least use $LS_COLORS as ...
5
votes
2answers
64 views

How to make *sh lines shorter

I recently encountered a line of zsh code ls_colors_parsed=${${(@s.:.)LS_COLORS}/(#m)\**=[0-9;]#/${${MATCH/(#m)[0-9;]##/$MATCH=$MATCH=04;$MATCH}/\*/'=(#b)($PREFIX:t)(?)*'}} Not only does this burn ...
9
votes
4answers
762 views

Can I reference a command before '&&' after '&&'

Not sure how else to phrase the question, but basically, I often find myself running a command like vagrant to bring up the VM, and then ssh into it like below: vagrant up && vagrant ssh ...
0
votes
1answer
58 views

$PATH environment variable does not seem to be recognized

I've made a fresh install of Debian Wheezy, and installed zsh to it. Few days after, I've done a vanilla installation of TeX Live 2014, so I added the necessary binary paths to my $PATH. Now I started ...
3
votes
3answers
97 views

Automatically put an alias into ~/.bashrc or ~/.zshrc [duplicate]

Is there a command line util/script that automatically saves aliases? E.g. save-alias my-ip="curl ipecho.net/plain" and that will define an alias, then add/update it in ~/.bashrc or ~/.zshrc I was ...
1
vote
1answer
45 views

zshell is tab-completing ambiguous options

I've been having an issue with zsh completion that's becoming a rather large annoyance. It's completing options beyond where there is ambiguity. For example, in a directory with these files: ...
12
votes
6answers
1k views

Portable way to get script's absolute path?

What is a portable way for a (zsh) script to determine its absolute path? On Linux I use something like mypath=$(readlink -f $0) ...but this is not portable. (E.g., readlink on darwin does not ...
0
votes
0answers
24 views

Zsh - Modify File Completion w/ Quotes

I've been using Zsh recently, and when I complete a file name within quotes, the completion adds a space after the completed file name. Interestingly, this does not occur when I complete directory ...
1
vote
1answer
41 views

Move zsh settings from Arch live to Arch regular

I just installed Arch as a guest (Virtual Box), and I really liked the way that the shell behaved on the live version of Arch. What would the steps be in order to copy those settings (from live) ...
0
votes
0answers
28 views

Zsh script cannot find screens

I have created a zsh script launching many screens in detached mode with particular names and running particular processes in them in order to automate some data analysis in high energy physics. ...
0
votes
1answer
35 views

Zsh script how to concatanate array elements with string

I have written a zsh script to automize an analysis in high energy physics and now I would like to use an element of the one of the defined array some string and another element of some another array ...