A couple of months ago, I made a few permanent aliases for my bash shell on Ubuntu 14.04. They are actively making my life easier, and I would like to add a couple more to the list, but I cannot find them. My .bashrc file does not actually contain any aliases, just the lines about running ~/.bash_aliases if it exists. And my ~/.bash_aliases file is completely blank.

  • Also How you made permanent aliases (by editing which file) a couple of month ago? – Pandya Sep 11 '14 at 6:09

Run man bash to see what files bash may be looking at.  They include .bash_profile, .bash_login, .profile, and, if you went privileged, /etc/bash.bashrc and /etc/profile.  Or you could pick a word or a sequence of words from one of your existing aliases (for example, qwerty aardvark42), and do

grep "qwerty aardvark42" ~/.*
grep "qwerty aardvark42" /etc/*
| improve this answer | |
  • None of .profile, .bash_profile or .bash_login will be relevant here. Those are only read by login shells, not the normal interactive ones you run when using a terminal. – terdon Sep 13 '14 at 12:32

Bash reads one of two sets of files depending on how it was invoked. In your case, since you are almost certainly running interactive,m non login shells, the possible locations of your aliases are:


Your aliases should be in one of those files. For next time, you can add this function to your ~/.bashrc which lets you easily look through all the files where a variable or an alias or similar might be found. This will work for all types of (bash) shell:

    grep -H "$@" ~/.bashrc ~/.profile ~/.bash_profile ~/bash.login ~/.bash_aliases \
        /etc/bash.bashrc /etc/profile /etc/profile.d/* /etc/environment 2>/dev/null

You can then search all those files for any given string by running

grep_bash foo
| improve this answer | |

The file /etc/skel/.bashrc contains the original .bashrc

| improve this answer | |
  • How you will find location of permanent aliases by knowing this fact? – Radu Rădeanu Sep 11 '14 at 12:25
  • The aliases are inside the file. – Harris Sep 11 '14 at 13:27
  • What make you to be sure about this? – Radu Rădeanu Sep 11 '14 at 16:36
  • That file is only used when creating a new user to copy their default .bashrc file. It does not affect any running shells at all. – terdon Sep 13 '14 at 12:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.