LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
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 05-16-2009, 05:24 AM   #1
netimen
Member
 
Registered: May 2009
Posts: 43

Rep: Reputation: 15
catalogs names shortcuts


How can I set catalogs names shorcuts for not typing
Code:
cd ~/Documents/work/Evg/biblatex
but
Code:
cd working_dir_shortcut_name
 
Old 05-16-2009, 05:35 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390
Hi,

There are more ways, here are 2:

1) Create and export a variable.

Put something like this in your .bashrc or .profile: export EVG="/home/<USERNAME>/Documents/work/Evg/biblatex".
After your next login you can do something like this: cd $EVG

2) Create an alias.

Put something like this in your .bashrc or .profile: alias cdevg="cd ~/Documents/work/Evg/biblatex".
After your next login you can do this: cdevg

Hope this helps.
 
Old 05-16-2009, 05:42 AM   #3
netimen
Member
 
Registered: May 2009
Posts: 43

Original Poster
Rep: Reputation: 15
Yeah, thanks! thats exactly what I did want )
 
Old 05-16-2009, 06:28 AM   #4
ArfaSmif
Member
 
Registered: Oct 2008
Location: Brisbane Australia
Distribution: Fedora, Centos
Posts: 270

Rep: Reputation: 54
There are other ways to do this (IMHO more elegant) by using the CDPATH variable in your shell. For example, you can use something like the following in your .bashrc file :-

export CDPATH=.:~:~/documents:~/ftps:~/bin:~/videos:~/pictures:~/bin:~/muzak:$PATH

which will allow you to change to the any of the mentioned directories simply by typing in, for example :-

$ cd muzak

from anywhere and you will change to the /home/username/muzak directory. It is similar to the PATH variable. Do a "man bash" (if you are using bash as your shell) to get all the info.

In your case you would need something like:-

export CDPATH=.~:~/Documents:~/Documents/work:~/Documents/work/Evg:~/Documents/work/Evg/biblatex
 
Old 05-16-2009, 07:39 AM   #5
netimen
Member
 
Registered: May 2009
Posts: 43

Original Poster
Rep: Reputation: 15
Thank you, ArfaSmif but this adds to many folders to the gloabal namespaces. For Example I have 14 folders in my Documents folder and want to have a shortcut only to one of them — if I use your method I'll get all the other 13 folders in the quick access
 
Old 05-16-2009, 07:42 AM   #6
netimen
Member
 
Registered: May 2009
Posts: 43

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by druuna View Post
Hi,
1) Create and export a variable.

Put something like this in your .bashrc or .profile: export EVG="/home/<USERNAME>/Documents/work/Evg/biblatex".
After your next login you can do something like this: cd $EVG
But can I make autocompletion work like with ~:

When I type
Code:
cd ~/Do
and press Tab it expands to
Code:
cd /home/netimen/Documents/
Can I have something like this: when I type
Code:
cd $workdir/n
and press Tab it expands to
Code:
cd ~/Documents/work/Evg/biblatex/new
 
Old 05-16-2009, 07:49 AM   #7
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390
Hi,

When using my first example (export EVG="/home/<USERNAME>/Documents/work/Evg/biblatex") that should work (it does on my side):

Code:
$ export TST="/home/druuna/_Schuur"
$ echo $TST
/home/druuna/_Schuur

$ cd $TST/P  (press TAB and it becomes like the next line shown)
$ cd /home/druuna/_Schuur/Perl/

$ pwd
/home/druuna/_Schuur/Perl
The ~ is expanded by bash.
 
Old 05-16-2009, 08:02 AM   #8
netimen
Member
 
Registered: May 2009
Posts: 43

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by druuna View Post
Hi,
When using my first example (export EVG="/home/<USERNAME>/Documents/work/Evg/biblatex") that should work (it does on my side):
Yeah, I did exactly what you said, but it doesn't expand, though I can use
Code:
cd $EVG
and go to the biblatex folder.

The behavior of TAB is following. When I type
Code:
cd $E
and press TAB, it changes to
Code:
cd \$E
and when I type
Code:
cd $EVG/n
TAB does nothing
 
Old 05-16-2009, 09:03 AM   #9
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390
Hi again,

I think I misunderstood your question.

The variable (EVG in this case) should expand as well. If more 'things' are defined that start with a E, it will not expand (2xtab will show all that start wit E):

Code:
 $ echo $DLS
/data/Downloads

[exile] druuna ~ $ cd $D  (one tab, nothing happes)

[exile] druuna ~ $ cd $D  (2xtab, all possibilities are shown)
$DIRSTACK  $DISPLAY   $DLS

[exile] druuna ~ $ cd $DL (typed first to chars then tab, line becomes:)
[exile] druuna ~ $ cd $DLS 
[exile] druuna /data/Downloads $
I'm not sure why the $E becomes \$E when you press tab. It could be a bash environment setting, but I wouldn't know which one.

BTW: It is good practise to always type the first 2 chars before pressing tab
 
Old 05-16-2009, 07:54 PM   #10
ArfaSmif
Member
 
Registered: Oct 2008
Location: Brisbane Australia
Distribution: Fedora, Centos
Posts: 270

Rep: Reputation: 54
Quote:
Originally Posted by netimen View Post
Thank you, ArfaSmif but this adds to many folders to the gloabal namespaces. For Example I have 14 folders in my Documents folder and want to have a shortcut only to one of them — if I use your method I'll get all the other 13 folders in the quick access
absolutely true ...
 
Old 05-17-2009, 06:51 AM   #11
netimen
Member
 
Registered: May 2009
Posts: 43

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by druuna View Post
I think I misunderstood your question.
Yeah, when I type
Code:
cd $EV
and press TAB I get
Code:
cd \$EVG
but if I type
Code:
cd $EVG/
and press TAB even many times I get nothing
 
  


Reply


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
I want to get subscribed to lots of tech magazines and catalogs for free! RichardBronosky General 1 03-20-2007 05:04 PM
Automatically post your messages to forums, guestbooks, bulletin boards and catalogs of the links (as well as into livejournals and wiki) tyreman Linux - General 1 02-13-2007 09:44 AM
Catalogs DO NOT Initialize in SuSE 10.2 Installation gurmeet.bedi SUSE / openSUSE 5 01-08-2007 04:47 AM
Software updater Services/Catalogs inactive on login SUSE 10.1 EFiNi7 SUSE / openSUSE 5 08-02-2006 01:56 AM

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

All times are GMT -5. The time now is 08:38 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration