Results 1 to 6 of 6

Thread: permanent alias

  1. #1
    Member registered user
    Join Date
    Oct 2005
    Location
    manchester, uk
    Posts
    35

    permanent alias

    I'm sorry to ask such a simple question, but I am really confused.

    I'm trying to make some aliases permanent, but I can't find the file where to write them.

    I'm using Knoppix 4.0 HD installation. When write something in my ~/.bashrc file, nothing happens, and by the way, this is what my .bashrc file says (and also what /etc/bash.bashrc says):

    Code:
    # /etc/bash.bashrc
    [ -f /etc/profile ] && . /etc/profile
    To be honest I don't really undestand what it means. I remember I managed to create some permanent aliases using the file that makes aliases for all the users, but I forgot where it is..

    If anybody could kindly help me I would be grateful. In this way I could finally get the knowledge I was looking for, since I read guides over guides, without any satisfactory explanation. Any suggestion about a good guide would be appreciated as well.

    Thank you for your help.

  2. #2
    Senior Member registered user
    Join Date
    Apr 2005
    Location
    italy
    Posts
    245

    Re: permanent alias

    Quote Originally Posted by finferflu
    To be honest I don't really undestand what it means. I remember I managed to create some permanent aliases using the file that makes aliases for all the users, but I forgot where it is..
    /etc/profile

    root@box:/mnt/hda2# tail /etc/profile
    alias which="type -path"
    alias where="type -all"
    alias ll="ls -l --color=auto"
    alias l="ls -a --color=auto"
    alias rm="rm -i"
    alias mv="mv -i"
    alias cp="cp -i"
    alias la="ls -la --color=auto"
    alias ls="ls --color=auto"
    [[ -f "/etc/autopackage/paths-bash" ]] && . "/etc/autopackage/paths-bash"

  3. #3
    Senior Member registered user
    Join Date
    Nov 2002
    Location
    USA, IL
    Posts
    1,041

    Re: permanent alias

    --When you change .bashrc, or any other file that affects bash settings, you need to either re-read it ("source") or logout/login again.

    > [ -f /etc/profile ] && . /etc/profile

    Pseudocode:
    " If exists file /etc/profile THEN source /etc/profile " -- The "&&" means "only execute the following if the preceding command has not thrown an error". Similarly, "||" means "only execute the following if the preceding HAS thrown an error/is False."

    --This syntax confused the heck out of me on UNIX back in the day as well, until I read O'Reilly's excellent BASH reference, and found out the "." is shorthand for the "source" command.

    ' man bash '
    " /source "

    Quote Originally Posted by finferflu
    I'm sorry to ask such a simple question, but I am really confused.

    I'm trying to make some aliases permanent, but I can't find the file where to write them.

    I'm using Knoppix 4.0 HD installation. When write something in my ~/.bashrc file, nothing happens, and by the way, this is what my .bashrc file says (and also what /etc/bash.bashrc says):

    Code:
    # /etc/bash.bashrc
    [ -f /etc/profile ] && . /etc/profile
    To be honest I don't really undestand what it means. I remember I managed to create some permanent aliases using the file that makes aliases for all the users, but I forgot where it is..

    If anybody could kindly help me I would be grateful. In this way I could finally get the knowledge I was looking for, since I read guides over guides, without any satisfactory explanation. Any suggestion about a good guide would be appreciated as well.

    Thank you for your help.

  4. #4
    Member registered user
    Join Date
    Oct 2005
    Location
    manchester, uk
    Posts
    35
    Thanks a lot! That's been helpful for me ^__^

    The only thing is that even though I logout/login again, it just ignores my aliases in ~/.bashrc, so I just gave up and wrote them in /etc/profile, so that they work for all users, which does not bother me at the moment. It would be useful anyway to know why it is not working for eventual future needs.

    Thanks.

  5. #5
    Senior Member registered user
    Join Date
    Nov 2002
    Location
    USA, IL
    Posts
    1,041
    ' cd; ls -al .bash_login '

    --If it doesn't exist:

    ' ln .bashrc .bash_login -sfn ' == Make bash_login -> .bashrc

    ' chmod +x .bashrc ' == Make sure it's executable

    Quote Originally Posted by finferflu
    Thanks a lot! That's been helpful for me ^__^

    The only thing is that even though I logout/login again, it just ignores my aliases in ~/.bashrc, so I just gave up and wrote them in /etc/profile, so that they work for all users, which does not bother me at the moment. It would be useful anyway to know why it is not working for eventual future needs.

    Thanks.

  6. #6
    Senior Member registered user
    Join Date
    Apr 2005
    Location
    italy
    Posts
    245
    Quote Originally Posted by finferflu
    Thanks a lot! That's been helpful for me ^__^

    The only thing is that even though I logout/login again, it just ignores my aliases in ~/.bashrc, so I just gave up and wrote them in /etc/profile, so that they work for all users, which does not bother me at the moment. It would be useful anyway to know why it is not working for eventual future needs.

    Thanks.
    # /etc/bash.bashrc
    [ -f /etc/profile ] && . /etc/profile
    alias hallo="echo This is a test"
    This works properly to me, in a knoppix 3.4 hd-install. Only the related user recognize it, not root, the right way.
    My 'ls -la .bash_login' in home-dir is: ls: .bash_login: No such file or directory

Similar Threads

  1. permanent install of the sun Java jre
    By rcblach in forum General Support
    Replies: 0
    Last Post: 06-18-2006, 12:23 AM
  2. create a permanent swap
    By thomas_remkus in forum Hardware & Booting
    Replies: 5
    Last Post: 03-12-2005, 02:47 PM
  3. alias entry disappears between boots
    By GaTk in forum General Support
    Replies: 11
    Last Post: 10-28-2004, 10:43 PM
  4. permanent config my netcard
    By kant in forum Networking
    Replies: 0
    Last Post: 09-12-2004, 07:09 PM
  5. Permanent Root Password
    By Monicker in forum General Support
    Replies: 1
    Last Post: 08-26-2004, 12:50 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


15.6

15.6" Lenovo ThinkPad Laptop PC: Intel i5 16GB RAM 512 SSD Windows 10 Webcam

$229.99



Lenovo Ideapad 1 15Iau7 15.6

Lenovo Ideapad 1 15Iau7 15.6" Laptop Intel Core i5-1235U 8GB RAM 512GB SSD W11P

$299.99



Lenovo ThinkPad E, AMD, 8GB RAM, 256GB SSD, No OS, 20T80005US picture

Lenovo ThinkPad E, AMD, 8GB RAM, 256GB SSD, No OS, 20T80005US

$280.00



Lenovo ThinkBook 15 Gen 4 Notebook 15.6

Lenovo ThinkBook 15 Gen 4 Notebook 15.6" FHD AMD R7 5825U 16GB RAM 512GB SSD

$479.99



Lenovo ThinkBook 15 Gen 4 Notebook 15.6

Lenovo ThinkBook 15 Gen 4 Notebook 15.6" FHD Intel Core i7-1255U 8GB RAM

$514.99



Lenovo ThinkPad X1 Carbon 7th Intel i7-8665U 1.90GHz 16GB RAM 512 SSD Grade B picture

Lenovo ThinkPad X1 Carbon 7th Intel i7-8665U 1.90GHz 16GB RAM 512 SSD Grade B

$229.99



Lenovo LOQ 15.6

Lenovo LOQ 15.6" FHD 144Hz Gaming Laptop i5-12450HX 12GB RAM 512GB SSD RTX 3050

$599.99



Lenovo Ideapad 1i 15.6

Lenovo Ideapad 1i 15.6" FHD Touchscreen Laptop - Intel Core i3-1215U with 8GB...

$279.99



14

14" Lenovo ThinkPad Laptop: Intel i5 Quad Core 16GB RAM 1TB SSD Windows 11

$249.95



Lenovo ThinkPad Yoga Touchscreen Laptop PC 11.6

Lenovo ThinkPad Yoga Touchscreen Laptop PC 11.6" Windows 10 4GB RAM 256GB SSD

$89.99