aliases exist but .bash_aliases doesnt exist - SOLVED

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help
Post Reply
bill_steamshovel
Level 2
Level 2
Posts: 82
Joined: Fri Jul 13, 2018 8:30 am

aliases exist but .bash_aliases doesnt exist - SOLVED

Post by bill_steamshovel » Sun Sep 16, 2018 12:27 am

Am getting adventurous and would like to dabble with shellscripts and aliases.

Typing in alias yields the following, (I assume they were hard wired into the installation files)

bill@Bill-Linux ~ $ alias
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias l='ls -CF'
alias la='ls -A'
alias ll='ls -alF'
alias ls='ls --color=auto'

where are they kept please ? .bash_aliases or a .bashrc and .bash_profiles file are discussed in my various google searches - do I need to make one in my home directory to store my own aliases or do I tag them onto the end of wherever the above aliases are kept ?

I eventually found a file called bash.bashrc file in the etc directory - am now getting a tadge confused - do I append my aliases to this file ?

- just point me to a good web page please ? - think I must have confused myself whilst googling this stuff.

inxi _Fxzd and bashrc are attached

Bill
Attachments
bashdotbashrc.pdf
(32.09 KiB) Downloaded 5 times
inxiFxzd.pdf
(24.03 KiB) Downloaded 3 times
Last edited by bill_steamshovel on Sun Sep 16, 2018 7:39 am, edited 1 time in total.

User avatar
catweazel
Level 19
Level 19
Posts: 9824
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

Re: aliases exist but .bash_aliases doesnt exist

Post by catweazel » Sun Sep 16, 2018 12:34 am

bill_steamshovel wrote:
Sun Sep 16, 2018 12:27 am
where are they kept please ?
.bashrc
bill_steamshovel wrote:do I append my aliases to this file ?
Yes.

Code: Select all

# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
"There is, ultimately, only one truth -- cogito, ergo sum -- everything else is an assumption." - Me, my swansong.

User avatar
smurphos
Level 13
Level 13
Posts: 4778
Joined: Fri Sep 05, 2014 12:18 am
Location: Britisher
Contact:

Re: aliases exist but .bash_aliases doesnt exist

Post by smurphos » Sun Sep 16, 2018 1:40 am

Don't edit /etc/bash.bashrc - it's the master copy used for setting up new user accounts. You will have a local copy in your home folder ~/.bashrc which is the one you can add your aliases to.
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.

bill_steamshovel
Level 2
Level 2
Posts: 82
Joined: Fri Jul 13, 2018 8:30 am

Re: aliases exist but .bash_aliases doesnt exist

Post by bill_steamshovel » Sun Sep 16, 2018 7:38 am

Thanks for the replies gents.

Thanks for your help.

Had another look and found the .bashrc in ~/ ............. must have been looking with my eyes shut the first time.

Puzzling thing is that those aliases are not in that file, will see if I can find where they are.

Off to write some aliases

Bill

gm10
Level 20
Level 20
Posts: 10153
Joined: Thu Jun 21, 2018 5:11 pm

Re: aliases exist but .bash_aliases doesnt exist

Post by gm10 » Sun Sep 16, 2018 7:43 am

smurphos wrote:
Sun Sep 16, 2018 1:40 am
Don't edit /etc/bash.bashrc - it's the master copy used for setting up new user accounts. You will have a local copy in your home folder ~/.bashrc which is the one you can add your aliases to.
No, it's not, it's the system-wide bashrc that gets run before your user version does. The files that get used for user profiles are in /etc/skel
bill_steamshovel wrote:
Sun Sep 16, 2018 7:38 am
Puzzling thing is that those aliases are not in that file, will see if I can find where they are.
They are in /etc/bash.bash_aliases

You can also set up your own ~/.bash_aliases - personally I find that cleaner than sticking them into ~/.bashrc, but it comes down to preference, there's no functional difference.

bill_steamshovel
Level 2
Level 2
Posts: 82
Joined: Fri Jul 13, 2018 8:30 am

Aliases working Thankyou

Post by bill_steamshovel » Sun Sep 16, 2018 8:51 am

Hey,

Well done everybody .....

Aliases now working - using .bash_aliases ....... it is easier to read my simple stuff here than it is to append it to .bashrc with all the gobbledygook at the top.

My favourite one is up=cd ..

....... and then I can use the up arrow to keep going up one directory at a time - trivial yet quite pleasing.

Off to have a go at shellscripts now -

Bill

gm10
Level 20
Level 20
Posts: 10153
Joined: Thu Jun 21, 2018 5:11 pm

Re: Aliases working Thankyou

Post by gm10 » Sun Sep 16, 2018 9:17 am

bill_steamshovel wrote:
Sun Sep 16, 2018 8:51 am
My favourite one is up=cd ..
Looking through my list, the most important one is clearly:

Code: Select all

alias rot13='tr '\''A-Za-z'\'' '\''N-ZA-Mn-za-m'\'''
:lol:

bill_steamshovel
Level 2
Level 2
Posts: 82
Joined: Fri Jul 13, 2018 8:30 am

Re: aliases exist but .bash_aliases doesnt exist - SOLVED

Post by bill_steamshovel » Mon Sep 17, 2018 7:08 am

Wasn't game to try rot13 but I did look up man tr to try and understand it..... ummmmm ..... interesting. :D

gm10
Level 20
Level 20
Posts: 10153
Joined: Thu Jun 21, 2018 5:11 pm

Re: aliases exist but .bash_aliases doesnt exist - SOLVED

Post by gm10 » Mon Sep 17, 2018 7:16 am

tr is just a tool for character substitution in an input stream, and ROT13 is a substitution cipher, so it's the obvious tool to use (among many other possible choices).

And I was obviously joking about ROT13 being important but if you want to understand: https://en.wikipedia.org/wiki/ROT13

Post Reply

Return to “Newbie Questions”