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

learn more… | top users | synonyms (1)

1
vote
1answer
14 views

Cygwin: CD to Windows paths easily

In Windows paths are (unreasonably) long, so it is common to drag and drop from some links to the terminal or copy and paste paths from file managers. It is possible to put in the shell init file a ...
1
vote
1answer
13 views

When using zsh tab-completion, Ignore CDPATH if a local file or directory matches

I love Z shell's tab completion with CDPATH, but sometimes it's overkill. I'd like it to only kick in as a fall-back if nothing in the local directory matches. For instance, I was just in ...
1
vote
1answer
34 views

zsh colored prompt

this is my PROMPT PROMPT='%{$fg[green]%}%n%{$reset_color%}@%{$fg[white]%}%m%{$reset_color%}:%{$fg[yellow]%}%~%{$reset_color%} $(git_super_status) %{$fg[white]%}\$%{$reset_color%}' Yes, the new line ...
1
vote
2answers
20 views

gnome-terminal : small gap at right side of screen (Ubuntu)

I use gnome-terminal on Ubuntu, and when the window is small (not maximized or fullscreen), my tmux statusline and the ZSH right prompt both stretch to the extreme right of the window, which is ...
15
votes
1answer
596 views

How to fix tab completion so it doesn't hide entries?

I'm using oh-my-zsh on Mac OS X with homebrew'ed zsh 4.3.12. I stumbled recently on a weird problem. In scripts/not-used I have several .R files: breakdowns.R eventloop.R ...
3
votes
1answer
33 views

Problem with passing parameters containing spaces and wild card characters

I have a problem passing parameters if the parameters may contain wildcards and/or spaces, if those parameters are optional. Since this sounds pretty abstract, let's have a small example: The ...
3
votes
1answer
14 views

Keep the space after completion for some characters in zsh

Zsh has a bit of completion-related automation that's nice most of the time: after pressing Tab, a space is inserted automatically (or some other appropriate character such as , inside braces). I ...
2
votes
2answers
82 views

Use Netrw or Nerdtree in Zsh/Bash to select a file BY BROWSING?

Often I find myself in the shell, wanting to insert a filename into a lengthy command. I'd like to hit a shortcut, and use Netrw or Nerdtree to browse for a file or directory, and have it pasted in ...
1
vote
2answers
23 views

Why is $COLUMNS not listed by either env or set? (on zsh)

I can $ echo $COLUMNS 95 and get a result, but if I env | grep COLUMNS or set | grep COLUMNS I get nothing. (Update: I just discovered that the behavior is different on bash. I'm using ...
1
vote
1answer
20 views

Why does oh-my-zsh pick .zhistory instead of .zsh_history for the value of HISTFILE?

I tried googling about this but couldn't find any clue: Why does oh-my-zsh pick .zhistory instead of .zsh_history for the value of HISTFILE? Seems like .zsh_history is what more people would expect.
1
vote
2answers
867 views

Is it possible to source again .bashrc and .zshrc AND remove functions once inside them without restarting?

I had a function inside .zshrc that I removed. Now, when I try to source it, it indeed sources it, but doesn't remove the function that once was inside .zshrc from memory. Is there a way to remove ...
5
votes
2answers
2k views

zsh: set TERM=screen-256color in tmux, but xterm-256color without tmux

I need my $TERM to be xterm-256color outside of tmux (in "plain" terminal with zsh), but screen-256color inside tmux. First I tried: add export TERM='xterm-256color' to my ~/.zshrc. add set -g ...
61
votes
1answer
3k views

Have backticks (i.e. `cmd`) in *sh shells been deprecated?

I've seen this comment many times on Unix & Linux as well as on other sites that use the phrasing "backticks have been deprecated", with respect to shells such as Bash & Zsh. Is this ...
14
votes
1answer
2k views

When is double-quoting necessary?

The old advice used to be to double-quote any expression involving a $VARIABLE, at least if one wanted it to be interpreted by the shell as one single item, otherwise, any spaces in the content of ...
0
votes
2answers
30 views

How can I expand all variables at the command line in Zsh?

In an earlier question, specific to bash, I asked How can I expand a relative path at the command line, with tab completion? I liked @Mikel's answer that mentioned using Ctrl+Alt+e to expand all ...
3
votes
4answers
255 views

How can a zsh script test whether it is being sourced?

The accepted answer for a similar question for bash does not seem to work for zsh. In fact, if I copy basically the same code given in that answer, to produce the script #!/usr/bin/zsh - # test.sh ...
2
votes
2answers
84 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 ...
3
votes
1answer
231 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 ...
2
votes
2answers
101 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 ...
2
votes
2answers
379 views

remove a host from the completion list for ssh in zsh

I once had some hosts named 'myhost', 'myhost1', etc. And now all those except 'myhost3' become invalid. I removed those from /etc/hosts and ~/.ssh/known_hosts, but zsh still completes them for me. Is ...
2
votes
1answer
35 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 ...
8
votes
4answers
1k views

How to silently get an empty string from a glob pattern with no matches

Say I have a folder with three files: foo1 foo2 bar 1. If I run list_of_files=$(print foo*) echo $list_of_files I get: foo1 foo2 2. If I run list_of_files=$(print bar*) echo $list_of_files ...
0
votes
0answers
25 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 ...
6
votes
4answers
588 views

How to cd automatically after git clone?

I want to automatically cd to the directory created by the clone command after I git cloned something. That is, without writing anything additional just git clone $url that the shell will somehow ...
1
vote
0answers
11 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
64 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 ...
1
vote
2answers
54 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 ...
2
votes
3answers
77 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
45 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 ...
1
vote
1answer
29 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
203 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 ...
0
votes
0answers
75 views

Specifying numeric ranges in zsh history

According to the docs I can tell the zsh history to print lines in a range. The docs say "history [first [last]]" I've tried "history a b" but that gives a too many arguments error. I've also tried ...
0
votes
0answers
265 views

python error using an executable with Z shell

I'm getting this error from the Unix Z shell (I'm on Mac): python: posix_spawn: /System/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/MacOS/Python: No such file or ...
5
votes
3answers
119 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 ...
6
votes
3answers
4k views

Having tmux load by default when a zsh terminal is launched

My current workflow is: CTRL+SHIFT+T to launch a new terminal window. That starts a new zsh terminal. Type tmux to start tmux. How can I have tmux load by default with a new terminal window?
0
votes
2answers
31 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
51 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
51 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?
0
votes
0answers
49 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
vote
2answers
463 views

zsh doesn't work correctly in Mint

I successfully installed zsh, change config on my old, but it's not working properly. I don't know how this feature calls. When i write something - sudo for instance, and press ↑ (arrow up) it ...
1
vote
1answer
22 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
1answer
57 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' ...
2
votes
2answers
46 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 ...
5
votes
4answers
19k views

Change font in echo command

Is it possible to change the font attributes of the output of echo in either zsh or bash? What I would like is something akin to: echo -n "This is the font: normal " echo -n $font=italic "italic," ...
4
votes
1answer
720 views

Zsh theme guides [closed]

Does anyone know good tutorials (or books) for what goes into writing a theme?
16
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?
18
votes
4answers
5k views

make my zsh prompt show mode in vi mode

I use bindkey -v (for bash-ers set -o vi I think that works in zsh too) or vi(m) mode. but it bugs me that I don't have any visual cue to tell me whether I'm in insert mode or command mode. Does ...
1
vote
4answers
64 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" ...
4
votes
1answer
316 views

preventing the screen from being cleared when exiting an ssh session

I have rdist set up to push out some of my dot files to all the remote machines that I need to ssh into. I also have zsh as my default shell on all of those machines. When I ssh into a machine and ...
1
vote
1answer
131 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?