LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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 07-14-2007, 03:20 PM   #1
carlosinfl
Senior Member
 
Registered: May 2004
Location: Orlando, FL
Distribution: Arch
Posts: 2,905

Rep: Reputation: 77
Creating Command Alias?


I would like to create a simple alias for vpnc to just be vpn. Yes, I know the alias is simply the exclusion of one simple letter or key stroke but it is just a test as I have never done this before.

I did a search and there seems to be no man page on this on my system which led me to Google results and they did not work on my system.

Code:
tunafish:/home/cwilliams/Desktop# alias -p vpnc=vpn
alias cp='cp -i'
alias l='ls $LS_OPTIONS -lA'
alias ll='ls $LS_OPTIONS -l'
alias ls='ls $LS_OPTIONS'
alias mv='mv -i'
alias rm='rm -i'
What am I doing wrong?
 
Old 07-14-2007, 03:33 PM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Where did you get the "-p" switch?

On my machine, this works:

alias l=ls

And there is also "unalias"

Also no man page for either--I did get some info by typing "alias --help" and "unalias --help"
Code:
root@1[play]# alias --help
bash: alias: --: invalid option
alias: usage: alias [-p] [name[=value] ... ]
root@1[play]# unalias --help
bash: unalias: --: invalid option
unalias: usage: unalias [-a] name [name ...]
root@1[play]#
Still don't know what the switches do, but I'm guessing that "unalias -a" means delete all aliases. (I'm not going to try it--too lazy to recreate them all)
 
Old 07-14-2007, 03:41 PM   #3
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
man bash
/^ *alias




Cheers,
Tink
 
Old 07-14-2007, 05:32 PM   #4
carlosinfl
Senior Member
 
Registered: May 2004
Location: Orlando, FL
Distribution: Arch
Posts: 2,905

Original Poster
Rep: Reputation: 77
Yes - unalias -a removes everything listed when you run the command "alias". I just tested it however I had some generic ssh and ls aliases I simply created on the fly.

Thanks all!
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Help creating an Alias that will mount floppy mral Linux - Newbie 8 12-24-2005 06:47 AM
Need advice on creating an alias thorney Linux - General 2 11-27-2005 07:33 PM
Creating an alias (name=value pair) where the name has spaces. Cubert Linux - Newbie 2 01-12-2005 06:42 AM
Creating mult command alias in BASH labob Linux - Newbie 1 11-18-2004 07:37 PM
problem creating an alias to mount a drive j_l_ajaste Linux - Newbie 6 07-01-2003 10:41 PM

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

All times are GMT -5. The time now is 07:39 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