Q: How can I add permanent alias to the terminal

I would like to add an alias to the terminal with the alias command, e.g.

alias ll=‘ls -alF’

and a few others more. This also works, but if I then log off and later log in again, the aliases are away and disappeared.

What can I do to store them permanently?

Just put them in your .bashrc like any other Linux system?
…or is that what is not working for you?

4 Likes

I did as you wrote and it works.

Yesterday I wanted the same but did not find this file .bashrc, surely I made some mistake.
It works now, Thank you!

edit: it should be noted, that in the /etc/bashrc is a lot of program text, but adding the wanted aliases at the end of the file did work.

Just a s a precautionary note (you probably know this already ): Altering the system’s bashrc is generally discouraged. Since you might mess up your system’s bash sessions accidentally. Unless it’s weirdly configured, BASH will always read the local .bashrc in your home directory.

2 Likes

I did only add the following shortcuts for easier work with the terminal in devel-su mode:

#: alias ll=‘ls -l’
#: alias l=‘ls -alF’
#: alias …=‘cd …’ - note: I have typed 2 dots here, but 3 dots appear, can’t edit this!
#: alias …=‘cd …/…’ will say: 3dots=‘cd 2dots/2dots’

… nothing else.
Please warn me if you think it could cause disruption.

Why are there 3 dots? Two dots is one level up.
And do take it easy with the global bashrc. This looks harmless, but i tend to only apply devel-su when needed for an edit or similar, not general poking around. Most of the sytem is perfectly readable for nemo.

3 dots is shortcut for two levels up with one command, for convenience. I saw this in a linux tutorial called selflinux.

For exploring the system for interest and fun, I always use to log in as nemo, but for copying some modificated files to its place I need sometimes the devel-su (root) login to get write access to the target folder.

I am sure @attah did not mean these three dots

alias …

but

= cd …

as this is plain wrong.
And you overwrite the first three dot alias with the second three dot alias.

I guess you wanted to do:

alias …=‘cd …’
alias …=‘cd …/…’

–edit!
Funny thing this discourse!
It replaced the two dots with three dots! But when editing I do see it correctly like below when inside code tags:

alias ..=‘cd ..’
alias ...=‘cd ../..’

Thats right and I did so in the bashrc file and posted also here, but did not check what then appears in my message. Now I checked, and really 3 dots … huuuh!!!

So i thought I’ve made a typing error and wanted to edit -> 2 dots were in the editing box … huhuuuh!! I’ll try again… sorry for causing confusion…

edit: On editing my post, I found out:
typing 2 dots: 3 dots appear, although then in the edit box are only 2 dots
typing 1 dot: 1 dot appears,
typing 2 dots again: 3 dots appear again

2 typed dots in the editing window are converted into 3 dots, that appear as soon as the message is posted. I tried now many times, and always the same result.
So I wrote in clear words in the message above, what I wanted to say.