LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-04-2005, 02:19 AM   #1
tetpt
LQ Newbie
 
Registered: Nov 2004
Location: Minnesota
Distribution: Debian, Fedora, Red Hat
Posts: 9

Rep: Reputation: 0
Another Newbie question....Alias


I have a command I like to use a lot with a particular parameter and I would like to have it execute that way by just typing the command. I know I read this somewhere and it's pretty easy, but I forget how and I don't know where to look. What's the command?
 
Old 03-04-2005, 02:26 AM   #2
slackie1000
Senior Member
 
Registered: Dec 2003
Location: Brasil
Distribution: Arch
Posts: 1,037

Rep: Reputation: 46
hi there,

this depends of which shell you are using.
supposing bash, try
Code:
alias something="something --blah --blah"
then your command "something" will be executed automatic with the parameters --blah --blah.
you if want that forever, add this line to your .bashrc file.

regards

slackie1000
 
Old 03-04-2005, 02:33 AM   #3
ampex189
Member
 
Registered: Aug 2003
Location: Vancouver, Canada
Distribution: mepis 3.3.1
Posts: 82

Rep: Reputation: 15
if you do that, can you then use that command, with a different set of arguments? ie if you
Code:
alias shutdown=shutdown -h now
could you then
Code:
shutdown -r now
?? Just wondering

Ampex189
 
Old 03-04-2005, 02:36 AM   #4
krishvij
Member
 
Registered: Feb 2005
Location: India
Distribution: RHEL 3
Posts: 108

Rep: Reputation: 15
in that case u will need to write a shell script instead of just alias.
 
Old 03-04-2005, 04:29 AM   #5
slackie1000
Senior Member
 
Registered: Dec 2003
Location: Brasil
Distribution: Arch
Posts: 1,037

Rep: Reputation: 46
yep,

indeed and that is the danger to make everything an alias...
you could use sometrick like calling your first alias shutdown1 but this could bring a mess quite fast to your computer.
i agree with krishvij, write a small shell script and everything is solved keeping the feng-shui...

regards

slackie1000
 
Old 03-04-2005, 10:58 AM   #6
tetpt
LQ Newbie
 
Registered: Nov 2004
Location: Minnesota
Distribution: Debian, Fedora, Red Hat
Posts: 9

Original Poster
Rep: Reputation: 0
Thumbs up Thanks Slackie!

I guess I kind of answered that myself. Let's just say I want to take a look at the .bashrc file and make this change permanent, but I'm not quite sure where to look. If I use "find" I need to specify a path name. Is there a way to look if the absolute path is unknown?

Once I find this file, I can open it with a text editor and add the line at the bottom, correct? I think I'm going to try to work with emacs for now. Good start?
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Alias question (2 commands for one alias) gflores Linux - Newbie 3 01-21-2006 12:40 AM
Newbie Help : can i setup IP Masquerading with a device alias ? venicivivedi Linux - Networking 2 05-03-2004 12:37 AM
alias newbie french_frogger Linux - Newbie 2 03-17-2004 07:07 PM
very newbie alias question ffang Linux - Newbie 4 09-04-2003 07:46 PM
alias question tied2 Linux - General 4 08-23-2002 10:50 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:57 AM.

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