Find the answer to your Linux question:
Results 1 to 9 of 9
How do I keep my alias entries after I restart? (the alias whatever=command command)...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Feb 2004
    Location
    Minnesota
    Posts
    11

    command line aliases after restart?


    How do I keep my alias entries after I restart? (the alias whatever=command command)

  2. #2
    Linux Guru sarumont's Avatar
    Join Date
    Apr 2003
    Location
    /dev/urandom
    Posts
    3,682
    Are you referring to command line aliases? If so, then just add the 'alias=' entry to your ~/.bashrc
    "Time is an illusion. Lunchtime, doubly so."
    ~Douglas Adams, The Hitchhiker's Guide to the Galaxy

  3. #3
    Linux Newbie lugoteehalt's Avatar
    Join Date
    Jan 2004
    Posts
    232
    According to the manual, the bit about funtions, it is almost always preferrable to use functions rather than aliases.

    Well, it interests me.
    All power is violence; all power is evil.
    Money As Debt

  4. #4
    Linux Newbie
    Join Date
    Mar 2003
    Location
    Istanbul/Trkiye
    Posts
    246
    Quote Originally Posted by lugoteehalt
    According to the manual, the bit about funtions, it is almost always preferrable to use functions rather than aliases.

    Well, it interests me.
    I agree with you lugoteehalt. Aliases dont take parameters like $1. So functions are always preferable.

    I learnt this here, this forum [/b]
    Just a Newbie....Looking 4 Info....

  5. #5
    Linux Newbie
    Join Date
    Feb 2003
    Location
    Swansea (UK)
    Posts
    221
    i'm not on linux now so i cant check the MAN Alias.......What is the format that these aliases are wrote in?

  6. #6
    Linux Guru
    Join Date
    Oct 2001
    Location
    Tby, Sweden
    Posts
    7,578
    Well, there are still cases where aliases are preferrable. Aliases can be thought of as just a simple command expansion. For example, if you run this:
    Code:
    alias 'ls=ls --color'
    If you then run `ls *.c', it will expand `ls' into `ls --color', so that the command line that it runs becomes `ls --color *.c'. That's all there is to aliases. Whether you want to use an alias or a function depends on the application.

  7. #7
    Linux Newbie
    Join Date
    Feb 2003
    Location
    Swansea (UK)
    Posts
    221
    so could i do
    Code:
    Alias winmount=mount dev/hda1 mnt/WINNT
    Then if i typed 'winmount' it would mount my windows partition, would that alias work?

  8. #8
    Linux Guru
    Join Date
    Oct 2001
    Location
    Tby, Sweden
    Posts
    7,578
    Nope. That wouldn't work since you haven't quoted it properly. This, however, would work:
    Code:
    alias 'winmount=mount /dev/hda1 /mnt/WINNT'

  9. #9
    Linux Newbie
    Join Date
    Feb 2003
    Location
    Swansea (UK)
    Posts
    221
    Quote Originally Posted by Dolda2000
    Nope. That wouldn't work since you haven't quoted it properly. This, however, would work:
    Code:
    alias 'winmount=mount /dev/hda1 /mnt/WINNT'
    haha it wondered why i never worked

Posting Permissions

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