Help answer threads with 0 replies.
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 09-08-2004, 10:58 AM   #1
LQ Newbie
Registered: Aug 2004
Posts: 6

Rep: Reputation: 0
Question alias for directories

How can I alias I folder,

alias test='ls -a -l' -> works
alias test='/home/Tantalos' -> this doesn't work

Is there a way to make aliases for folders?

Old 09-08-2004, 11:20 AM   #2
Registered: Aug 2004
Location: Switzerland
Distribution: debian
Posts: 149

Rep: Reputation: 15
Alias is used to create an alias for a command, not for files or directories.
If you want something equal for files and directories, you should use symbolic links. You can achieve that with the command ln. E.g.
--> ln -s path/to/yourfile linkname
will create in the current directory a symbolic link named "linkname" to the specified file.

Last edited by Charalambos; 09-08-2004 at 11:21 AM.
Old 09-08-2004, 12:51 PM   #3
LQ Addict
Registered: Dec 2003
Location: Maine, USA
Distribution: Slackware/SuSE/DSL
Posts: 1,320

Rep: Reputation: 45
If you're interested in typing fewer characters, you could create an environment variable for a directory.
For example, on most distros, the variable $HOME is used to represent /home/username/.
If you have a directory you frequently work with, such as /usr/X11R6/lib/X11/fonts/ for example, you could do
export fontdir=/usr/X11R6/lib/X11/fonts

Then when you want to use this directory, do
command $fontdir
Old 09-14-2004, 01:34 PM   #4
Registered: Sep 2004
Location: Philippines
Distribution: Slackware
Posts: 143

Rep: Reputation: 16
try alias test='cd /home/Tantalos'
but why use alias why dont use links
instead or if you want to go to your
home folder try "cd" it would be
easier! 3

Last edited by kenji; 09-14-2004 at 01:49 PM.


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
Alias question (2 commands for one alias) gflores Linux - Newbie 3 01-21-2006 01:40 AM
CHMOD directories.sub-directories.files zerojosh Linux - Software 2 11-19-2005 04:22 PM
Searching multiple directories and sub directories for a file jeep99899 Linux - Newbie 2 10-13-2005 01:23 PM
alias help jfauteux Linux - Software 3 04-08-2005 01:56 PM
IP Alias slacknut Slackware 9 03-31-2003 10:21 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:47 AM.

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
Open Source Consulting | Domain Registration