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

learn more… | top users | synonyms (1)

2
votes
2answers
59 views

Update process name in shell, is it possible?

In C/C++ it is in general possible to do strcpy(argv[0], "new process name"). It's a hack used in malicous software to hide real process name. Is such operation possible via shell? What I want to do ...
2
votes
1answer
30 views

Zsh: Expanding hashed directory names in prompt

I am experimenting with moving from bash to zsh, and in particular with the hash function; so that hash -d Do=~/Downloads means I can enter cd Do to move immediately to that directory. Nice. But ...
2
votes
2answers
86 views

How to read from a named pipe after the writer process exits?

I want to use named pipes as asynchrnonous task queues (JMS-like, perhaps). For example, suppose a client sends some data that I wish to insert into a database, but I want the client to disconnect ...
1
vote
0answers
10 views

autojump : favor folders that share the most parents with current directory

Say I have following folders hierarchies : /home/kray/virtualenv/dev1/myproj/bin /home/kray/virtualenv/dev2/myproj/bin And i type in a console: $ pwd ...
2
votes
1answer
36 views

oh-my-zsh style completion for directory/file paths without oh my zsh

I had oh-my-zsh installed for a while, and I could type a full path using only one letter, then press tab to case-insensitively autocomplete the whole thing. For example, if I had a file at ...
2
votes
3answers
65 views

How to sort filenames with spaces in them and concatenate the files?

I have the misfortune of dealing with filenames that contain spaces. I want to concatenate files of which filenames contain spaces. I also want to sort the filenames numerically. Obviously the ...
4
votes
1answer
42 views

Are there problems with hyphens in functions, aliases, and executables?

In my testing (in Bash and Z Shell), I saw no problems with defining functions or aliases or executable shell scripts which have hyphens in the name, but I'm not confident that this will be okay in ...
0
votes
0answers
20 views

How to show gemset in ZSH-prompt if rvmrc is used?

There are several ZSH themes that presents the gemset in the prompt by calling "rvm-prompt". For example, the "gallois" theme: example My question is if it is possible to only show this if the ...
1
vote
1answer
23 views

Incrementing/decrementing a number in a file from a ( zsh ) script

From a script ( running multiple times simultaneously ), I would like create a file something like: echo "0" > /tmp/count Then I would like to do three functions. incr /tmp/count decr ...
4
votes
1answer
189 views

Why ZSH ends a line with a highlighted percent symbol?

I've noticed this on occasion with a variety of applications. I've often thought it was because the output was cancelled early (ctrl+c, for example) or something similar, and zsh is filling in a new ...
5
votes
3answers
96 views

Shell/Bash script: Properly drop privileges

Okay, first of all, I know this question has been asked a few times here, but the answers given did not entirely satisfy me. The situation is the following: I have written many scripts to automate ...
0
votes
2answers
24 views

zsh function output removes leading whitespace

Consider the following two commands and their outcome: 14:57 : echo $(echo " ABC") ABC 14:57 : echo " ABC" ABC Version of zsh: zsh 5.0.5 (x86_64-apple-darwin14.0) Why does the first one ...
1
vote
1answer
48 views

How to print the code of a shell function in terminal?

I am using zsh and I have defined few utility shell function in some shell scripts, few of them called from ~/.zshrc, so let's assume that the we don't know the location of these functions. One ...
3
votes
3answers
49 views

How to see manpage of previous command?

For example if I did a curl -F 'clbin=@some-image.jpg' https://clbin.com. How do I man curl easily?
1
vote
2answers
53 views

Map Return with no other input to an alias

I would like to use Return with no other input to run an aliased command in the shell. Is this possible in Bash or Zsh? In other words, when I enter an empty command line, I want to run one specific ...
0
votes
0answers
27 views

Powerline bash prompt not colorized in tmux

The bash/zsh commandline prompt is not displaying colors in tmux, even though I managed to get the powerline itself working (with colors). The prompt works fine in pure bash/zsh. I am getting the ...
-1
votes
0answers
30 views

Empty terminal window - ZSH does not start? Can't use terminal

I have a chromebook pixel running Manjaro. Up until about 10 minutes ago, this machine was running great. I'd been using the terminal emulator (terminator) all day, when I tried opening a new shell ...
1
vote
1answer
21 views

Key to comment out the current line and keep editing it in zsh

On Bash I was using ESC # after Ctrl+R to prefix a # to the found line and keep it in the terminal, something similar for zsh?
1
vote
4answers
56 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" ...
1
vote
1answer
100 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?
8
votes
2answers
225 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 && ...
2
votes
1answer
52 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 ...
2
votes
2answers
41 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 ...
0
votes
0answers
20 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 ...
1
vote
1answer
48 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
120 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
34 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 ...
3
votes
1answer
65 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 ...
3
votes
3answers
209 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 ...
1
vote
2answers
41 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
43 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 ...
4
votes
2answers
53 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 ...
15
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?
1
vote
1answer
54 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' ...
1
vote
2answers
49 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 ...
0
votes
1answer
34 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 ...
3
votes
1answer
143 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
67 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
1answer
64 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 ...
2
votes
2answers
65 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
4
votes
2answers
114 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 ...
3
votes
2answers
116 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 ...
2
votes
1answer
27 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 ...
4
votes
1answer
34 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
81 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 ...
10
votes
4answers
771 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 ...
6
votes
2answers
67 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 ...
1
vote
1answer
80 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 ...
4
votes
3answers
121 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 ...
2
votes
1answer
64 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: ...