Locating a Preconfigured “ls” Alias in CentOS Using grep

Linux distributions sometimes configure “ll” (lowercase L’s) as an alias to “ls -l”. Debian based OS’s typically do this from the users ~/.bashrc file. This is not the case with Red Hat/CentOS based OS’s. I couldn’t remember where CentOS set the alias and I needed to locate it. As a non-root user, this proved to be a little more challenging than I first expected. Yes, I could look it up on the web but I decided to make an exercise out of it and it was more challenging than it would first seem.

grep -riE "alias ?ll" /etc/ 2> /dev/null

I’m sure there are other ways to it but this worked. In short. I knew I needed to search for “ll” in /etc, but “ll” is also common in many words. Also, I’m running as a normal user so I wanted to avoid “Permission Denied” and other errors that cluttered the search.

Note the the following also returns the same:

 grep -riE "alias ?ll" /etc/ 2>&1 | grep -v "Permission"