NOT Working: /bin/bash: Psu: command not found

M-! cmd Psu


M-! cmd ls


cat ~/.bashrc | grep Psu
cat ~/.bashrc | grep aliases

 alias Psu='sudo pacman -Syyu'
if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases


cat ~/.bash_profile | grep -A 2 bashrc

if [ -f ~/.bashrc ]; then
    . ~/.bashrc


cat ~/.bash_aliases

if [ -f ~/.bashrc ]; then
    . ~/.bashrc

I've read and followed: https://emacs.stackexchange.com/a/28999/21118

What am I missing?

  • 1
    From your comments to the answer below it appears you are using eshell. Eshell is a terminal emulator written entirely in elisp. It doesn't run bash or zsh, it is a separate stand-alone program. As such it uses its own configuration, and won't read any if the bash files. If you want to run bash in Emacs, look at M-x shell or M-x term
    – Tyler
    Commented Apr 3, 2022 at 14:32
  • the question you link to asks about M-x shell, not M-x eshell
    – Tyler
    Commented Apr 3, 2022 at 14:34
  • I answered a similar question a while ago. Check this out: emacs.stackexchange.com/a/74388/37580
    – g-gundam
    Commented Apr 29, 2023 at 0:36

1 Answer 1


From the documentation:

To specify the shell file name used by M-x shell, customize the variable explicit-shell-file-name. If this is nil (the default), Emacs uses the environment variable ESHELL if it exists. Otherwise, it usually uses the variable shell-file-name

You obviously want to use bash shell; may I suggest a piece of my Emacs configuration:

;; make emacs recognize my bash aliases and functions & use bash as default shell                                                                                              
(setq explicit-shell-file-name "/bin/bash")                                                                                                                                    
(setq shell-file-name "bash")                                                                                                                                                  
(setq explicit-bash.exe-args '("--noediting" "--login" "-ic"))                                                                                                                 
(setq shell-command-switch "-ic")                                                                                                                                              
(setenv "SHELL" shell-file-name)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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