Zsh is a shell designed for interactive use, although it is also a powerful scripting language.

learn more… | top users | synonyms

3
votes
1answer
359 views

Script-specific autocomplete in shell

I create a lot of little scripts to help me in my every day life. I would like to provide auto-complete for them, specially that I intend to share them with people. Now, I know I can create ...
2
votes
2answers
784 views

Emacs keybindings in zsh not working (Ctrl-A, Ctrl-E)

My Emacs keybindings in zsh are not working (CtrlA, CtrlE). I use zsh on OS X. They might be bound to some other thing. I'm currently using oh-my-zsh. And my .zshrc is over here.
3
votes
1answer
80 views

In zsh how can I run a script which is written for bash

I have switched to zsh, how can I run a script which is written for bash? I don't want to modify the script to put #!/bin/bash in the beginning for the script since it is version controlled. Is ...
3
votes
2answers
171 views

How to move files down a directory?

I have inherited a folder structure on a project and would like to simplify it a bit. I have a root full of folders (1st level) and each of those folders has a number of folders in it (2nd level) and ...
1
vote
3answers
677 views

zsh: automatically set environment variables for a directory

Let's say I have a project in: ~/working_dir Whenever I run commands from this directory, I need to have certain environment variables set. So I can export them like so: export VAR=value ...
3
votes
2answers
238 views

Unix environment variables with arguments

I'm trying to set my $EDITOR variable to be emacs with no window, so the command to call it would be emacs -nw. However if I set it like this: export ...
0
votes
1answer
525 views

Share history in multiple zsh shell

I am trying to setup zsh so that it shares command history between different zsh sessions: in multiple tabs in multiple gnome-terminals in different screen sessions I have put this in .zshrc #To ...
0
votes
1answer
239 views

Zsh customized prompt and updating variable's value

I would like to use the value of a variable set in my zsh shell to display in my prompt line. For example, let's say export TOKEN='hello' is set in my session. At that time, I load my prompt which ...
1
vote
1answer
143 views

Configuring zsh in OSX to auto start processes

I've recently converted to using zsh instead of bash in OSX and was wondering if it is possible to do the following: When I launch my terminal I would like to start various tabs and have each tab run ...
4
votes
2answers
92 views

Escape not idempotent in zsh's vi emulation?

I have zsh configured to use vi keybindings. I've noticed some unexpected behavior with "escape". In vim (I haven't tested vanilla vi) if I hit escape twice, I can hit 'i' once to return to insert ...
1
vote
1answer
543 views

What sequence does PuTTY send for ALT + DEL

When I connect to my Debian Wheezy Beta 4 server with PuTTY 0.62 on Windows 7 I'm experiencing a problem. My login shell is Zsh and it is configured to handle ALT + DEL for the action delete-word ...
2
votes
2answers
128 views

My zsh autocompletion for CDPATH stopped working

I am using zsh and I always were able to cd right into paths that are part of my CDPATH configuration but, starting a few days ago, the completion stopped working. mbp:~ $ echo $CDPATH ...
1
vote
1answer
145 views

Is there a way to reverse-search zsh history with more than one search term?

I'd like to be able to reverse-search (CTRL+R) on zsh, but have the commands searched using more than one search term. For example, I'd like to search through commands that included both "scp" and ...
0
votes
1answer
128 views

Repeated command in output for Zsh prompt

In the output of any command I put into the prompt, that command is repeated (sometimes partially). What extremely simple configuration for Zsh do I need to enter to remove this repeat? Example: ...
1
vote
1answer
101 views

cd to last directory in oh-my-zsh

Is there anyway to get oh-my-zsh and Terminal to load up my last used directory? For example I cd into ~/Desktop then close my terminal. I'd like it to open back up into the ~/Desktop folder.
1
vote
0answers
95 views

Git autocomplete stopped working in Oh My ZSH

Help! My git autocomplete stopped working in Oh My ZSH. It was working, but now it is now. I'm not sure what changed, so I'm hoping someone can help me track down the problem. I've tried ...
0
votes
1answer
401 views

Correct password for ssh key rejected when ssh-d into machine

When I am logged into my machine directly, I can do all git operations, and when prompted for a password, the password is accepted. When I ssh into the same box and run git operations on the same ...
0
votes
2answers
337 views

How can I add a beep to ZSH's prompt?

I want to be notified when a job is done or something finishes in a terminal, and I read somewhere about adding a Bell to the command prompt, and then turning on urgentOnBell. But I can't figure out ...
2
votes
2answers
210 views

Disable zsh autocorrect entirely

How do you disable zsh autocorrect entirely? I am aware of the 'nocorrect' option which only applies to certain commands. But I want it off entirely so that when I type 'lear' instead of 'clear', it ...
3
votes
1answer
349 views

iTerm/Terminal OS X slow in opening a shell

I'm using OS X 10.8 and lately I'm noticing that iTerm2 can sometimes be quite slow with opening a new shell. It takes around 5 seconds before I can do something. Might not seem a lot, but I work a ...
0
votes
0answers
56 views

.zshrc alias for ssh gives “unknown host”

New zsher here. When I do $ ssh user@foo.com all is well. But when I create an alias in .zshrc: alias foo='ssh user@foo.com' and run foo, I get "Could not resolve hostname". Question: how do I ...
1
vote
2answers
79 views

System-level bash/zsh alias blacklist

Is there a blacklist feature/functionality in bash/zsh to prevent specified commands and such from being overridden with an alias? Specifically - is there something that can be set system-level in a ...
4
votes
1answer
525 views

Zsh in Cygwin 1.7

When starting Zsh as the shell in Cygwin 1.7, I get the escape characters in plain text. When using Zsh with the -l option, this is resolved. Why is this? As you can see, the terminal renders the ...
1
vote
1answer
94 views

How to prevent unwanted string expansion in zsh?

For example, i need to call echo or date command: ~ echo "%k%M" debs-e420"%k%M ~ date +%k:%M debs-e42010:24 But if I run it in bash I'll get what I need: $ date +%k:%M 10:25 $ echo "%k%M" %k%M ...
0
votes
1answer
180 views

How to enable fn and cmd keys shortcuts in zsh shell in OSX?

After I installed zsh in OSX through macports, all kind of shortcuts like fn+right/left (which is alternative to END key, i've got a mini-apple keyboard), stops working. Anybody knows how to enable ...
1
vote
0answers
53 views

No error output for ruby commands

I am currently having the following problem: Some of my ruby/rbenv commands commands (e.g.: bundle exec irb, rbenv rehash) fail when executing. However I don't get any error output: [~]$ bundle ...
2
votes
0answers
58 views

Set timeout on zsh autocompletion

I like ZSH's autocompletion feature, but often it hangs my terminal. I'd like to set timeout on autocompletion so it cancels (kills) itself after n miliseconds.
0
votes
1answer
476 views

Subversion colored output for ZSH

Does ZSH have any ready scripts to color the output of svn command (st, diff, so on)? I found this little helper script for bash: https://github.com/jmlacroix/svn-color/blob/master/svn-color.sh
5
votes
2answers
1k views

Writing shell scripts that will run on any shell (using multiple shebang lines?)

I've just started getting deeper into shell scripting, and I've always just thrown my script in a file, marked it chmod +x and then done /path/to/script.sh and let whatever interpreter is the default ...
0
votes
2answers
51 views

Disabling sudo halt

It's happened to me a few times now, that I want to shut down my own computer, grab the next best terminal (always have two dozen of them floating around), and type sudo halt, only to realize I've ...
1
vote
2answers
57 views

Trying to get `$FOO =~ bar|baz` to work in Bash and Zsh

I'm trying to get a simple if statement working in both Zsh and Bash but I can't find something to work with both. # this works with Zsh if [[ "$TERM_PROGRAM" =~ iTerm\|Apple_Terminal ]]; then echo ...
2
votes
1answer
76 views

Keep tmux title from `fg` to original jobname

I'm using Eevee's .zshrc/.tmux.conf. When I'm running a vim session, and I do Ctrl+z and then ⚘ fg, then it changes my tmux pane title to fg. I'd rather it change back to vim whatever.txt, or ...
1
vote
1answer
52 views

Arbitrary zsh completion using a keybinding

Sometimes a command doesn't have a completion installed—or syntactically could accept a whole bunch of types of arguments, rendering completion next to useless. For instance, "git checkout" can take ...
2
votes
1answer
114 views

How can zsh be configured to not clear the screen at logout?

When sshing to a host, the screen is cleared at exit, which makes it impossible to review recent output. This behavior seems to be set system-wide in /etc/zlogout. How can zsh be configured to not ...
2
votes
1answer
176 views

Gem Binaries not found with oh-my-zsh

I'm using Oh-My-Zsh on Mountain Lion and have an issue with gem binaries not loading properly. For instance: If I load a new shell the binary still cannot be found. When using Bundler, I can load ...
4
votes
2answers
308 views

Efficient way to use all cores in bash or zsh script

If I want to process large number of files with command "do_something" which only can use one core, what's the best way to use all available cores assuming each file can be processed independently? ...
0
votes
1answer
88 views

Extracting patterns from files

I am trying to extract patterns from cat ing a file in a bash script. I need to extract 10 and 80 line by line. How do I do this? Total Branch Predictor Mispredictions: 10 Total Branch Predictor OK ...
1
vote
1answer
79 views

zsh: Abbreviation expansion, what does |& mean?

The grml zsh configuration contains a zsh abbreviation for a command I have never seen before: abk=( # key # value (#d additional doc string) #A# start # <snipped> ...
2
votes
1answer
427 views

zsh autocompletion not working on cygwin

I am on win7 64b, with cywgin 1.7. I have added zsh shell to the installation. If I start a shell like with bash: bash --login -i autocompletion works fine straight away. But if I start a zsh: ...
4
votes
3answers
223 views

UP arrow key on Apple External Keyboard not recognized in OSX Lion terminal

I have a MacBook pro for work use, and just got my hands on an apple USB keyboard. When I am in the terminal, using the external keyboard ONLY I receive weird characters when I hit the UP arrow key. ...
3
votes
1answer
120 views

How to log in which terminal session a zsh command was run

In zsh's history file, all commands are logged from all terminal sessions. Is there any way to log in which terminal session a command was run (i.e., a unique identifier for this instance of the ...
5
votes
4answers
567 views

How to rename a file inside a folder using a shell command?

I have a file at some/long/path/to/file/myfiel.txt. I want to rename it to some/long/path/to/file/myfile.txt. Currently I do it by mv some/long/path/to/file/myfiel.txt ...
1
vote
1answer
604 views

How to bind up arrow in ~/.inputrc (readline) for vim insert mode?

When in Readline apps with vim mode enabled in ~/.inputrc (set editing-mode vi) is there a way to bind the <Up> arrow key in vi-insert mode? To display previous history item, for example. It ...
3
votes
1answer
277 views

Is it possible to have zsh+keychain+tmux not ask for keys?

I'm using tmux and zsh, and I've recently been learning about ssh-agent and keychain. From the manpage for zsh, it says that it will source .zlogin only if the shell is, well, a login shell. ...
1
vote
1answer
187 views

Increment file number using zmv

I have a set of files that are named in the vein of "some_file-nameN", where N is a number starting at 1, incrementing, and ending somewhere between 10 and 30. I now need to insert a file at the ...
1
vote
1answer
79 views

zsh recording of input output

I would like to keep not just history of my commands, but the output as well. If I type ls then it should append to a file ~/Desktop% ls test.jpg file.txt whatever.pdf Is there anything like that? Or ...
1
vote
2answers
152 views

ZSH: menu select autocompletion for history search

ZSH has a powerful menu select autocompletion e.g. for choosing a directory, choosing a process with kill (kill[tab][tab]). You can use arrows to navigate around the choices. Is it possible to have ...
1
vote
0answers
503 views

How do I set up sshd using Cygwin on Windows 7 for remote login

I'd like to set up an ssh server with Cygwin on my Windows 7 desktop so that I can remotely access my computer in a more civilized way than using VNC. I would like to use zsh as my default shell. I ...
1
vote
0answers
66 views

How do I get zsh tab completion to “vi **/foo<TAB>” to match and complete the first file matching “foo*” anywhere under the current directory?

How do I get zsh tab completion to cat **/foo<TAB> to match and complete the first file matching foo* in any subdirectory under the current directory? For example, do this while inside a fresh ...
0
votes
1answer
445 views

Zsh super slow inside my Git repo

My Zsh is super slow inside a certain Git repo of mine. When I Google "zsh git slow", I get a bunch of results about Git autocompletion being slow, but autocompletion isn't necessarily my problem; ...