1
user@localhost ~ % zsh --version
zsh 5.5.1 (x86_64-redhat-linux-gnu)
me@localhost ~ % lsb_release -a
LSB Version:    :core-4.1-amd64:core-4.1-noarch
Distributor ID: Fedora
Description:    Fedora release 28 (Twenty Eight)
Release:    28
Codename:   TwentyEight

~/.zshrc:

... Details omitted ...
source ~/.aliases
cat ~/.aliases
... Details omitted ...

command prompt:

user@localhost ~ % zsh
alias ls='exa'
alias grep='rg'
user@localhost ~ % 

So ~/.zshrc is executed, but the aliases didn't have any effect.

It works if I run source ~/.aliases in the shell.

I've been trying for hours now without luck. Any ideas?

  • you were right! my zshrc contained aliases for grep and ls. thank you! if you want you can add an answer which I will accept, so you get your deserved rep ;) – le_me May 29 '18 at 15:29
  • In this case Details matter ;) – mpy May 29 '18 at 17:38
5

Most probably something that is sourced later changes these aliases.

Add alias sanitycheck='echo sane' to your ~/.aliases and run sanitycheck in the ~/.zshrc just after you source ~/.aliases. Log in anew. If you get sane then you will know source ~/.aliases worked.

Investigate what happens later in your ~/.zshrc. Hopefully you will discover other aliases for ls and grep.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.