LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-18-2018, 08:10 AM   #1
taylorkh
Senior Member
 
Registered: Jul 2006
Location: North Carolina
Distribution: CentOS 6, CentOS 7 (with Mate), Ubuntu 16.04 Mate
Posts: 1,994

Rep: Reputation: 163Reputation: 163
ls -l is aliased to ll - but where?


I am taking the liberty to post my question to this forum as it should be basic and the answer might be of interest to new Linux users.

When I first started dabbling with Linux MANY years ago I learned how to alias the "ls -l" command to "ll" by adding it to my .bash_profile file or perhaps a couple of other ways as well. Cool! On the other hand... the alias has been the default in most distros I have used for a LONG time.

Today, for reasons beyond the scope of this question, I decided to track down where this alias was set on my CentOS 7 machine.
Code:
[ken@vmCentOS7Mate Desktop]$ which ll
alias ll='ls -l --color=auto'
	/usr/bin/ls
I looked in my ~./.bash_profile

which pointed to ~/.bashrc
which pointed to /etc/bashrc
which says "# System wide functions and aliases"

I see no aliases set in this file.

Where oh where is the alias being set?

TIA,

Ken
 
Old 11-18-2018, 08:11 AM   #2
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 14,658

Rep: Reputation: 4775Reputation: 4775Reputation: 4775Reputation: 4775Reputation: 4775Reputation: 4775Reputation: 4775Reputation: 4775Reputation: 4775Reputation: 4775Reputation: 4775
see man bash, look for invocation and you will find all the files....
 
1 members found this post helpful.
Old 11-18-2018, 08:51 AM   #3
mddnix
Member
 
Registered: Mar 2013
Distribution: Redhat, Ubuntu
Posts: 540

Rep: Reputation: 153Reputation: 153
Code:
# grep -r 'alias ll=' /etc/* 2> /dev/null
/etc/profile.d/colorls.sh:  alias ll='ls -l' 2>/dev/null
/etc/profile.d/colorls.sh:alias ll='ls -l --color=auto' 2>/dev/null
 
1 members found this post helpful.
Old 11-18-2018, 09:25 AM   #4
taylorkh
Senior Member
 
Registered: Jul 2006
Location: North Carolina
Distribution: CentOS 6, CentOS 7 (with Mate), Ubuntu 16.04 Mate
Posts: 1,994

Original Poster
Rep: Reputation: 163Reputation: 163
Thanks pan64,

Invocation is a good answer on a Sunday Unfortunately the offending file, per mddnix's answer, is not on the man page. However, the invocation information will be useful in tracking down my "beyond the of this post" question which deals with commands which cannot be run from a script. Thanks again!

Thank you mddnix! That did the trick. I am not sure I would have thought of putting the alias in a file of that name. I guess it made sense to someone. Just out of curiosity I decided to look for vi = vim.
Code:
[root@taylor20 profile.d]# grep -r 'alias vi=' /etc/* 2> /dev/null
/etc/profile.d/vim.sh:  alias vi >/dev/null 2>&1 || alias vi=vim
There are several interesting files in /etc/profile.d. I am starting to see the pattern of how these things are organized.

Cheers,

Ken
 
Old 11-18-2018, 09:54 AM   #5
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 14,658

Rep: Reputation: 4775Reputation: 4775Reputation: 4775Reputation: 4775Reputation: 4775Reputation: 4775Reputation: 4775Reputation: 4775Reputation: 4775Reputation: 4775Reputation: 4775
unfortunately you are right, the directory /etc/profile.d is an extension (or improvement?) to the original file /etc/profile.
 
Old 11-18-2018, 10:13 AM   #6
mddnix
Member
 
Registered: Mar 2013
Distribution: Redhat, Ubuntu
Posts: 540

Rep: Reputation: 153Reputation: 153
Quote:
Originally Posted by taylorkh View Post
Thank you mddnix!
You're welcome
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] time command in bash is aliased or defined... but how? Beryllos Linux - General 4 09-26-2014 01:40 AM
kde fonts are no longer anti-aliased after XFree86 upgrade (apt) but gnome is fine? scobiej Red Hat 0 11-25-2003 07:28 AM
Anti Aliased fonts? justiceisblind Linux - Newbie 2 01-30-2003 10:11 AM
mozilla anti-aliased fonts... again eccarlsen Slackware 1 10-15-2002 06:48 AM
Mozilla/Netscape etc. anti-aliased fonts jrockey Linux - Newbie 3 05-25-2001 06:53 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:32 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration