<---- template headericclude ----->
Where are aliases defined?
FedoraForum.org - Fedora Support Forums and Community
Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    Join Date
    Oct 2009
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Where are aliases defined?

    Hello,

    Upon a fresh install of Fedora 11 (and as a Fedora n00b), I noticed there are several aliases defined for me.
    Code:
    $ alias
    alias l.='ls -d .* --color=auto'
    alias ll='ls -l --color=auto'
    alias ls='ls --color=auto'
    alias vi='vim'
    alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
    Out of curiosity, I checked out the usual files to see what else is set, etc.. But none of the
    ~/.bashrc
    ~/.bashrc_profile
    /etc/bashrc or
    /etc/profile

    files had these aliases. So where are they?

    Thanks

  2. #2
    Join Date
    May 2007
    Location
    U.S.
    Posts
    4,851
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK. Big time edit. Looked into it further.

    ~/.bashrc conditionally loads /etc/bashrc
    Code:
    # Source global definitions
    if [ -f /etc/bashrc ]; then
    	. /etc/bashrc
    fi
    Then, /etc/bashrc conditionally loads all the scripts in /etc/profile.d/.
    Code:
    	for i in /etc/profile.d/*.sh; do
    		if [ -r "$i" ]; then
    			. $i
    For example, take a look at /etc/profile.d/which-2.sh:
    Code:
    alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
    Finally, re-adding what I had written before the first edits:
    When I want to define aliases for my use, I don't usually touch any of these except /etc/profile and ~/.bashrc. If I want an alias available to all users, I stick it in /etc/profile. For aliases I want for just one user, I use ~/.bashrc.
    Last edited by forkbomb; 15th October 2009 at 05:00 PM.

  3. #3
    Join Date
    Oct 2009
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you for your response tjvanwyk.
    But that wasn't what I exactly asked.
    When I give the alias command, it lists all the aliases defined on my system.
    Since none of these .bashrc or profile files have them, my question is where are they defined?

    Thanks ayway...

  4. #4
    Join Date
    May 2007
    Location
    U.S.
    Posts
    4,851
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ziphyre
    Thank you for your response tjvanwyk.
    But that wasn't what I exactly asked.
    When I give the alias command, it lists all the aliases defined on my system.
    Since none of these .bashrc or profile files have them, my question is where are they defined?

    Thanks ayway...
    Hi ziphyre. Sorry. I'm a moron today. I assumed that they were in /etc/profile without reading it in-depth.

    Edited my previous response.

  5. #5
    Join Date
    Oct 2009
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, thank you.

    I assume it will take some time to adjust to red-hat way...

  6. #6
    Join Date
    May 2007
    Location
    U.S.
    Posts
    4,851
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Eh... don't ask my why the bash script structure needs to be that complicated. (Also, I did the checking on my CentOS box but as far as I know Fedora and CentOS load bash the same.)

  7. #7
    PabloTwo's Avatar
    PabloTwo is offline "Registered User" T-Shirt Winner
    Join Date
    Mar 2007
    Location
    Seville, FL
    Posts
    8,808
    Mentioned
    37 Post(s)
    Tagged
    0 Thread(s)
    Most of the examples you show are defined in /etc/profile.d/colors.sh
    Code:
    ~/> cat /etc/profile.d/colorls.sh | grep alias
      alias ll='ls -l' 2>/dev/null
      alias l.='ls -d .*' 2>/dev/null
    alias ll='ls -l --color=auto' 2>/dev/null
    alias l.='ls -d .* --color=auto' 2>/dev/null
    alias ls='ls --color=auto' 2>/dev/null
    Last edited by PabloTwo; 15th October 2009 at 05:27 PM.

  8. #8
    Join Date
    Oct 2007
    Location
    Freedonia
    Age
    74
    Posts
    3,076
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't know about the rest of you, but I've always hated the color in ls, especially as it's almost impossible to find out what color means what. At first, I'd hunt down the definition and comment it out, but that only worked until the next version. Now, having /home on its own partition, I found the perfect way to nuke it once and for all by adding this line to ~/.bashrc, under the user defined aliases:

    alias ls=ls

    This overrides the default, bringing things back to the way I want them. (I also did this, of course, to /root/.bashrc.) I've never understood why the Fedora devs think everybody likes color ls, but at least it's not at all hard to override.
    Registered Linux user #470359 and permanently recovered BOFH.

    Any advice in this post is worth exactly what you paid for it.

  9. #9
    Join Date
    May 2007
    Location
    U.S.
    Posts
    4,851
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by sidebrnz
    I don't know about the rest of you, but I've always hated the color in ls, especially as it's almost impossible to find out what color means what. At first, I'd hunt down the definition and comment it out, but that only worked until the next version. Now, having /home on its own partition, I found the perfect way to nuke it once and for all by adding this line to ~/.bashrc, under the user defined aliases:

    alias ls=ls

    This overrides the default, bringing things back to the way I want them. (I also did this, of course, to /root/.bashrc.) I've never understood why the Fedora devs think everybody likes color ls, but at least it's not at all hard to override.
    I like the idea, but I'm colorblind. I usually use a black background terminal with white/light grey text. But the directories appearing in flat blue make their names essentilaly unreadable to me (maybe to others too?). Wonder if there's a way to change it.

    EDIT: Spoke too soon again. Answered my own question:
    http://aplawrence.com/Bofcusm/345.html

    e.g. dircolors -p will display what the colors are mapped too.
    Last edited by forkbomb; 15th October 2009 at 11:11 PM.

  10. #10
    PabloTwo's Avatar
    PabloTwo is offline "Registered User" T-Shirt Winner
    Join Date
    Mar 2007
    Location
    Seville, FL
    Posts
    8,808
    Mentioned
    37 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by tjvanwyk
    ....But the directories appearing in flat blue make their names essentilaly unreadable to me (maybe to others too?). Wonder if there's a way to change it.
    There sure is. You can customize the terminal colors to your hearts content. Start out by putting a copy of /etc/DIR_COLORS in your home directory as a hidden file.
    Code:
    cp /etc/DIR_COLORS ~/.dir_colors
    It doesn't matter if you use upper or lower case for the file name. The .dir_colors file will take precedence for that user. Now have a look at what controls the color of directories. To do that:
    Code:
    dircolors -p
    will print out all the available options you can put into that ~/.dir_colors file. For setting the color scheme for a directory, the code is, tah dah, DIR. Just edit the DIR line with the color scheme you want. The default is

    DIR 01;34 # directory

    bold blue text

    Edit: I guess I failed to notice your edit at the bottom
    Last edited by PabloTwo; 16th October 2009 at 12:46 AM.

  11. #11
    Join Date
    Oct 2007
    Location
    Freedonia
    Age
    74
    Posts
    3,076
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    And where, pray tell, is there a listing of what numbers correspond to what color? Without that, the listing of colors is useless, unless you're already a graphic artist, which I'm not.
    Registered Linux user #470359 and permanently recovered BOFH.

    Any advice in this post is worth exactly what you paid for it.

  12. #12
    PabloTwo's Avatar
    PabloTwo is offline "Registered User" T-Shirt Winner
    Join Date
    Mar 2007
    Location
    Seville, FL
    Posts
    8,808
    Mentioned
    37 Post(s)
    Tagged
    0 Thread(s)
    If you look at the /etc/DIR-COLORS file, there are comment lines that show you the codes. Ditto for the output of the 'dircolors -p' command.

  13. #13
    scottro's Avatar
    scottro is offline Retired Community Manager -- Banned from Texas by popular demand.
    Join Date
    Sep 2007
    Location
    NYC
    Posts
    8,120
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah, it's around, but it's not like BSD, where you can type man colors and get some answers.

    I remember wanting to change them, and having to dig around for a bit.

    To unalias for one terminal session

    \ls will remove the alias.

    You can put unalias ls in .bash_profile as well, I think.
    --
    http://srobb.net

  14. #14
    Join Date
    Oct 2007
    Location
    Freedonia
    Age
    74
    Posts
    3,076
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Actually, /etc/DIR_COLORS (note the typo correction) tells you what *numbers* represent what file type, but now what *color* the numbers translate to, and without that, it's useless to me.
    Registered Linux user #470359 and permanently recovered BOFH.

    Any advice in this post is worth exactly what you paid for it.

  15. #15
    scottro's Avatar
    scottro is offline Retired Community Manager -- Banned from Texas by popular demand.
    Join Date
    Sep 2007
    Location
    NYC
    Posts
    8,120
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I do remember figuring it out, but I think I already had some experience with ANSI colors.

    Unfortunately, it's one of those things where there isn't one man page that explains it clearly, at least clearly to the non-expert. There might have been a man page that was related--but I fear I don't remember it now, and I'm pretty sure it didn't show up when I did apropos colors.


    Actually, in DIR_COLORS, it does give some hints--that 31 is bright red, 32 bright green and the like. The easiest thing, and I think this is what I did, was do a google for something like ansi colors linux ls or something similar, and I found some clear instructions fairly quickly.
    --
    http://srobb.net

Page 1 of 2 12 LastLast

Similar Threads

  1. NameError: global name 'os' is not defined
    By dcatkin in forum Alpha, Beta & Snapshots Discussions (Fedora 10 Only)
    Replies: 5
    Last Post: 8th November 2008, 03:16 PM
  2. Where are aliases defined ?
    By teox78 in forum Alpha - Beta (Fedora 9 Only)
    Replies: 1
    Last Post: 18th April 2008, 09:42 AM
  3. GLIBC_2.0 not defined error?
    By thesun in forum Using Fedora
    Replies: 8
    Last Post: 18th December 2006, 10:00 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
[[template footer(Guest)]]