Several commands are built-in in Eshell. In order to call the
external variant of a built-in command
foo, you could call
*foo. Usually, this should not be necessary. You can check
what will be applied by the
~ $ which ls eshell/ls is a compiled Lisp function in `em-ls.el' ~ $ which *ls /bin/ls
If you want to discard a given built-in command, you could declare an alias, Aliases. Example:
~ $ which sudo eshell/sudo is a compiled Lisp function in `em-unix.el' ~ $ alias sudo '*sudo $*' ~ $ which sudo sudo is an alias, defined as "*sudo $*"
If you would prefer to use the built-in commands instead of the external
Some of the built-in commands have different behavior from their
external counterparts, and some have no external counterpart. Most of
these will print a usage message when given the
Adds a given path or set of paths to the PATH environment variable, or, with no arguments, prints the current paths in this variable.
Define an alias (see Aliases). This does not add it to the aliases file.
Scrolls the contents of the eshell window out of sight, leaving a blank window. If provided with an optional non-nil argument, the scrollback contents are cleared instead.
Similar to, but slightly different from, the GNU Coreutils
Define a varalias. See Variable Aliases in The Emacs Lisp Reference Manual.
Use Emacs’s internal
diff (not to be confused with
ediff). See Comparing Files in The GNU Emacs Manual.
grep commands are compatible with GNU
use Emacs’s internal
Same as the external
info command, but uses Emacs’s internal
List subprocesses of the Emacs process, if any, using the function
Kill processes. Takes a PID or a process object and an optional signal specifier.
Eshell version of
list. Allows you to create a list using Eshell
syntax, rather than Elisp syntax. For example, ‘listify foo bar’
("foo" "bar") both evaluate to
Alias to Emacs’s
locate function, which simply runs the external
locate command and parses the results.
See Dired and Find in The GNU Emacs Manual.
See Compilation in The GNU Emacs Manual.
Alias to Emacs’s
See Other Repeating Search in The GNU Emacs Manual.
Print the arguments separated by newlines.
This command changes the current working directory. Usually, it is
invoked as ‘cd foo’ where foo is the new working directory.
cd knows about a few special arguments:
When it receives no argument at all, it changes to the home directory.
Giving the command ‘cd -’ changes back to the previous working directory (this is the same as ‘cd $-’).
The command ‘cd =’ shows the directory stack. Each line is numbered.
With ‘cd =foo’, Eshell searches the directory stack for a directory matching the regular expression ‘foo’ and changes to that directory.
With ‘cd -42’, you can access the directory stack by number.
sudo method see (tramp)Inline methods
to run a command via
sudo. These commands
are in the eshell-tramp module, which is disabled by default.
Eshell knows a few built-in variables:
This variable always contains the current working directory.
This variable always contains the previous working directory (the
current working directory from before the last
It refers to the last argument of the last command.
This is the result of the last command. In case of an external
command, it is
This variable contains the exit code of the last command (0 or 1 for Lisp functions, based on successful completion).