LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 03-20-2008, 10:12 AM   #1
kaplan71
Member
 
Registered: Nov 2003
Posts: 809

Rep: Reputation: 39
creating alias


Hi there --

I want to create an alias and my first choice is to modify the .bashrc file. However, according to the documentation there, it is recommended that I create a .bash_aliases file and add the alias there.

Has anyone done it this way, and besides creating the file what else do I need to do in order to get the alias to work properly? Thanks.
 
Old 03-20-2008, 10:30 AM   #2
b1f30
Member
 
Registered: Nov 2007
Location: GMT -5, who wants to know
Distribution: Gentoo, Debian, BSD, Slack
Posts: 119

Rep: Reputation: 15
Here's an example that I use for Bash in Debian:

Code:
# echo "alias ls='ls -lha'" >> ~/.bashrc
# source ~/.bashrc
Give it a shot.

I'm not sure why the documentation recommends that you put aliases elsewhere. I've personally never done it that way, but perhaps there is a reason.
 
Old 03-20-2008, 12:14 PM   #3
marozsas
Senior Member
 
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,499
Blog Entries: 2

Rep: Reputation: 68
To avoid the .bashrc becomes cluttered with so many commands, I choose (a personal choice) to put aliases in a separated file.

in ~/.bashrc:
Code:
test -s ~/.alias && . ~/.alias || true
in ~/.alias:
Code:
alias a=alias
a h=history
a ll='ls -l'
In this way it is easy to just edit .alias to add/modify an alias.

But as I said, it is a personal choice. Putting aliases inside .bashrc as b1f30 did is just fine too.

Last edited by marozsas; 03-20-2008 at 12:18 PM.
 
  


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
trouble creating alias coldbeerz Linux - Newbie 4 11-19-2007 10:37 AM
Creating Command Alias? carlosinfl Linux - General 3 07-14-2007 05:32 PM
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

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

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