Questions tagged [zsh]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer
143 views

HEREDOC in Dockerfile produces no output

I have this command that I am trying to run in a Dockerfile and it is producing no output to the file: FROM alpine:3.19 as base RUN <<-EOF > /root/.npmrc registry=https://\${...
Christian Bongiorno's user avatar
0 votes
0 answers
240 views

gcloud command completion for zsh adds extra (breaking) escape characters

How do I get gcloud compute ssh to stop adding unnecessary escape characters for spaces when I use command-line completion? For example, when I type gcloud compute ssh and then hit <tab> this is ...
Greg Smethells's user avatar
1 vote
1 answer
387 views

Use `known-hosts-files` for `zsh` ssh command completion

This question was originally asked on SO, which is incorrect. As I was not able to (get it) moved to serverfault, I am re-asking it. I am trying to configure tab completion for the ssh command in zsh ...
Andreas's user avatar
  • 21
1 vote
1 answer
93 views

zsh completion ( compctl ) does not trig for command names containing dashes

I've used zsh compctl since forever (late 90s or early 00s) but strangly never run into this before. I realized today when I intended to make some compctl config for update-alternatives that my ...
fraxflax's user avatar
0 votes
1 answer
238 views

Zsh function for checking for duplicate PATH entries and for occluded executables

This occurs on many systems and I expect someone has a solution for it. The PATH environment variable is a major part of security issues. For sanity's sake, the path portion of the .zshrc looks like: ...
Charles Merriam's user avatar
0 votes
0 answers
94 views

Why does opening new zsh terminal print environment vars

Each time I open a new terminal in Mac OS, it prints a selection (but not all) of my environment vars. I use zsh shell. e.g EDITOR=nano HOME=/Users/xxxx LANG=en_GB.UTF-8 LESS=-R LOGNAME=xxxx LSCOLORS=...
Zemogle's user avatar
  • 101
1 vote
1 answer
333 views

The ssh-agent process is not visible to the user who created it but is visible to root

I have adopted the following snippet from Visual Studio Code's documentaion to create an ssh-agent on login: if [ -z "$SSH_AUTH_SOCK" ]; then # Check for a currently running instance of ...
Matt's user avatar
  • 111
0 votes
1 answer
888 views

Unable to install oh-my-zsh package on alpine docker container

Running apk add oh-my-zsh on a docker container I get: / # apk add oh-my-zsh ERROR: unable to select packages: oh-my-zsh (no such package): required by: world[oh-my-zsh] The package seems to ...
StevieD's user avatar
  • 552
1 vote
0 answers
3k views

Netcat on MacOS failing with simple commands

I'n trying to follow a tutorial here. As an example we can say that we need a friend of ours to help us with something on our work system(Windows). To be able to receive a connection from us first ...
aidenmitchell's user avatar
0 votes
1 answer
101 views

zsh use old binary after install new binary

I've upgraded curl from source by configure, make and sudo make install. But, My zsh use old version binary. What the reason for this behavior? Environment CentOS Linux release 7.8.2003 zsh 5.3.1 ...
Sheile's user avatar
  • 103
0 votes
1 answer
1k views

Add Error Logging to script

I have the following Big Sur Mac OS script: #!/bin/zsh /usr/local/bin/aws s3 cp /Library/FileMaker\ Server/Data/Backups/S3/noon_db_* s3://testbackupnoon rm -rf /Library/FileMaker\ Server/Data/...
JFWX5's user avatar
  • 1
1 vote
0 answers
251 views

debugging zsh completion method

I am trying to debug a completion method. This method is supposed to present with all the directories within these three folders. I verified that compinit is loading it correctly. tried tracing and ...
scphantm's user avatar
  • 203
0 votes
1 answer
98 views

Getting two different results when 'cat'ing a file, and 'cat'ing a file into a variable in zsh? [closed]

The file in question is /sys/class/power_supply/BAT0/status. When I cat it, I receive Full. But when I do status="$(cat /sys/class/power_supply/BAT0/status)" and then echo status, I receive ...
LTWood's user avatar
  • 25
3 votes
1 answer
259 views

How do you avoid the extra carriage return when you use Zsh history expansion? [closed]

I'm a recent convert to zsh (from bash). In zsh, as in bash, there is the history expansion feature. For example, you can do: git blame somefile.cc vim !$ Here, vim !$ is same as typing out the ...
Zack Xu's user avatar
  • 133
1 vote
1 answer
428 views

Shell script prevent switching to other shell or escape from it

If in my automation script, I need to do something like install oh-my-zsh, I will have a .sh script like this: #!/bin/sh runuser -l user -c 'sh -c "$(curl -fsSL https://raw.githubusercontent.com/...
xendi's user avatar
  • 414
1 vote
2 answers
244 views

Add "sudo" to the last command line in bash

I run a command, then realize it should have been run with sudo. In zsh I have a function so that I can hit a ^x^x and it will grab the previous line from the history and prepend sudo to it, so I ...
thermans's user avatar
  • 247
-1 votes
1 answer
1k views

Can't login after installing with, playing with, and uninstalling zsh

The really bad news here (I think) is that I use the root account to log in to my Centos 7 box. The other day I saw an article about zsh, and installed it out of curiosity. Today I decided it's ...
Codemonkey's user avatar
  • 1,108
22 votes
2 answers
22k views

ZSH not sourcing zprofile

I'm running zsh 5.1.1 on Ubuntu 16.04. It seems that ~/.zprofile isn't sourced at login nor new terminal. ~/.zshrc is sourced however. I am running oh-my-zsh. Any ideas on why this is or how I can ...
joedborg's user avatar
  • 339
2 votes
1 answer
1k views

Get on zsh the same result you get when executing `type -t` on bash?

I have shell script that uses type -t, but since apparently it was originally written for bash and on this machine I on zsh, it's not working. I see bash docs that type -t does: If the -t option ...
yivi's user avatar
  • 163
2 votes
4 answers
868 views

Running an application in background

I have a web app on a freebsd server. An app is a single executable file, with a built-in webserver. My default shell is zsh. When I'm running it as "./my_website &" and close a connection, it ...
Dari's user avatar
  • 121
1 vote
1 answer
428 views

How to stop CentOS 7 fresh install to stop `clear` from running on exit from ssh session?

I'm finding that upon exit from an ssh session on a CentOS 7 server, it clears the screen each time. I suspect that there's a setting in /etc for the environment that is doing this. Any ideas of ...
ylluminate's user avatar
  • 1,197
4 votes
2 answers
2k views

remote ZSH and moving to beginning of line gives ^A print

do remote ssh connection in my tmux terminal (zsh) and remote shell is also zSH. [devops@postgres-prod]~% vi /var/lib/pgsql/9.6/etc/postgresql.conf^A0A^A^A^E^A So it doesn't react on Ctrl+A, Ctrl+E
DmitrySemenov's user avatar
0 votes
1 answer
2k views

Why does $SHELL point to /bin/bash if running zsh inside bash?

If I run zsh inside bash (on macOS Sierra), why does $SHELL still point to /bin/bash, rather then /bin/zsh? $ echo $SHELL /bin/bash $ zsh % echo $SHELL /bin/bash
otto.poellath's user avatar
2 votes
2 answers
626 views

Null a file in zsh

In bash i can truncate a file with: $ > file However the same command in zsh hangs. Is it possible to configure zsh to emulate bash when truncating files?
Zlemini 's user avatar
1 vote
1 answer
692 views

zsh, zmv mass rename sub directories nothing happening on large volume of directories

I've set autoload -U zmv alias mmv='noglob zmv -W' When on sample data (~20 folders with subfolders) I run mmv images/**/advert images/**/notice it just works as expected. But if I run same ...
rolkos's user avatar
  • 113
5 votes
2 answers
7k views

Command 'getent'

Part 1 Is getent supposed to be an executable? In my zsh setup, I can see getent is actually defined as a function $ which getent getent () { if [[ $2 = <-> ]] then grep ":$...
Anthony Kong's user avatar
  • 3,488
1 vote
1 answer
2k views

Trouble installing ZSH

I did the following: yum install zsh Then chsh eduar New shell [/bin/bash]: /bin/zsh When I type: curl -L http://install.ohmyz.sh | sh I got this: You already have Oh My Zsh ...
eduartua's user avatar
  • 111
-1 votes
1 answer
2k views

Customizing PATH for .zshrc

In my user's composer folder I have 2 executables... $ ls ~/.composer/vendor/bin/ envoy homestead I'm attempting to modify my PATH variable for oh-my-zsh so that I don't have to customize the ...
Ben's user avatar
  • 3,870
1 vote
1 answer
378 views

zsh extended globbing to create sub directories

% zsh --version zsh 5.0.2 (x86_64-apple-darwin13.0) % ls -l bootstrap/ local_folder/ ssh_confs/ zsh_confs/ I am trying to create a sub directory called "files" inside all the directories in ...
manish's user avatar
  • 111
0 votes
1 answer
1k views

zsh substitution, can't do regex with repetition

I'm trying to perform ZSH variable substitution, but I'm having to do it the lame way, by piping through cut. Is it possible to perform this operation entirely within ZSH? i=./riak.logs....
bryan_basho's user avatar
9 votes
2 answers
17k views

How to set the default shell when chsh is not present

I've a Synology DS412+ NAS box running Busybox, which has a default shell of ash. Previously, ipkg install optware-devel was run and it installed bash and set it as the default shell. Running ipkg ...
ian's user avatar
  • 239
0 votes
2 answers
4k views

bash script to create user then create ssh keys

Please note I am a total linux newbie, please bare that in mind when answering this question as I have very limited knowledge of linux. OS: Debian Squeeze I am using ZSH and have created a function ...
George Reith's user avatar
1 vote
0 answers
270 views

Trouble with name resolution when using programs like `gem` in shell

I have trouble with name resolution when using programs like gem in my shell within my office environment. Whenever a program needs to connect to a remote host, it fails to resolve the domain name, ...
Felix's user avatar
  • 111
0 votes
1 answer
29 views

Mounted directory is shrinking

This is a bit strange. I have a ZSH mounted network directory in a Redhat VM and it appears to be shrinking: [aramk@server-C production]$ df -h Filesystem Size Used Avail Use% Mounted on /...
Aram Kocharyan's user avatar
2 votes
3 answers
3k views

In zsh, how do you redirect stderr to /dev/null within a for or foreach loop?

I am trying to accomplish something that is easy in bash: look for files in a folder and source them if they exist (and do not output if no files exist). In bourne shells this is how to do it: if [...
chrishiestand's user avatar
3 votes
1 answer
141 views

In bash, how do I get possible completions to disappear afterwards?

In bash, when I hit tab and the completion is ambiguous, it appears like this on my screen: chris@host / $ cd fo foo/ for/ foz/ chris@host / $ cd fo I then continue typing, but I get to another ...
Chris Mounce's user avatar
0 votes
4 answers
367 views

How to automatically clean up date stamped logs

I have an apache web server with various virtual hosts. Each virtual host logs to date stamped files using cronolog. The result is that I end up with a lot of files like this: ----rw-r-- 1 root ...
Thomas's user avatar
  • 175
0 votes
1 answer
515 views

ZSH escaping / file matching pattern

This works from command line: scp -r ^.git b:/home/wopi/blyzics/. when I paste the above line in a script like this: #!/usr/bin/env zsh scp -r ^.git b:/home/wopi/blyzics/. And run it ./deploy.sh ...
astropanic's user avatar
2 votes
4 answers
3k views

SSH connection closes as shell fails to load

I have FreeBSd running with OpenSSH. I set up everything and the connection via SSH worked perfectly. Then I decided to get rid of some not used ports and I obviously uninstalled one that was used by ...
user avatar
2 votes
2 answers
3k views

How to stop the shell interpolating?

I'm writing a bit of Ruby for use on the command line, but the shell is interfering too much - is there a way to turn off interpolation for the entire line? I know I can escape certain characters, but ...
ian's user avatar
  • 239
18 votes
4 answers
20k views

How to delete empty source directories when moving folders with rsync?

rsync can be coaxed into moving folders very similarly and superiorly to traditional mv with the following options: rsync -axvvES --remove-source-files source_directory /destination/ However one ...
ylluminate's user avatar
  • 1,197
2 votes
1 answer
396 views

mirror STDOUT and STDERR to file by default

How I can accomplish STDOUT to be to logged in a file (appending), but preserving the flow (leave STDOUT to STDOUT) ? STDOUT should work transparently, but should be logged also into a file, without ...
astropanic's user avatar
17 votes
4 answers
30k views

Copy a range of files in command line (ZSH/BASH)

I have a list of files with consecutive numbers as suffixes. I would like to copy only a range of these files. How can I specify a range as part of my cp command. $ls P1080272.JPG* P1080273.JPG* ...
Amjith's user avatar
  • 273
4 votes
2 answers
3k views

How can I put the last zsh command in history into a clipboard?

It often happens to me, that I just used a command and I need to copy/paste it either to a different terminal window/IM or whatever. On a Mac, I can use the pbcopy command to get something in ...
Jakub Arnold's user avatar
  • 1,794
9 votes
3 answers
2k views

Excluding Environment Variables from ZSH Autocomplete

Quick example: ~ $ wor<TAB> ~ $ WORDCHARS= ...
Bryan Veloso's user avatar
1 vote
2 answers
995 views

zsh printf quote bug

does anyone have any idea why am I getting hit by this bug in zsh since forever? It's like a string formatting bug of some sorts: ~% printf "%s\n" foo " foo)foo Basically anything that has double ...
Zike's user avatar
  • 11
4 votes
1 answer
909 views

zsh autocompletes folders that don't exist

Just started using zsh with oh-my-zsh, and I noticed something odd when autocompleting with cd. Suppose I have a folder: my_folder/ subfolder/ another_subfolder/ file.txt When I used ...
seth's user avatar
  • 145
11 votes
4 answers
1k views

Keyboard shortcut to store typed command and clean the line

You know the situation: You are halfway through typing a long command (for example a commit message) and realize that you have forgotten to execute some prerequisite command that can not be added with ...
chiborg's user avatar
  • 1,083
1 vote
1 answer
2k views

Can't get ZSH working on CentOS

I've been using zsh for a couple of years now on Ubuntu and really like it a lot. I've installed it on our production server as well, which is running CentOS 5.2, and it works just fine. However, I ...
tommytwoeyes's user avatar
0 votes
1 answer
139 views

Declare my own script to execute file

I have two files, the first is 'ax': #!/usr/bin/env zsh print "Params: $*" cat $* And another one 'tst': #! /home/me/ax A B C When I am in sh/csh/bash shell: > ./tst ./tst: line 2: A: command ...
yogsototh's user avatar
  • 103