Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 02-19-2005, 10:36 PM   #1
LQ Newbie
Registered: Dec 2004
Posts: 25

Rep: Reputation: 15
Alias question (2 commands for one alias)

I want to have something like this.

alias cdl='cd [directory] ; ls'

when this is entered:
cdl documents
it should be interpreted as this:
cd documents ; ls

I can't seem to make it like that. Any suggestions?
Old 02-19-2005, 11:25 PM   #2
Senior Member
Registered: May 2003
Location: Sydney, Nova Scotia, Canada
Distribution: slackware
Posts: 4,185

Rep: Reputation: 60
you'll have to do it something like this :
function chl(){
        cd $1 ; ls ;

alias chg='chl'
then type :
source .bashrc
to make it take effect, and then you could type something like :

chg Mail
and it will change to the Mail folder in this example and list the directory
contents ...
Old 02-19-2005, 11:43 PM   #3
LQ Newbie
Registered: Dec 2004
Posts: 25

Original Poster
Rep: Reputation: 15
Cool, that worked. Thanks for the fast reply!
Old 01-21-2006, 01:40 AM   #4
LQ Newbie
Registered: Dec 2005
Distribution: Debian Sarge,Ubuntu,RHE 5, Gentoo,CentOS 5
Posts: 24

Rep: Reputation: 15
10x for sharing


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Another Newbie question....Alias tetpt Linux - Newbie 5 03-04-2005 11:58 AM
Alias commands in tcsh (Suse 9.0) m15a4 Linux - General 5 11-26-2003 04:46 PM
alias and export commands in modules.comf liguorir Linux - Software 1 06-26-2003 08:38 PM
Alias definition question Dark_Helmet Linux - General 5 02-04-2003 03:48 PM
alias question tied2 Linux - General 4 08-23-2002 11:50 PM > Forums > Linux Forums > Linux - Newbie

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

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