How to make aliases persistent?

27 views
Skip to first unread message

Alex Lu

unread,
Jul 10, 2020, 4:28:30 AM7/10/20
to Qubes Users
For example, when I type:

alias ll='ls -lh'

it works just fine, but after restarting the VM (either appVM or
templateVM), I have to do all over it again.

Peter Funk

unread,
Jul 10, 2020, 5:17:02 AM7/10/20
to Alex Lu, Qubes Users
Alex Lu asked 10.07.2020 at 08:28:
This question is not really Qubes OS specific.

If you want these aliases to persist you have to put them into the
"run commands" file of your command line interpreter (the shell).
This is most likely the BASH.
(see https://en.wikipedia.org/wiki/Bash_(Unix_shell) for more information).
The usual "run commands" file of the your BASH is called "$HOME/.bashrc".

So you could either use an text editor of your choice to edit this file
or you could append the alias commands to this file by typing:

echo "alias ll='ls -lh'" >>$HOME/.bashrc

Luckily the $HOME directory is located in /rw of your appVM so these
edits should persist after a restart of either type of VM.

Regards, Peter Funk
--
Peter Funk ✉:Oldenburger Str.86, 27777 Ganderkesee, Germany; 📱:+49-179-640-8878
✉office: ArtCom GmbH, Haferwende 2, D-28357 Bremen, Germany
☎office:+49-421-20419-0 <http://www.artcom-gmbh.de/>
my_gpg_public_key
signature.asc

Alex Lu

unread,
Jul 10, 2020, 5:25:40 AM7/10/20
to Peter Funk, Qubes Users
Ah, it was that easy! Sometimes I get stuck on things like this and
can't find the answer myself. Thank you, Peter!

--
Alex

Ulrich Windl

unread,
Aug 4, 2020, 6:26:45 PM8/4/20
to qubes...@googlegroups.com
"man bash", not qubes os specific:
" When bash is invoked as an interactive login shell, or as a
non-interactive shell with the --login option, it first reads and
executes commands from the
file /etc/profile, if that file exists. After reading that
file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in
that order, and reads
and executes commands from the first one that exists and
is readable. The --noprofile option may be used when the shell is
started to inhibit this
behavior."

>
Reply all
Reply to author
Forward
0 new messages