Eshell provides a number of built-in commands, many of them
implementing common command-line utilities, but enhanced for Eshell.
(These built-in commands are just ordinary Lisp functions whose names
begin with eshell/
.) In order to call the external variant of
a built-in command foo
, you could call *foo
. Usually,
this should not be necessary; if the Eshell version of a command
doesn’t support a particular option, it will automatically invoke the
external command for you.
Some built-in Eshell commands provide enhanced versions of regular
Emacs Lisp functions. If you want to call the regular Emacs Lisp
version, you can write your command in Lisp form (see Invocation).
To call the regular version in command form, you can use
funcall
or apply
, e.g. ‘funcall #'compile "make all"’
(see Calling Functions in GNU Emacs Lisp Reference Manual).
You can check what will be applied by the which
command:
~ $ 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 (see Aliases). For example:
~ $ alias ls '*ls $@*' ~ $ which ls ls is an alias, defined as "*ls $@*"
~ $ alias compile 'apply #''compile $*' ~ $ which compile ls is an alias, defined as "apply #'compile $*"
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 --help
option.
In some cases, a built-in command’s behavior can be configured via
user settings, some of which are mentioned below. For example,
certain commands have two user settings to allow them to overwrite
files without warning and to ensure that they always prompt before
overwriting files. If both settings are non-nil
, the commands
always prompt. If both settings are nil
(the default), the
commands signal an error.
Several commands observe the value of
eshell-default-target-is-dot
. If non-nil
, then the
default target for the commands cp
, mv
, and
ln
is the current directory.
A few commands are wrappers for more niche Emacs features, and can be
loaded as part of the eshell-xtra
module. See Extra built-in commands.