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

learn more… | top users | synonyms (1)

1
vote
2answers
117 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
vote
1answer
64 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?
0
votes
1answer
39 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
170 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 ...
2
votes
2answers
122 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
44 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 ...
4
votes
3answers
119 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 ?
0
votes
1answer
121 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
56 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 ...
1
vote
0answers
19 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
71 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 ...
4
votes
2answers
167 views

Completion of words on the screen as in VIM (Bash or Tmux)

How can I configure Bash, Zsh or Tmux to complete the last matching identifier on the screen? Consider this common scenario: $ git fetch remote: Counting objects: 16, done. remote: Compressing ...
1
vote
2answers
110 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 ...
1
vote
1answer
35 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 ...
1
vote
1answer
37 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 ...
3
votes
2answers
137 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 ...
4
votes
3answers
189 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
79 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), ...
6
votes
1answer
67 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 ...
2
votes
1answer
51 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?
3
votes
3answers
50 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
29 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
64 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 ? ...
1
vote
1answer
65 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 ...
3
votes
1answer
107 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
51 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
106 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
62 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 ...
1
vote
1answer
36 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
553 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 ...
4
votes
1answer
122 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, ...
2
votes
1answer
402 views

zsh completion installations (autojump) - How to use them?

I just installed autojump and have oh-my-zsh installed in my system. I have included the log of the installation at the bottom of this post. Note that at the end it says: zsh completion has been ...
2
votes
1answer
43 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 ...
3
votes
2answers
1k 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
505 views

Local variables in zsh: what is the equivalent of bash's “export -n” in zsh

I'm trying to contain the scope of a variable to a shell, and not have children see it, in zsh. For example, I type this in .zshrc: GREP_OPTIONS=--color=always But if I run a shell script with the ...
3
votes
2answers
85 views

What is the effect of “${(@f)…}” in Zsh?

I ran into a Zsh script and wanted to know its meaning. In the scripts below there is ${$(@f)$(egrep "$2","$file")} expression. From what I searched, @ is to use represent all positional parameters, ...
0
votes
1answer
47 views

Getting tree command to not display directories

I've read through the man pages for tree but I don't know if it is possible to have tree list only the filenames for all files that appear in any recursive search of a directory. The closest I have ...
4
votes
1answer
71 views

How can I configure ZSH's vi mode to persist the state between commands?

I am aware how to set ZSH's default line editor to use vi-like keybindings... bindkeys -v ...and even to default each new prompt to be in command mode instead of insert mod by default... ...
3
votes
1answer
66 views

Cursor movement related tput commands under zsh: can the 'clear' behavior be configured?

Using the zsh shell, I've noticed a difference in the behavior of the tput command compared to bash. For instance With zsh, if you have many things output to a terminal emulator window and you're at ...
1
vote
1answer
138 views

How would I detect a non-login shell? (In Zsh)

I want to create a script that runs when a Zsh instance starts, but only if the instance is: Non-login. Interactive I think I'm right to say .zshrc runs for all interactive shell instances, ...
2
votes
2answers
47 views

Redirect output half-way through a script, and restore later

I would like to re-direct stdout half-way through a script. How can I do this in Zsh? # Do something # ... # Redirect stdout to a file (e.g. foo.txt) for x in *; print $x; done # Re-direct stdout ...
3
votes
3answers
52 views

Full path in glob in Zsh

Say I run the following on /some/path: for x in foo/*; do print $x done Are there any parameters I can use to tell Zsh to print, not just the filename, but the full absolute path to $x? (without ...
1
vote
2answers
263 views

Run the Zsh first use wizard

I made a bad choice when configuring Zsh the first time around, so now I would like to run the configuration wizard (the thing that runs the first time you log in) again. How do I do this?
2
votes
1answer
104 views

How can I use “emulate sh” in zsh to work with “. myscript.sh”?

I've been using emulate sh -c ". $HOME/myscript.sh" and it's working so far. However, if I'm at ~ and try to do emulate sh -c ". myscript.sh", I get .: no such file or directory: myscript.sh.. Why?
3
votes
1answer
170 views

When I try to add the Android SDK to my PATH, it gives a context error

I'm getting a weird message when my shell reads .profile: /Users/alex/.profile:export:69: not valid in this context: SDK/tools:/Applications/Android The error is triggered by this line in my ...
3
votes
1answer
86 views

Trailing spaces when copying from gnome-terminal using zsh

When copying text from gnome-terminal with zsh trailing whitespace is also copied. For example copying the following clearly adds a vertical scollbar on stackexchange site as trailing whitespace the ...
0
votes
0answers
50 views

Zsh completion duplicates folder names

I'm seeing a strange problem when completing folders with zsh 5.0.2 (and oh-my-zsh). When I go to tab complete folder names for a relative path, the folder names often duplicate and lose colour ...
0
votes
2answers
81 views

zsh: What does the command “time + number” do in zsh

When I type time + number in zsh: # atupal at local in /tmp/atupal/setup/bin [10:01:49] $ time 1 /tmp/atupal/setup/bin/lib/python2.7 # atupal at local in /tmp/atupal/setup/bin/lib/python2.7 ...
2
votes
1answer
47 views

Make zsh alt-f behave like emacs alt-f

In emacs, M-f moves the caret to the end of the next word. In zsh, M-f (or rather alt-f) moves the caret to the beginning of the next word. For a more consistent experience, I'd like to have zsh ...
2
votes
1answer
152 views

Command not found in zsh [duplicate]

In bash, whenever I try to run a command which is not installed, I get a message which tells that the package is not installed and how to install it. This functionality is provided by installing the ...