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
  •  


Kingston 32GB 64GB 128GB 256GB USB 3.0 Flash Drive Thumb Memory Stick Pen lot picture

Kingston 32GB 64GB 128GB 256GB USB 3.0 Flash Drive Thumb Memory Stick Pen lot

$285.90



SanDisk Ultra Luxe USB 3.1 Flash Drive – 5 Pack | Premium Metal USB Flash Drives picture

SanDisk Ultra Luxe USB 3.1 Flash Drive – 5 Pack | Premium Metal USB Flash Drives

$59.99



1/ 10/ 100pcs USB 2.0 2GB, 4GB ,8GB ,16GB ,32GB ,64GB 128GB USB Flash Drives Lot picture

1/ 10/ 100pcs USB 2.0 2GB, 4GB ,8GB ,16GB ,32GB ,64GB 128GB USB Flash Drives Lot

$269.10



Microsoft Windows 11 Pro 64bit - New Sealed – Flash USB 1 PC picture

Microsoft Windows 11 Pro 64bit - New Sealed – Flash USB 1 PC

$49.99



USB 3.0 Flash Drive 32GB 64GB 128GB Memory Stick Thumb Stick Lot Pack picture

USB 3.0 Flash Drive 32GB 64GB 128GB Memory Stick Thumb Stick Lot Pack

$826.09



Lot 5/10pcs USB Flash Drive Memory Stick 1MB-64GB Pendrive Thumb Drive 8GB 32GB picture

Lot 5/10pcs USB Flash Drive Memory Stick 1MB-64GB Pendrive Thumb Drive 8GB 32GB

$385.00



USB Type-A Flash Drive Metal Memory Stick High Speed USB Drive 128GB 256GB 512GB picture

USB Type-A Flash Drive Metal Memory Stick High Speed USB Drive 128GB 256GB 512GB

$8.47



LOT 10x SanDisk 32GB ULTRA USB 3.0 flash drive SDCZ48-032G 32 GB read 100 MB/s picture

LOT 10x SanDisk 32GB ULTRA USB 3.0 flash drive SDCZ48-032G 32 GB read 100 MB/s

$39.80



2021 Full Version Office Professional Plus for 1 PC Flash USB Drive picture

2021 Full Version Office Professional Plus for 1 PC Flash USB Drive

$59.99



128GB USB 14-in-1 MacOS bootable Installer repair recovery tech support service picture

128GB USB 14-in-1 MacOS bootable Installer repair recovery tech support service

$39.99