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

learn more… | top users | synonyms (1)

2
votes
2answers
807 views

Tmux Terminfo problem with Zsh key bindings

Zsh in Emacs edit mode comes with the default key binding ALT + Backspace to delete a word on the right side of the cursor and ALT + D to delete a word on the left side. I would like to add the latter ...
2
votes
1answer
178 views

Zsh style arrays with Bash

Does Bash have a way to access arrays similar to Zsh, something like $ foo=(dog cat mouse) $ echo $foo[1] cat instead of $ echo ${foo[1]} perhaps using some shopt setting?
4
votes
1answer
2k views

Why is zsh (oh-my-zsh) completing directories that don't exist?

UPDATE 3 I've worked out that these annoying autocomplete options are actually usernames. I.e. they exist in /etc/passwd I have users such as _kadmin_admin and _kadmin_changepw and many others ...
2
votes
2answers
500 views

Pre-defined umask under a given path [duplicate]

Possible Duplicate: How to set default file permissions for all folders/files in a directory? Say I have default umask, umask1. I would like all files/folders that I create/modify under a ...
3
votes
2answers
722 views

Disown won't take -h option

I'm running a command that I now realize I'd like to leave running after I close my SSH session. I didn't start it with a & argument, but I have put it in the background (CTRL-z, bg). Now I'm ...
2
votes
1answer
711 views

What happened to ~ when updating oh-my-zsh?

Not sure what changed the meaning of the home path ~ in my zsh. So when I do cd ~ , I dont cd into my home but it gives me an error that /Users/carlos does not exist. How can I reset ~ to refer to ...
1
vote
4answers
192 views

Zsh: dirs in reverse order

I am a bit confused about how dirs works. The documentation says: dirs With no arguments, print the contents of the directory stack. Directories are added to this stack with the pushd ...
0
votes
1answer
271 views

Error in .zshrc file

I've just installed last kubuntu and zsh shell, not for first time by the way. But in this time it shows some configuration option (perhaps it occurs problem), I chose something and quit. Then as ...
3
votes
5answers
2k views

Output multiple files from a single grep?

I'm not very experienced in shell scripting, but I'm trying to understand how to grep for a pattern and for each file where there is a match write a file to disk that contains the matched line from ...
2
votes
2answers
78 views

^P not working in zsh, where should I look at?

I copied my bashrc and start tweaking it for zsh, but I suddenly found ^P wasn't functioning, It just print a ^P on screen. What could be wrong? Or where should I look at now?
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?
2
votes
0answers
712 views

Problems changing PS1 to use special character

I'm trying to get my zsh to look something like this: https://bbs.archlinux.org/viewtopic.php?pid=1068202#p1068202. Whenever I print the └───╼ part of the PS1 to my terminal (or in the .zshrc for ...
2
votes
1answer
390 views

zsh broke compose key and special chars

I thought I'd switch to zsh, so I did just that with chsh -s /usr/bin/zsh user, unfortunately, it broke my compose key (unresponsive both in the console and in an X terminal); also, when I read email ...
2
votes
3answers
715 views

How to append / extend zshell completions?

I am using zsh with oh-my-zsh. Unfortunately, oh-my-zsh does not use file ~/.ssh/config for hostname auto-completion (see Issue #1009, for instance). This could easily archived by the following code: ...
3
votes
1answer
153 views

How to expand a substring of a command?

I would like to know what a command would look like if I entered a substring of this command. I'm not interested in the result, but in the history expansion. The purpose of this is to show in an ...
5
votes
3answers
2k views

What's the right way to sort a associated array in bash or zsh?

I'm wondering how should I sort the associated array in bash? I tried the manual, but seems nothing related to sort. The current solution is echo everything out, and use external program i.e key ...
5
votes
2answers
2k views

zsh copy and paste like emacs

I have noticed that zsh has a lot of things I see in emacs. I can make a selection with ctrl+space and selecting a region. I can make copies just like in emacs while I stay inside zsh. In emacs I'm ...
9
votes
2answers
2k views

Is it possible to include file in config file of zsh? How?

I'd like to have a file eg. f with only zsh aliases (pureness reasons). Then I'd like to include f file in my .zshrc file, so that the aliases defined in f are visible in .zshrc. Is it possible? If ...
3
votes
4answers
164 views

Editing output of command as a new command

I have a script that outputs a string that I would like to edit and then run as a command. For example, I am using cat ... | xsel -p And then I want to edit the output of `xsel -op´ and run the ...
4
votes
3answers
3k views

Using OR patterns in shell wildcards

Contents of my dir are $ ls -lrt total 0 -rw-r--r-- 1 user1 admin 19 Oct 8 12:31 night.txt -rw-r--r-- 1 user1 admin 19 Oct 8 12:31 noon.txt -rw-r--r-- 1 user1 admin 38 Oct 8 12:31 day.txt I ...
6
votes
3answers
1k views

Silently start task in background

I know that you can use this to start a process in the background, without getting the notification when the process is put in the background and when it is done like so: (command &) &> /dev/null ...
2
votes
1answer
290 views

zsh prompt not escaped properly

This is my current prompt definition: PROMPT='%(?..%F{red}%?%f:)%F{blue}%n%f:%F{green}%{${PWD/#$HOME/~}%} %(!.%F{red}.%f)%# %f' The cursor sometimes starts one character behind the actual prompt, ...
4
votes
3answers
5k views

Bash Auto-Completion feature for SSHing into Different Hosts

I have big list of servers which I normally ssh to all the time. Is there any way using bash or zsh so that I can keep the list of hostname and bash auto-completion goes through the file and gives me ...
2
votes
1answer
187 views

ESC-q doesn't work in tmux with zsh

The title says it all. I use Escq a lot (stashing the current line while I execute another command), and it works fine with Gnome Terminal 3.6.0 + zsh. However, if I start tmux, then it stops working: ...
2
votes
1answer
195 views

Stop tab completion suggesting 'messagebus'

I've got a directory called build, which I cd into quite a bit. If there isn't any directory bu* in the current directory, zsh tab completion: cd buTAB suggests messagebus/, which isn't in .. If I ...
4
votes
2answers
366 views

Inhibit Variable Expansion in Paths

How do I prevent Zshell (and Bash I assume) from expanding environment variables in paths be completed as shown in the following example: $PREFIX/alt/li should expand to $PREFIX/alt/lib and not ...
0
votes
1answer
902 views

Asking ls to only list files in a path that match a specific glob/regex

In Zsh: Is there a way to use ls to only list files and folders in the current directory that match a specific globbing or regex pattern? For example, say I have multiple files that start with the ...
2
votes
1answer
182 views

Change completion behaviour with brace expansion in zsh

I have got used to using tab-autocompleting inside braces without expanding in zsh. This was possible, while I used zsh with a basic grml-config. Since I migrated to oh-my-zsh, I can't reproduce this ...
0
votes
0answers
67 views

/long/path/to/{multiple, files} syntax? [duplicate]

Possible Duplicate: Quick way to include a directory path when calling mv? Is there any way in bash to type a path once, and then reference several files at once? Here's what I do now: ...
3
votes
1answer
192 views

modifying the zsh shell word split

I am using the word split style shell (select-word-style shell). I like it in general but would like to split at forward slashes also, so that when I go forward/backward a word, if the word doesn't ...
7
votes
4answers
2k views

List X random files from a directory

Is there a way to list a set of say, 30 random files from a directory using standard Linux commands? (in zsh) The top answer described here does not work for me (sort does not recognize the option ...
3
votes
1answer
920 views

Fixing scrolling in nano running in tmux in mate-terminal

The problem: I open a terminal (in Linux Mint, so mate-terminal) zsh is the shell Then I run tmux Edit a file with nano Scroll up and down that file with the cursor Issue: When scrolling down in ...
10
votes
2answers
2k views

How can I run a command in zsh without pushing it onto the current session's history?

Both bash and zsh support a shorthand of not placing a command in history if you prepend it with a space. This works great across sessions (if you've setopt histignorespace). However, the command is ...
3
votes
4answers
412 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 ...
4
votes
1answer
699 views

What does zsh's magic-space command do?

I found the following command in my .zshrc, probably copied from some website: bindkey " " magic-space # do history expansion on space The manpages are about as helpful as the very succinct ...
4
votes
3answers
1k views

How to set bash to run *.exe with mono?

Without any DE or even X, I want to use ./my.exe to run mono my.exe, like it works with python scripts.
0
votes
1answer
3k views

Script failing with “command not found: ^M”

When I try to run the following script in zsh, via the command /bin/zsh ~/.set_color_scheme.sh I get the following error: command not found: ^M The script has u+x permissions and it used to work on ...
0
votes
2answers
344 views

Installing a shell (e.g. zsh) without being system admistrator [duplicate]

Possible Duplicate: how can I use bash as my login shell when my sysadmin refuses to let me change it Say I have rwx permissions to a directory (my home directory). Can I install a shell ...
3
votes
3answers
622 views

Fastest way to open all files in a directory with multiple file extensions on commandline

If I want to open all mp4 files in a directory, I can simply do something like totem *.mp4. But how can I open all mp4 and all flv files in that directory with one command. I.e. I want to do something ...
5
votes
1answer
6k views

Executing a script in zsh - file permissions

I'm confused about execute file permissions not behaving as I expect. Probably because my expectations are wrong. Anyway: I have a script file, for simplicity is just called s, located in ~/bin. For ...
2
votes
1answer
2k views

export PATH only once per login in zsh

I need to alter my PATH variable so I put export PATH=$PATH:somedir in my $HOME/.profile which is sourced by my $HOME/.zshrc. This works, yet whenever I open a new terminal (urxvt in X11), .zshrc ...
13
votes
2answers
381 views

Can I make `rm` interactive only when using globbing? (in either bash or zsh or both)

Whenever I rm multiple items at once with shell globbing and there's even the slightest possibility that the pattern expands to more than I expect it to, I always try to remember to add -i, but (of ...
5
votes
2answers
403 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 ...
3
votes
1answer
169 views

ZSH, vcs_info, Mercurial, and Trac: weird branch and revision

I'm using zsh with vcs_info and it works nicely except when browsing a repo which is set up for Trac/Mercurial. Specifically, the hgrc for the repo has the following line in [hooks]: changegroup = ...
1
vote
1answer
1k views

Do shells support recursion?

I'm trying to write recursive functions in my shell scripts. Consider the following code: function printA { if [[ "$1" = 0 ]]; then return else echo "a$(printA $(("$1" - 1)))" ...
2
votes
2answers
437 views

Executing zsh rehash after build

I have a build script that can change what binaries are in my $PATH (it doesn't edit $PATH itself, but it adds/deletes files to folders that are already in $PATH). zsh's autocompletion doesn't update ...
5
votes
2answers
255 views

gvim pipes not reading zshrc when started from desktop

I'm using zsh as my default shell and using .zshrc to modify my environment variables. When I start gvim from terminal everything is fine however if I start gvim with the desktop icon, my env ...
3
votes
1answer
788 views

oh-my-zsh completion on home directory names

I recently switched to zsh from bash, and I'm using oh-my-zsh. There's a completion behaviour I don't want: in any directory, the list of autocompletion candidates seems to include the names of all ...
2
votes
1answer
366 views

zsh notification of email (in maildir)

How can I modify the following so that it reads maildir and not just mailbox format? typeset -a mailpath for i in ~/Mail/Lists/*(.); do mailpath[$#mailpath+1]="${i}?You have new mail in ${i:t}." ...
1
vote
1answer
543 views

Colors not rendered correctly in oh-my-zsh themes

I'm trying to use colors in oh-my-zsh themes. It works fine on my home computer (ubuntu), but in a work computer (Scientific Linux i.e. Enterprise linux) the prompt colors are actually spelled out. ...