When I run the emacs
text editor the process does not return so I cannot use the terminal which is obviously the default behavior.
I cannot find the switch or command in the man
but I know it is something very simple.
How can I run emacs
as a separate process so I can continue to use the terminal without opening a second one?
The
emacs --help
command is giving you a tip:So run
emacs --batch
(or maybeemacs --execute
somecommand ).If you have a desktop (or some X11 display) and want
emacs
to open an X11 windows and give you back a shell prompt, run it in the background (e.g.emacs &
) as many commented.And I find very useful to start programs (or shells) within emacs, e.g. with Emacs commands:
M-x shell
, orM-x compile
(formake
etc...), orM-x gdb
for a debugger.You usually start one single
emacs
at the beginning of a working day. You could useemacsclient
(or set yourEDITOR
environment variable to it) for other editions using the sameemacs
.You can start any program in the background by appending an ampersand to the command,
emacs &
.There's a whole framework for working with backgrounded processes, see for example
man jobs
,disown
,fg
,bg
, and tryCtrl-Z
on a running process, which will suspend it and give you the terminal, allowing you to resume that process either in the foreground or background at your pleasure. Normally when your shell closes, all those programs will end,disown
allows you to tell a program to keep running after you end your session.