Top answer is right; the way I do it is somewhat more involved and uses systemd, if don't mind that then you can use my implementation. I use two daemons, one with a minimal configuration to only use in the terminal, and a fully configured PDE for development.
My .service files are as follows (place these in ~/.config/systemd/user
emacsq.service
[Unit]
Description=Emacs: the extensible, self-documenting text editor
Documentation=man:emacs(1) info:Emacs
[Service]
Type=forking
ExecStart=/usr/local/bin/emacs -nw --no-splash --init-directory=~/.q.emacs --daemon="shell"
ExecStop=/usr/local/bin/emacsclient --eval "(progn (setq kill-emacs-hook nil) (kill-emacs))"
Restart=on-failure
Environment=DISPLAY=:%i
TimeoutStartSec=0
[Install]
WantedBy=default.target[Unit]
Description=Emacs: the extensible, self-documenting text editor
Documentation=man:emacs(1) info:Emacs
After=graphical-session.target
Notice that here i pass the argument
--init-directory=/path/to/other/emacsdir/
this is the directory where my minimal configuration is, this may or may not be what you want.
emacsd.service
[Service]
Type=forking
ExecStart=/usr/local/bin/emacs --daemon=gui
ExecStop=/usr/local/bin/emacsclient --eval "(progn (setq kill-emacs-hook nil) (kill-emacs))"
Restart=on-failure
Environment=DISPLAY=:%i
TimeoutStartSec=0
[Install]
WantedBy=default.target
then, i use the following bash functions to call them as i need them
vic(){ # use the gui, but open the file in a new window
emacsclient -c $1 -s "gui" &
}
vis(){ # use the gui, but use an existing window if it exists
emacsclient -r -c $1 -s "gui" &
}
fis(){ # open the target file on the terminal where am at
emacsclient -nw -s "shell" $1
}
vzf(){ # save as vis, but first use fuzzy finder to search for a file (requires fzf)
vis $( fzf )
}
then enable and start the services
systemctl --user enable --now emacsq.service
and
systemctl --user enable --now emacsd.service
this answer builds on the top selected answer. I hope this helps.