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

learn more… | top users | synonyms (1)

2
votes
2answers
289 views

Distributing thousands of files over subfolders

I have a folder A with hundreds of thousands of files. I would like to move these files to new subfolders S_i, with, say, 100 files in each (the last folder may have less than 100 files) In other ...
3
votes
1answer
612 views

Zsh completion of brew formulas

In OS X, is there any way to have Zsh (I'm using Oh-my-zsh) tab-complete formulas? E.g. $ brew install em<TAB> could expand to: $ brew install emacs
6
votes
1answer
294 views

ZSH host name completion behaviour change?

I have been using ZSH to do host name completion, and want to change the default behaviour. When I have multiple hosts with similar names, the completion does stuff that I don't care for. An example ...
4
votes
1answer
552 views

How to disable “auto cd” in zsh with oh-my-zsh

Googling this didn't show up any results. Here's what I mean: I have a binary file named x in my path (not the current folder, but it is in the PATH), and also a folder with the same name in the ...
1
vote
0answers
141 views

Can't open vim in zsh? [closed]

I recently decided to try out zsh, but for some reason I cannot open Vim in a zsh shell. Currently, my default shell is bash. If I open up a terminal window, then run zsh to enter a zsh shell, I have ...
7
votes
3answers
3k views

What's the newline symbol in zsh's PS1?

I'm trying to setup a multiple line PS1, for zsh, but \n doesn't was parsed by zsh, PS1="%~\n %> " How should I set it up?
9
votes
1answer
2k views

How to enable reverse search in zsh?

I recently switched to zsh (finally) and am loving it! So far one thing that I am missing is Ctrl+R to do incremental history search. I have the history set up properly HISTSIZE=10000 SAVEHIST=10000 ...
-3
votes
0answers
74 views

What's the main difference between bash and zsh? [closed]

Someone told me that some commands in zsh shell may differ from the bash shell commands. So what's the main difference between zsh and bash shells?
1
vote
1answer
1k views

Sudo su issue on ubuntu 14.04 lts: /root/zsh can't not be found

I have recently re-installed ubuntu 14.04 lts and I installed my favorite shell (zsh) but I am having an issue now. When I type, sudo su it comes back with an error stating /root/zsh can not be ...
5
votes
5answers
133 views

`ls -l` of a file and all the directories leading to it?

Before I start writing a (probably easy) script, is there a command that does the equivalent of the following one: [:~/software/scripts] % ls -ld / /usr /usr/bin /usr/bin/tee drwxr-xr-x 21 root root ...
8
votes
5answers
200 views

How can I “stack” shell aliases?

In my .profile (sourced in sh emulation mode from my .zshrc) I have the following snippet: if [ -f /usr/bin/pacmatic ]; then alias pacman=pacmatic fi # Colorized Pacman output alias ...
0
votes
1answer
383 views

Zsh ssh tab completion not working as expected on OS X

I use Zsh on two different machines (OS X and Ubuntu) and the tab completion for ssh does not work the same way. More specifically hosts specified in the file ~/.ssh/config is NOT used on OS X but it ...
0
votes
3answers
631 views

Proper place to put shell prompt(PS1) when use sh/bash/zsh together

I'm using dash(sh) or bash or zsh. If possible, I would prefer to put in common place. I want to put proper PS1 settings when I interactive with shell, so these situation should be considered login ...
1
vote
1answer
76 views

Is there an advantage in using ksh over zsh? [closed]

Or are there any advantages for using ksh over zsh? Would any specific commands not execute successfully across the shells or are the major differences not command related, but something else?
2
votes
2answers
274 views

Screen: Current directory in caption bar (not as title)

How can I show the current directory of the currently active session in a screen status bar (not as title of the session!)? I have tried with various combinations n,m={0,1} of backtick 102 n m pwd ...
0
votes
1answer
62 views

What speed should zsh connect to tmux at?

I think this is a tmux question, though it may be a zsh question, or a question relating to both. I SSH to a server from a Windows box using PuTTY. In the PuTTY configuration window, in the Data ...
3
votes
1answer
440 views

Broken history search after upgrade of oh-my-zsh

I did the auto-upgrade of oh-my-zsh a few days ago. Now my filtered history (type a few letters and up arrow) no longer works. I did not realize how dependent I became on it. EDIT: For example, I ...
4
votes
3answers
387 views

zsh: How to check if an option is enabled

To enable an option, we can use setopt. e.g.: setopt extended_glob How can we check if an option is currently enabled ?
1
vote
2answers
226 views

Get scan codes in octal format

Using showkey -s I can get the scancode of a key as a hex-number. How can I get it directly as an octal number?
2
votes
2answers
454 views

Is it safe to remove the .oh-my-zsh directory?

One point in time, I tried oh my zsh but it causes a lot of issues so I'm back at bash. I'm trying to clean up some files and notice there is a oh my zsh folder. The github instructions tell me to run ...
2
votes
1answer
64 views

How to bind a key sequence to a widget in vi cmd mode zsh?

Let's say I want to bind R to redo in vicmd mode. This works. bindkey -a r redo If I change it to this, it does not work. bindkey -a rr redo I have tried different things with no success. Is ...
0
votes
1answer
322 views

ZSH autocompletion gives seemingly random errors after some time

My zsh autocompletion is broken in a strange way. For clean logins everything works but after some time I will get seemingly random autocompletion errors, for different "kinds" of autocompletion. ...
3
votes
0answers
71 views

Call vared and complete files from a different directory

I have the following zsh function which lets me edit symbolic links using the vared ZLE builtin. function lned { emulate zsh setopt err_return extended_glob local_options local_traps local -a ...
7
votes
2answers
962 views

sharing or synchronizing history between Zsh and Bash

I often find myself switching between Bash and Zsh, and using the history search functionality to recover a command. However, since Bash and Zsh have different history files, I often find that the ...
1
vote
0answers
25 views

Manual tab completions in zsh

I would like nm[TAB] to expand to node_modules in zsh. Is this possible? How can it be done? Ideally, it wouldn't be triggered if there is another completion available, such as an already existing nm ...
1
vote
1answer
187 views

Show path from project root in ZSH Prompt

If my pwd is ~/repos/blog/app/views/, I'd like to show only blog/app/views in the prompt i.e. I want to show only the project root. Project root is the parent directory of .git directory. Is there a ...
3
votes
3answers
252 views

${!FOO} and zsh

${!FOO} performs a double substitution in bash, meaning it takes the (string) value of FOO and uses it as a variable name. zsh doesn’t support this feature. Is there a way to make this work the same ...
1
vote
1answer
49 views

Expansion in zsh prompt

I'm struggling with zsh prompt, trying to convert my bash prompt to zsh hooks. This code should display the current kerberos ticket and update accordingly, but colors don't work, neither does the ...
3
votes
4answers
401 views

Piping paths with different types of quotes for slash substitution

I would like to use sed to convert a path with backslashes to the same path with forward slashes: E.g. I would like to pipe \\path\to\file\ and obtain /path/to/file None of the following commands ...
1
vote
1answer
51 views

In zsh, how can I dump all configuration?

How can I print my current configuration including defaults and key bindings? This would allow me for example, to find what action is bound to say ^P in emacs mode and find binding in vi mode or set ...
4
votes
2answers
277 views

Can zsh access the stdout of last run program?

I often use find or locate to find out about paths. (~) locate foobar.mmpz /home/progo/lmms/projects/foobar.mmpz The next step is often to open or otherwise manipulate the files. In a happy case ...
5
votes
3answers
576 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 ...
2
votes
3answers
98 views

How to alias a command with '

I wanted to make an alias turn caps lock off: python -c 'from ctypes import *; X11 = cdll.LoadLibrary("libX11.so.6"); display = X11.XOpenDisplay(None); X11.XkbLockModifiers(display, c_uint(0x0100), ...
2
votes
1answer
67 views

How to enable 'daw' vi command in zsh?

I've seen that the vi mode option in zsh is rather limited. For example, 'daw' (delete around word) and 'diw' don't work. What is the reason and how can I solve it?
6
votes
1answer
134 views

Zsh auto complete suggest complete functions (_git _vim etc)

I have a small annoyance with how zsh is doing complete suggestions for my commands. If I type the beginning of a command that I don't have installed and press tab it will suggest the completion ...
3
votes
3answers
66 views

string substitutions: all occurrences

A simple question, but I can't find the answer. the zsh documentation overwhelms me :-( function z () { echo ${1:s/the/THE} } $ z thethethe THEthethe ... How can I get all 'the' to be replaced ...
2
votes
1answer
37 views

Expand variable in function definition in zsh

I want to generate a set of functions in my shell in a for loop, but I can't see how to access a variable inside the function body of the function I'm creating. In essence, I would like the following ...
2
votes
4answers
93 views

inline conditionals for assignment

Is there an "inline-equivalent" to expressions like the following?: if [[ $VERBOSE == 1 ]]; then V=$FOO else V= fi I'm thinking of something like this in perl, for example: $V = $VERBOSE ? ...
5
votes
2answers
396 views

Zsh: Automatically modify executed command

I've recently installed grc (generic colorizer) to my system via MacPorts, giving me the ability to get colorized output for plenty of commands which by default don't support it (see screenshot ...
1
vote
1answer
119 views

Is there a simple way to get array of all arguments that do not begin with a hyphen?

zsh includes a powerful utility for parsing command-line options zparseopts, but for quick shell scripts and shell functions, but is there an easy way to extract the array of all command-line ...
4
votes
1answer
264 views

Tab completion of “../” in zsh

One noob question from a new zsh user: In bash, I can use tab-completion to move one directory up and descend down again another path. For example, suppose I'm in $HOME/folder1, and I want to cd to ...
1
vote
1answer
80 views

Restricting grep's --color option to the interactive shell

I have the following variable I want to set to make grep behave a certain way: GREP_OPTIONS=--color=always The problem is, I only want this environment variable to be set on the command line. I ...
2
votes
4answers
134 views

cd two levels down from root

I'm a web developer (Drupal mainly). When I develop websites I do so within a /workspace folder. So I have folders like this. /workspace/project/ /workspace/project/sites/default/files/ ...
1
vote
1answer
86 views

$@ and 'set env $PATH' - Why should this statement go into .inputrc?

I have a line in my .zshrc that says: set env $PATH Apparently this affects the value of $@. I have read that $@ should be empty and that I should not have any set statements in my .zshrc (at least ...
6
votes
1answer
3k views

Command history in Zsh

How does Zsh keep track of command history? I see two files in my home directory: .zhistory and .zsh_history. What is the difference between them? Does Zsh keep appending lines to one of them ...
3
votes
1answer
362 views

ls -l --group-directories-first (act on symlinks as well)

ls option --group-directories-first causes directories to be listed on the top, which makes the output of ls nice and clean: ls -l --group-directories-first However, it does not act on symlinks, ...
1
vote
1answer
55 views

Unable to make .zhistory a symbolic link

Every time I try to make my Zsh history file (.zhistory file) a symbolic link to a file (previously existing .zhistory file) that lives in another folder, Zsh deletes the symbolic link and makes it a ...
2
votes
1answer
76 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
2answers
3k views

How to change default shell to ZSH - chsh says “invalid shell”

I installed ZSH on a VM of mine, where I compiled it from source. The location of ZSH is /usr/local/bin/zsh when I run chsh -s /usr/local/bin/zsh it outputs chsh: /usr/local/bin/zsh is an invalid ...
5
votes
2answers
594 views

How can I create a function in zsh that calls an existing command with the same name?

How can I write a function in zsh that invokes an existing command with the same name as the function itself? For example, I've tried this to illustrate my question: function ls { ls -l $1 $2 $3 ...