Find out where alias was set

Project:Linux software
Component:Documentation
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Related pages:#5597: bash: alias
Tags:alias, bash
Description

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

$ 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'

Comments

#1

#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'

#2

Related pages:+5597: bash: alias

#3

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.

#4

Title:Reverse alias» Find out where alias was set

#5

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