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

learn more… | top users | synonyms (1)

0
votes
2answers
381 views

Comparison of shells? [closed]

Do shells have any actual advantages or disadvantages? They can all run any binary, they all support pipes and > (output to file). Why would one choose bash over sh, or sh over ksh, etc? Why does ...
4
votes
1answer
153 views

Is there a command for switch to vicmd mode in zsh?

I have mapped alt-k and alt-j for browsing history, but I would like to switch vicmd automatically whenever I call up a history entry, because most of the time I need to move the cursor to a certain ...
7
votes
4answers
436 views

mv * folder (avoiding 'cannot move' error) [duplicate]

Anytime I want to move thousands of files to a new folder, I always encounter the same problem. > mkdir my_folder > mv * my_folder mv: cannot move 'my_folder to a subdirectory of itself ...
2
votes
1answer
179 views

Distributing thousands of files over subfolders

I have a folder A with hundreds of thousands of files. I would like to move these files to new subfolders S_i, with, say, 100 files in each (the last folder may have less than 100 files) In other ...
2
votes
2answers
138 views

Picking a random file from each subfolder

Inspired by the accepted answer to this thread: List X random files from a directory, I tried to put together two lines that would pick one file from each subfolder of my current directory, with no ...
2
votes
1answer
85 views

zsh autocompletion for symlinks

Say I have a folder parent with a subfolder, subfolder and a symbolic link symbolic_link. I noticed that if my current working directory subfolder and I try to do cd ../sym[TAB], it will not ...
3
votes
2answers
451 views

Upgrade zsh on red hat 5 x86_64

My machine is running RHEL 5 x86_64 I'm facing a problem with oh-my-zsh The zsh version on my machine is zsh --version zsh 4.2.6 (x86_64-redhat-linux-gnu) There are no upgrades available via yum. ...
1
vote
1answer
199 views

How to make HOME, END to work on terminal without X

my current keys config is: typeset -A key key[Home]=${terminfo[khome]} key[End]=${terminfo[kend]} key[Insert]=${terminfo[kich1]} key[Delete]=${terminfo[kdch1]} key[Up]=${terminfo[kcuu1]} ...
7
votes
3answers
626 views

Is there a way to add a directory to my PATH in zsh only if it's not already present?

Is there an easy way in zsh to add a directory to my PATH only if it's not already present? (or, more generally, any environment variable). I've tried: PATH+=/my/directory ... but if that's ...
4
votes
3answers
131 views

Can any shell do argument-level interactive search?

Sometimes I need to reuse certain long arguments like paths. If I use history search (CTRL+R), I may find some command that contains the path, but I still need to delete anything else in the old ...
2
votes
1answer
204 views

tcsh vs zsh. Escape/control characters

I am having problems running this command to work in zsh: my_command -u something -s X:^0 The command works right away on tcsh, but on zsh I get: zsh: no matches found -s X:^0 This made me ...
0
votes
3answers
367 views

Proper place to put shell prompt(PS1) when use sh/bash/zsh together

I'm using dash(sh) or bash or zsh. If possible, I would prefer to put in common place. I want to put proper PS1 settings when I interactive with shell, so these situation should be considered login ...
2
votes
1answer
474 views

Select text in urxvt terminal using Shift+Arrow or Ctrl+Shift+Arrow

I'm using zsh + rxvt-unicode as a terminal simulator in Archlinux. I've successfully setup navigation in the terminal using Ctrl+Arrow keys, but I can't setup the terminal to be able to select text ...
1
vote
1answer
101 views

Frequent command “template”: remove parameter expansion escape characters

zsh newbie here... I find myself using a handful of long commands over and over again with slightly different arguments. For example: rsync -havu --progress --rsh='ssh -l mylogin' ...
3
votes
3answers
181 views

Zsh function with su and echo

I'm trying to add a function to my .zshrc that makes adding new USE flags to my /etc/portage/package.use file easier. Normally, I'd have to do su -c 'echo "net-misc/aria2 bash-completion bittorrent" ...
4
votes
2answers
612 views

Bash function not working in Zsh

I have been slowly migrating from Bash to Zsh and have got to the point where everything I have moved across is working well, with one exception. I have a couple of functions in my .bashrc that I use ...
3
votes
1answer
101 views

zsh refusing to accept new autocomplete script

I have a software project that I'm attempting to write zsh completions for. After installing a package that provided a number of pre-made completions, I found they were put here: ...
5
votes
1answer
462 views

what is the zsh equivalent of bash's export -f

So I started using zsh. I like it all right. It seems very cool and slick, and the fact that the current working directory and actual command line are on different lines is nice, but at the same time, ...
4
votes
4answers
235 views

Delete backward until met a char, like alt + bksp

Say my current line was: /tmp/path/to/file:123 Now I'm at the end of this line, now I want to delete :123 by pressing some key combination, was that possible? (colon was merely mentioned as an ...
3
votes
3answers
128 views

SSH to two addresses, use the one that connects first

I have a home computer (let’s call it franklin because that’s what I call it) that I often ssh into from my work laptop. When I’m at home, I ssh to franklin.local, and when I’m at work or anywhere ...
2
votes
2answers
785 views

Ctrl + left/right arrow keys issue

After the last system update the ctrl + left/right arrow command on zsh terminal doesn't do anything. Also ctrl+ u has something wrong because usually that command erase from the cursor to the ...
2
votes
2answers
81 views

Expand less-than sign when using multios and brace expand

With zsh multios set (setopt multios) it's possible to do things like: < in1 < in2 > out and: < in > out1 > out2 which is very convenient. I want to combine this feature with ...
0
votes
1answer
379 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 ...
3
votes
1answer
135 views

Escaping quotes for scp

I needed to write a that behaves correctly with nasty (spaces, braces, etc..) filenames. scp -rv "$1" shiny:/Volumes/Seagate3To/\"$1\" This function works, but I don't understand why the quotes ...
6
votes
1answer
1k views

What is the key difference between grml zsh config and oh-my-zsh config

Now I'm on the oh-my-zsh, but I'm not sure that it is perfect choice. What is the key difference between grml zsh config (github repo) and oh-my-zsh config? In which case should I prefer grml or ...
1
vote
2answers
172 views

How to scp folders with nasty names using a shell function

I am trying to write a function that I will put on all my machines in order to make it easy to send files at a fixed place on my network. Here is my script so far. Some folder may have duplicates ...
-1
votes
1answer
66 views

Config File Sequence for ZSH?

I know there is an elaborate sequence of config files that BASH reads sequentially (or alternatively skips if a particular one is present), however I have for the most part adopted ZSH as my default ...
4
votes
1answer
192 views

Disable the configuration tool in Zsh

When there is no .zshrc file in a user's home directory and zsh is started, an interactive configuration utility is run instead of directly giving access to the shell prompt. I set up zsh to be the ...
2
votes
2answers
523 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
130 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?
3
votes
1answer
986 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
314 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
351 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
679 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
163 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
207 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
1k 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
71 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?
3
votes
2answers
2k 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
446 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
274 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
418 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
133 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
1k 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 ...
3
votes
2answers
1k 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 ...
5
votes
2answers
1k 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
143 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 ...
3
votes
3answers
901 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 ...
5
votes
3answers
726 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
196 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, ...