Find the answer to your Linux question:
Page 1 of 3 1 2 3 LastLast
Results 1 to 10 of 22
Hi, I tried to make some shortcut keys using Alias command as root user. It created and worked perfectly. But after I relogged, they were gone! Are these commands not ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux User src2206's Avatar
    Join Date
    Aug 2006
    Location
    Kolkata, India
    Posts
    285

    Post Alias- not permanent?


    Hi,
    I tried to make some shortcut keys using Alias command as root user. It created and worked perfectly. But after I relogged, they were gone! Are these commands not permanent? If not, then how can I save them succesfully so that I do not have to recreate them every time I login?

    Plese help.

  2. #2
    Just Joined!
    Join Date
    Oct 2006
    Location
    Wellington, NZ
    Posts
    16
    you need to put them into your startup files. these files depend on the shell you use.

    in your home directory, there may or may not be some startup files that start with a '.' Do a 'ls -la' to view all the files. The default shell is bash, so you could put your aliases into either .bash_profile or .bashrc. By default the root user on Redhat EL4 has a few aliases set up in .bashrc, so you could just put them in under that.

    The format for the file is just the same as you would run from the command line as these files are effectively executed as if they were all typed in manually, one command at a time.

    If you're running something like C shell, then your startup file would be .cshrc

  3. #3
    Just Joined!
    Join Date
    Oct 2006
    Location
    Wellington, NZ
    Posts
    16
    forgot to say... if the files don't exist, just create them, but make sure to have the fullstop at the start of the filename.

  4. #4
    Linux Newbie objuan's Avatar
    Join Date
    Jul 2006
    Location
    california
    Posts
    234
    Here is a example of a alias and the alias should go in the .bashrc file
    in the users home directory
    this example was to make a short cut for a server login

    alias name="ssh -i .ssh/name.KEY domain.domain.net -p 0000 -l username"

    save you file and exit your bash now restart your bash shell and your alias will work from now on.

  5. #5
    Super Moderator devils casper's Avatar
    Join Date
    Jun 2006
    Location
    Chandigarh, India
    Posts
    24,729
    write down all shortcuts in a file <name.sh> and move it to ~/.kde/env folder.
    .bashrc or other profile files get executed only if you start shell session ( terminal/konsole). so, better way is to put shorcuts in a location which 'GUI' looks and execute files/commands on Logging In.




    casper
    It is amazing what you can accomplish if you do not care who gets the credit.
    New Users: Read This First

  6. #6
    Linux User src2206's Avatar
    Join Date
    Aug 2006
    Location
    Kolkata, India
    Posts
    285
    Thanks friends.

    Casper, thanks for coming. I am using GNOME, in that case will the location be
    ~/.kde/env
    ? And what exactly do you mean by "~" and ".kde"?

  7. #7
    Linux Guru techieMoe's Avatar
    Join Date
    Aug 2004
    Location
    Texas
    Posts
    9,496
    Quote Originally Posted by src2206
    Thanks friends.

    Casper, thanks for coming. I am using GNOME, in that case will the location be ? And what exactly do you mean by "~" and ".kde"?
    A tilde "~" in the Linux realm generally represents the path to your user's home directory. For instance, if I have a user named bob, that user would have a home directory in /home/bob. This doesn't take very much typing, but when you get into subdirectories it can be quite long, so rather than typing this:

    /home/bob/games/quake4/base/quake400001.pak

    I would write this:

    ~/games/quake4/base/quake400001.pak

    As for the period before the name in a directory, this is a special "hidden" directory in Linux/UNIX/BSD. It does not show up under a normal ls list. Instead, it only shows up under a full ls -al list. Your ~/.kde directory is the hidden directory .kde, which is inside your home directory.
    Registered Linux user #270181
    TechieMoe's Tech Rants

  8. #8
    Linux User src2206's Avatar
    Join Date
    Aug 2006
    Location
    Kolkata, India
    Posts
    285
    Thanks my friend, I'll check out and post the result here soon.

  9. #9
    Linux User src2206's Avatar
    Join Date
    Aug 2006
    Location
    Kolkata, India
    Posts
    285
    Hi Friends,
    Sorry for this delayed reply.

    I beleive I must be misunderstanding something as the above process did not work.

    Here is my My Shortcut.sh content:

    c="/sbin/ifup ppp0"

    d="/sbin/ifdown ppp0"

    s="/sbin/adsl-status"
    The above file is located at /home/src/.kde.

    As I use GNOME, I placed the same file at /home/src/.gnome as placing in .kde did not work .
    The file content is same as above.

    I can't understand what is my mistake- but it is not working .

    So lease help.

  10. #10
    Just Joined!
    Join Date
    Jun 2006
    Location
    Egypt, CAIRO
    Posts
    48
    I think that it's much easier to discuss in that way
    Simply, edit your .bashrc file using any text editor (say vi) by adding the alias commands you need, save and exit!
    That's all!

    Regards,
    Ahmad,

Page 1 of 3 1 2 3 LastLast

Posting Permissions

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