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

learn more… | top users | synonyms (1)

-3
votes
0answers
46 views

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

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
152 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 ...
4
votes
5answers
102 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 ...
0
votes
0answers
30 views

Perform filename expansion on $@ [closed]

I want to make soft links of all files I want to other directory in effective way. I use something like ln -s *(#q:aq)(F) in my ZSH, but it is not effective, when you need to do for-each on several ...
0
votes
1answer
29 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 ...
7
votes
5answers
156 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 ...
1
vote
1answer
34 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
53 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
19 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
46 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
58 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
27 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 ...
3
votes
3answers
50 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
31 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
45 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
15 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
30 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 ...
1
vote
2answers
61 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
25 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
34 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
81 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
87 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
62 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
38 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
40 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
46 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
20 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
44 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
34 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
57 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
40 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
82 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
55 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
32 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
66 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
40 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
0answers
132 views

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

I just installed autojump. 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 installed to: ...
2
votes
1answer
36 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
269 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
159 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 ...
2
votes
2answers
60 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
29 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
45 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
41 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
72 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
36 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 ...
2
votes
3answers
34 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
102 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
52 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
82 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 ...