LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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


Reply
  Search this Thread
Old 02-26-2003, 09:27 AM   #1
wincrk
Member
 
Registered: Feb 2003
Distribution: Redhat 9.0
Posts: 104

Rep: Reputation: 15
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?
 
Old 02-26-2003, 09:39 AM   #2
Crashed_Again
Senior Member
 
Registered: Dec 2002
Location: Atlantic City, NJ
Distribution: Ubuntu & Arch
Posts: 3,503

Rep: Reputation: 57
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.
 
Old 02-26-2003, 11:49 AM   #3
kater
Member
 
Registered: Feb 2003
Location: Switzerland, Berne
Distribution: Slackware 9.0
Posts: 186

Rep: Reputation: 30
Or for Slackware users:

alias checkpkg='ls /var/log/packages/ | grep '
 
Old 02-26-2003, 12:28 PM   #4
acid2000
Member
 
Registered: Nov 2001
Location: Exeter, UK
Distribution: Gentoo 1.4
Posts: 243

Rep: Reputation: 30
or for gentoo users

/etc/profile
 
Old 02-27-2003, 02:18 AM   #5
wincrk
Member
 
Registered: Feb 2003
Distribution: Redhat 9.0
Posts: 104

Original Poster
Rep: Reputation: 15
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.
 
Old 02-27-2003, 02:20 AM   #6
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
why do you say you didn't expect a reply? it's a perfectly straightforward question, and, of course, linuxquestions rules.
 
Old 02-27-2003, 09:03 AM   #7
wincrk
Member
 
Registered: Feb 2003
Distribution: Redhat 9.0
Posts: 104

Original Poster
Rep: Reputation: 15
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.
 
Old 02-27-2003, 10:15 AM   #8
Crashed_Again
Senior Member
 
Registered: Dec 2002
Location: Atlantic City, NJ
Distribution: Ubuntu & Arch
Posts: 3,503

Rep: Reputation: 57
Don' knock me off my pedistal Acid_Kewpie. I know it is a simple question for a guru like yourself.
 
Old 02-27-2003, 10:34 AM   #9
kater
Member
 
Registered: Feb 2003
Location: Switzerland, Berne
Distribution: Slackware 9.0
Posts: 186

Rep: Reputation: 30
We all started as beginner once a day.
 
Old 02-28-2003, 12:42 AM   #10
wincrk
Member
 
Registered: Feb 2003
Distribution: Redhat 9.0
Posts: 104

Original Poster
Rep: Reputation: 15
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?
 
Old 02-28-2003, 08:04 AM   #11
Crashed_Again
Senior Member
 
Registered: Dec 2002
Location: Atlantic City, NJ
Distribution: Ubuntu & Arch
Posts: 3,503

Rep: Reputation: 57
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.
 
Old 02-28-2003, 08:08 PM   #12
wincrk
Member
 
Registered: Feb 2003
Distribution: Redhat 9.0
Posts: 104

Original Poster
Rep: Reputation: 15
then i think i have no choice, but to forget about that. but it is still OK. alias are so signifant to me.
 
Old 07-20-2004, 12:35 PM   #13
Yerp
Member
 
Registered: Jun 2004
Distribution: Turtle Kevux 0.8.8
Posts: 129

Rep: Reputation: 15
Question 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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
setting alias in bash, permanently allelopath Linux - General 6 10-24-2008 04:10 AM
Lost pane,issues when creating alias from the bash shell spoult Linux - Software 2 04-19-2005 06:22 AM
bash ls --color alias? tripmix Linux - Newbie 7 01-18-2005 04:49 AM
A bash alias question CodeWarrior Slackware 11 06-03-2003 07:09 PM
bash and alias kleptos Slackware 6 01-23-2003 08:01 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:20 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration