Find out where alias was set

Project:Linux software
Category:feature request
Related pages:#5597: bash: alias
Tags:alias, bash

If I do:
$ alias my_aliased_command
I can find out which command the alias stands for.

$ alias ll
alias ll='ls -lh --color=always'
$ alias lla
alias lla='ls -lha'
$ alias la
alias la='ls -A --color=always'

Is there a way to discover we might have set up on our system but forgotten (or simply didn't know about)?

I'd like to be able to do:

$ alias --reverse ls
alias la='ls -A --color=always'
alias lla='ls -lha'
alias ll='ls -lh --color=always'



#5594: No manual entry for alias
Lacking a man page, I am discovering possibilities by chance.

$ alias --reverse ls
bash: alias: --: invalid option
alias: usage: alias [-p] [name[=value] ... ]

I haven't figured out what the -p option stands for.

However, I found out that simply 'alias' displays a list of aliases. Thus, we can combine alias and grep to achieve something close to the desired feature:

$ alias | grep ls
alias la='ls -A --color=always'
alias ll='ls -lh --color=always'
alias lla='ls -lha'
alias ls='ls --color=auto'


Related pages:+5597: bash: alias


In addition, I'd like to be able to figure out where a particular alias was set.
The output of alias should be coloured with the file and line number a specific alias was set.


Title:Reverse alias» Find out where alias was set


Regarding comment #1, I do now have a man page for alias, but there is no indication of any -p argument.