You are not logged in.

#1 2014-01-08 08:06:10

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

[solved] zsh: command not found immediately after installation

Recently I switched to zsh. What I noticed is that commands are not available in the same terminal window if was installed from. I have to open a new terminal window to make the command available. I guess this is some sourcing issue. I cannot remember to have had with Bash.

To give you an example. I just installed nemo but the command is not available.

:: Retrieving packages ...
 cinnamon-desktop-2.0....   217.2 KiB  2.16M/s 00:00 [############################] 100%
(5/5) checking keys in keyring                       [############################] 100%
(5/5) checking package integrity                     [############################] 100%
(5/5) loading package files                          [############################] 100%
(5/5) checking for file conflicts                    [############################] 100%
(5/5) checking available disk space                  [############################] 100%
(1/5) installing exempi                              [############################] 100%
(2/5) installing cinnamon-desktop                    [############################] 100%
(3/5) installing libtracker-sparql                   [############################] 100%
(4/5) installing cinnamon-translations               [############################] 100%
(5/5) installing nemo                                [############################] 100%
➜  ~  ne
neon-config              netlogo-3D               NetworkManager         
neqn                     netlogo-headless         newgrp                 
net                      netstat                  New-Minty-Arch-Colours/
netcap                   nettle-hash              newusers               
netlogo                  nettle-lfib-stream      

Anyone else having the same with zsh?

Last edited by orschiro (2014-01-10 21:39:29)

Offline

#2 2014-01-08 08:36:14

Jellicent
Member
From: Berlin
Registered: 2013-09-13
Posts: 189

Re: [solved] zsh: command not found immediately after installation

Try rehash.

Offline

#3 2014-01-08 08:43:00

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,553

Re: [solved] zsh: command not found immediately after installation

Issue the command, it should work; what you're seeing should only affect tab completion.

Offline

#4 2014-01-10 06:30:52

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

Re: [solved] zsh: command not found immediately after installation

Thanks for your suggestions. Indeed only tab completion is affected. Can the rehash be done automatically rather than manually issuing it after every installation/removal?

Offline

#5 2014-01-10 08:37:26

dodo3773
Member
Registered: 2011-03-17
Posts: 814

Re: [solved] zsh: command not found immediately after installation

Put this:

zstyle ':completion:*' rehash true

in your .zshrc

Offline

#6 2014-01-10 13:40:57

Mr.Elendig
#archlinux@freenode channel op
From: The intertubes
Registered: 2004-11-07
Posts: 4,092

Re: [solved] zsh: command not found immediately after installation

Always rehashing will slow down tab completion noticeably.


Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest

Offline

#7 2014-01-10 13:43:05

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

Re: [solved] zsh: command not found immediately after installation

@Mr.Elendig

Is there an alternative solution?

Offline

#8 2014-01-10 16:47:26

Mr.Elendig
#archlinux@freenode channel op
From: The intertubes
Registered: 2004-11-07
Posts: 4,092

Re: [solved] zsh: command not found immediately after installation

running rehash explicitly after you have installed something new to $PATH obviously


Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest

Offline

#9 2014-01-10 16:52:58

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [solved] zsh: command not found immediately after installation

Mr.Elendig wrote:

running rehash explicitly after you have installed something new to $PATH obviously

This is what I do, and it works just fine.  You just have to remember to do it.

Offline

#10 2014-01-10 18:30:50

dodo3773
Member
Registered: 2011-03-17
Posts: 814

Re: [solved] zsh: command not found immediately after installation

orschiro wrote:

@Mr.Elendig

Is there an alternative solution?

Pacman hooks! tongue

Offline

#11 2014-01-10 21:37:31

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

Re: [solved] zsh: command not found immediately after installation

@dodo3773

A good reason to finally introduce them. big_smile

I will mark this as solved. I added zstyle ':completion:*' rehash true to my .zshrc and cannot notice a significant performance decrease.

Thanks!

Offline

#12 2014-01-10 21:54:01

thiagowfx
Member
Registered: 2013-07-09
Posts: 586

Re: [solved] zsh: command not found immediately after installation

Oh, I always had the same issue. Thank goodness for your question.

Usually I open another shell under the same. I mean, simply run zsh from your zsh. Another solution could be to close your terminal emulator then open a new one, but this does take time, and  wouldn't make sense from a login shell. I'll try the zstyle suggestion too.

Offline

#13 2014-01-10 22:12:03

dodo3773
Member
Registered: 2011-03-17
Posts: 814

Re: [solved] zsh: command not found immediately after installation

orschiro wrote:

@dodo3773

A good reason to finally introduce them. big_smile

I will mark this as solved. I added zstyle ':completion:*' rehash true to my .zshrc and cannot notice a significant performance decrease.

Thanks!

Yeah, for my use case I have never noticed any slowdown either.

Offline

#14 2014-01-10 23:19:05

ivoarch
Member
Registered: 2011-03-31
Posts: 436

Re: [solved] zsh: command not found immediately after installation

Hi, I have another issue with zsh 5.0.5 and the completion system sad

Someone having this message "Failed to issue method call: No such file or directory"?

Real action!

$> ls <Tab>
ls Failed to issue method call: No such file or directory 
bin/                                                                                                              
 files
bin          Documents      Dropbox  Music         Pictures      Templates    
Desktop      Downloads      Git  ...    

The only way to fix this is returning to previous version of zsh (with the same ~/.zshrc config ) or starting clean shell with `zsh -f`
I am fighting 3 days with this and can't find a solution sad

Thanks!!


I love GnuEmacs, GnuScreen, ratpoison, and conkeror.
Github )||( Weblog

Offline

#15 2014-01-10 23:22:12

dodo3773
Member
Registered: 2011-03-17
Posts: 814

Re: [solved] zsh: command not found immediately after installation

ivoarch wrote:

Hi, I have another issue with zsh 5.0.5 and the completion system sad

Someone having this message "Failed to issue method call: No such file or directory"?

Real action!

$> ls <Tab>
ls Failed to issue method call: No such file or directory 
bin/                                                                                                              
 files
bin          Documents      Dropbox  Music         Pictures      Templates    
Desktop      Downloads      Git  ...    

The only way to fix this is returning to previous version of zsh (with the same ~/.zshrc config ) or starting clean shell with `zsh -f`
I am fighting 3 days with this and can't find a solution sad

Thanks!!

After you updated to 5.0.5 did you reboot the machine? I had some kind of issue but a simple reboot fixed it. Not sure if it was because I was starting X from .zprofile or what

Offline

#16 2014-01-10 23:22:34

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [solved] zsh: command not found immediately after installation

dodo3773 wrote:

Yeah, for my use case I have never noticed any slowdown either.

For me, I don't see a difference in anything except the journal.  I notice that the journal tab completion in zsh can already be sluggish at times, even without rehashing.  But when I don't have it set to rehash, it seems to at least be usable.

Offline

#17 2014-01-10 23:32:30

ivoarch
Member
Registered: 2011-03-31
Posts: 436

Re: [solved] zsh: command not found immediately after installation

@dodo3773
I've already tested any thing and still the same sad

I forgot to say that in every new open terminal, it asks for password.

(~)% ls <Tab> [sudo] password for ivo:  

I love GnuEmacs, GnuScreen, ratpoison, and conkeror.
Github )||( Weblog

Offline

#18 2014-01-10 23:36:39

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [solved] zsh: command not found immediately after installation

I experienced this, and it was because it was caused by a function (or set of functions) that were being sourced when the shell starts.  In particular, it was a set of systemctl shortcuts.

Offline

#19 2014-01-11 00:00:11

dodo3773
Member
Registered: 2011-03-17
Posts: 814

Re: [solved] zsh: command not found immediately after installation

@ivoarch

Start a new thread and post your .zshrc etc..etc...(would make more sense anyways as it may get more hits then a thread that is already solved wink ) First it may be good to go through your options, functions, etc... in your .zshrc and one at a time comment them out until maybe you can find the culprit.

@WonderWoofy & @Mr.Elendig
I cannot seem to reproduce. Is it something you did specifically or? Also, are we talking about journalctl <tab><tab> or? Maybe there is something different in my .zshrc that is preventing this? Here is mine (tried to trim the aliases and funtions and stuff out (it's kind of a mess I know tongue )):

NOPRECMD=1
function precmd() {
if [[ $TERM != linux ]]; then
    print -Pn "\e]2;%~\a"
fi
}

preexec () {
if [[ $TERM != linux ]]; then
print -Pn "\e]2;%~ :  $1\a"
fi
}

ulimit -c 0

autoload -U compinit
compinit
zstyle ':completion:*' menu select
export HISTFILE=~/.zsh_history
export HISTSIZE=50000
export SAVEHIST=50000
setopt share_history
eval `dircolors -b`

setopt autopushd pushdminus pushdsilent pushdtohome
setopt autocd
setopt cdablevars
setopt ignoreeof
setopt interactivecomments
setopt nobanghist
setopt hist_ignore_all_dups
setopt HIST_REDUCE_BLANKS
setopt HIST_IGNORE_SPACE
setopt SH_WORD_SPLIT
setopt nohup
setopt completealiases
setopt correct
unsetopt nomatch

autoload -U promptinit
promptinit

autoload -U colors && colors

zstyle ':completion:*' rehash true
zstyle ':completion:*' completer _complete _match _approximate
zstyle ':completion:*:match:*' original only
zstyle ':completion:*:approximate:*' max-errors 1 numeric
zstyle ':completion:*' list-dirs-first true
zstyle ':completion:*' accept-exact '*(N)'
zstyle ':completion:*' use-cache on
zstyle ':completion::complete:*' cache-path ~/.zsh/cache
zstyle ':completion:*:manuals'    separate-sections true
zstyle ':completion:*:manuals.*'  insert-sections   true
zstyle ':completion:*:man:*'      menu yes select
zstyle ':completion:*:processes' command 'ps -ax'
zstyle ':completion:*:processes-names' command 'ps -aeo comm='
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
zstyle ':completion:*:*:kill:*' menu yes select
zstyle ':completion:*:*:killall:*:processes-names' list-colors '=(#b) #([0-9]#)*=0=01;31'
zstyle ':completion:*:*:killall:*' menu yes select
compdef _gnu_generic tar terminator wine
compdef _pids cpulimit
compdef _pids ps
zstyle ':completion:*:cd:*' ignore-parents parent pwd

typeset -g -A key
bindkey "\eOH" beginning-of-line
bindkey "\eOF" end-of-line
bindkey "\e[H" beginning-of-line
bindkey "\e[F" end-of-line

bindkey '^?' backward-delete-char
bindkey '^[[1~' beginning-of-line
bindkey '^[[5~' up-line-or-history
bindkey '^[[3~' delete-char
bindkey '^[[4~' end-of-line
bindkey '^[[6~' down-line-or-history
bindkey '^[[7~' beginning-of-line
bindkey '^[[8~' end-of-line
bindkey '^[[A' up-line-or-search
bindkey '^[[D' backward-char
bindkey '^[[B' down-line-or-search
bindkey '^[[C' forward-char
bindkey '^i' expand-or-complete-prefix

LS_COLORS='rs=0:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:tw=30;42:ow=34;42:st=37;44:ex=01;32:';
export LS_COLORS
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}

bindkey "^[[A" history-search-backward
bindkey "^[[B" history-search-forward

compdef gksu=sudo

export EDITOR="vim"
export VIDEO_FORMAT=NTSC
GPG_TTY=`tty` 
export GPG_TTY
export PAGER=vimpager
alias less=$PAGER
alias zless=$PAGER

eval $(dircolors -b /home/dodo3773/.zsh/LS_COLORS)
DONTSETRPROMPT=1
if [ ${UID} -ne 0 ]; then
PS1="%{%F{white}%}%~ %{%F{green}%}%{%f%}%(10l.
.)>> "
RPROMPT='%{%F{green}%}[%{%F{red}%}%"%?%{%F{green}%}]'
else
PS1="%{%F{red}%}%~ %{%F{green}%}%{%f%}%(10l.
.)>> "
RPROMPT='%{%F{green}%}[%{%F{red}%}%"%?%{%F{green}%}]'
fi

zstyle -e ':completion:*:default' list-colors 'reply=("${PREFIX:+=(#bi)($PREFIX:t)(?)*==02=01}:${(s.:.)LS_COLORS}")'

unambigandmenu() {
    zle expand-or-complete
    zle magic-space
    zle backward-delete-char
    zle expand-or-complete
}
zle -N unambigandmenu
bindkey "^i" unambigandmenu

The only zsh packages I have installed are (aside from some scripts / functions / completions I found around):

extra/zsh 5.0.5-1 [installed]
aur/zsh-completions-git 0.10.0.55.g1d6a2aa-1 [installed: 20120808-2]

Offline

#20 2014-01-11 00:05:40

ivoarch
Member
Registered: 2011-03-31
Posts: 436

Re: [solved] zsh: command not found immediately after installation

Ok solved smile
Just removed antigen and works smile

Thanks!!


I love GnuEmacs, GnuScreen, ratpoison, and conkeror.
Github )||( Weblog

Offline

#21 2014-01-11 00:06:50

dodo3773
Member
Registered: 2011-03-17
Posts: 814

Re: [solved] zsh: command not found immediately after installation

ivoarch wrote:

Ok solved smile
Just removed antigen and works smile

Thanks!!

Nice nice. Sometimes it's just a matter of trial and error

Offline

#22 2014-01-11 00:40:54

ivoarch
Member
Registered: 2011-03-31
Posts: 436

Re: [solved] zsh: command not found immediately after installation

Sorry for this wink

the problem is not antigen is this alias enable='sudo systemctl enable'


I love GnuEmacs, GnuScreen, ratpoison, and conkeror.
Github )||( Weblog

Offline

#23 2014-01-11 01:07:51

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [solved] zsh: command not found immediately after installation

My functions were doing very similar things to your alias there.  Maybe it is something poorly formatted in the zsh completions for systemctl?

Offline

#24 2014-01-11 12:31:58

Mr.Elendig
#archlinux@freenode channel op
From: The intertubes
Registered: 2004-11-07
Posts: 4,092

Re: [solved] zsh: command not found immediately after installation

enabeling automatic rehash will slow down completion when you have a cache *miss*, if you generally don't get misses then you won't notice a big difference. (also depends on the os cache ofcourse)


Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest

Offline

Board footer

Powered by FluxBB