Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
02-26-2003, 09:27 AM
|
#1
|
Member
Registered: Feb 2003
Distribution: Redhat 9.0
Posts: 104
Rep:
|
alias in bash shell
hi,
i am using redhat 7.3 at this moment. my problem is, in the command line, when i set an alias it wont last long, when i reboot the machine, the alias that i had set before is not listed. whay is that happened?
|
|
|
02-26-2003, 09:39 AM
|
#2
|
Senior Member
Registered: Dec 2002
Location: Atlantic City, NJ
Distribution: Ubuntu & Arch
Posts: 3,503
Rep:
|
If you set the alias from a command line it will go away when you close the shell. Its a temporary variable. If you want the alias always available you would edit thats users .bashrc file. Lets say you want the user john to have an alias for searching for rpms. You would add this line into /home/john/.bashrc
alias rpmfind='rpm -qa | grep '
If you want ALL users to have this alias then you would add that line to the /etc/bashrc file.
|
|
|
02-26-2003, 11:49 AM
|
#3
|
Member
Registered: Feb 2003
Location: Switzerland, Berne
Distribution: Slackware 9.0
Posts: 186
Rep:
|
Or for Slackware users:
alias checkpkg='ls /var/log/packages/ | grep '
|
|
|
02-26-2003, 12:28 PM
|
#4
|
Member
Registered: Nov 2001
Location: Exeter, UK
Distribution: Gentoo 1.4
Posts: 243
Rep:
|
or for gentoo users
/etc/profile
|
|
|
02-27-2003, 02:18 AM
|
#5
|
Member
Registered: Feb 2003
Distribution: Redhat 9.0
Posts: 104
Original Poster
Rep:
|
woww.....
never thought that there will be good and fast reply on this thread. anyway, what to say... but thanx so much guys. you are helping me. especially to Crashed_Again!!. you gave good reply and the most detailed one.
hope i could get help from all of you again since there are still many question in my head.
|
|
|
02-27-2003, 02:20 AM
|
#6
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417
|
why do you say you didn't expect a reply? it's a perfectly straightforward question, and, of course, linuxquestions rules.
|
|
|
02-27-2003, 09:03 AM
|
#7
|
Member
Registered: Feb 2003
Distribution: Redhat 9.0
Posts: 104
Original Poster
Rep:
|
this is my first time in this question board, and that one is my first question here. i did not meant that i did not expected any reply.... but i did not thought that it would be this fast.
|
|
|
02-27-2003, 10:15 AM
|
#8
|
Senior Member
Registered: Dec 2002
Location: Atlantic City, NJ
Distribution: Ubuntu & Arch
Posts: 3,503
Rep:
|
Don' knock me off my pedistal Acid_Kewpie.  I know it is a simple question for a guru like yourself.
|
|
|
02-27-2003, 10:34 AM
|
#9
|
Member
Registered: Feb 2003
Location: Switzerland, Berne
Distribution: Slackware 9.0
Posts: 186
Rep:
|
We all started as beginner once a day.
|
|
|
02-28-2003, 12:42 AM
|
#10
|
Member
Registered: Feb 2003
Distribution: Redhat 9.0
Posts: 104
Original Poster
Rep:
|
well, since i knew how to set up an alias. i just thinking about having an alias like this
alias 1='CTRL+Alt+1'------> until ctrl+alt+6. but i dont think that the system could identify those 'crtl and alt'. what should i put for the 'crtl' and 'alt'. does anyone know?
|
|
|
02-28-2003, 08:04 AM
|
#11
|
Senior Member
Registered: Dec 2002
Location: Atlantic City, NJ
Distribution: Ubuntu & Arch
Posts: 3,503
Rep:
|
That is a whole different beast wincrk and to tell you the truth I have no idea how you would do something like that. Aliases are based on commands. If you type:
CTRL+ALT+1
at a command you'll get a message saying:
bash: CTR+ALT+1: command not found
because that is not a command.
|
|
|
02-28-2003, 08:08 PM
|
#12
|
Member
Registered: Feb 2003
Distribution: Redhat 9.0
Posts: 104
Original Poster
Rep:
|
then i think i have no choice, but to forget about that. but it is still OK. alias are so signifant to me.
|
|
|
07-20-2004, 12:35 PM
|
#13
|
Member
Registered: Jun 2004
Distribution: Turtle Kevux 0.8.8
Posts: 129
Rep:
|
Trying
The files your looking for is in the /etc/ I am pretty sure.
I once was able to do this, I have to go back to the next LUG meeting and ask again. Once done I'll let you know.
Problem is, when you set it in the shell like this: "alias wmaker = 'WINDOWMANAGER = /usr/X11R6/bin/wmaker'" It will only work for that session. Once you reboot it is gone. In fact, alias is ALWAYS like that.
To solve it, you have to find the file (which I am looking for under Java Sun Os/Suse (which they seem to make it elusive)) that deals with aliases. Problem is its generally NOT the file called "aliases"!!! What fun!
Instead, you might be able to find it in the ".bashrc", ".bash_profile", but you'll have to do the snooping yourself. An easy..yeah right..way to find it would but to type "alias" and then look for a file that has similar contents to your "alias" command displayed.
it will pretty much be loaded in your startup scripts, and thus you always get the aliases you had last time (in that apparently elusive file).
If you find it PLEASE let me know....I forgot...and I have found it very useful for some shorthand techniques.
I hope this helps you get int he correct direction as these people seem to not completely understand what your asking.
|
|
|
All times are GMT -5. The time now is 06:20 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|