The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to change Firefox keyboard shortcuts schallstrom UNIX for Dummies Questions & Answers 7 08-22-2008 01:45 AM
Add keyboard shortcuts with KeyTouch iBot UNIX and Linux RSS News 0 05-29-2008 11:20 AM
Linking Files in UNIX (shortcuts) jays337 UNIX for Dummies Questions & Answers 3 11-15-2006 03:05 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 08-02-2006
Registered User
 

Join Date: Aug 2006
Location: AR
Posts: 15
shortcuts

Hi,

I'm new to this forum, but i'm getting to work on some unix and i like it a lot. I'm trying to figure out a way i can create a shortcut command for a long pathname for example, if i needed to access a file in a particular directory i would type "cd /sampledata/IFS/IFS_DEV/HDC/files/glitter". but instead i just want to type "glitter" at the command line and be able to access the glitter directory. Can someone give me a sample script that would help me accomplish this.

Thanks for your help
Reply With Quote
Forum Sponsor
  #2  
Old 08-02-2006
System Shock's Avatar
Registered User
 

Join Date: May 2006
Location: Tau Ceti V
Posts: 395
man the alias command.
Reply With Quote
  #3  
Old 08-02-2006
Registered User
 

Join Date: Aug 2006
Location: AR
Posts: 15
shortcuts

yes, but i think that just gives it an assigns it a name. It does not actually execute the command from one directory and take me to that location as specified by the actual path name
Reply With Quote
  #4  
Old 08-03-2006
Registered User
 

Join Date: Aug 2006
Posts: 3
Solution to shortcuts

Well, u can use alias to give that long path any aliasname.
Then after that use "cd aliasname" at ur shell.
This will work.
Just try it!!

For making alias name effective for all ur future sessions....
Edit .profile file and enter that alias command there.....
Reply With Quote
  #5  
Old 08-03-2006
Registered User
 

Join Date: Aug 2006
Posts: 14
1) find in your root directory the following file
.cshrc or .cshrc.user(hidden files)
2) in this file add the following line.
alias glitter 'cd /sampledata/IFS/IFS_DEV/HDC/files/glitter')
Reply With Quote
  #6  
Old 08-03-2006
Registered User
 

Join Date: Aug 2006
Location: AR
Posts: 15
shortcuts

[sd12@phenix sd12]$ cat .bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH
unset USERNAME

alias disk 'cd /sam/dir1/disk'

This is the alias script i used. but i get an error message when i type disk at the command line. it is not taking me to that the file disk.

[sd12@phenix sd12]$ disk
bash: disk: command not found

Also i get this error message when i log in

bash: alias: disk: not found
bash: alias: cd /sam/dir1/disk: not found

Can someone please enlighten. Thank you
Reply With Quote
  #7  
Old 08-03-2006
vgersh99's Avatar
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 3,029
if you're modifying '.profile':
Code:
alias disk='cd /sam/dir1/disk'
alias definitions for different shells are different - you had syntax for csh-types shells and you're runnig bash-like shell.

and don't forget to 'source' your '.profile' file after modifying it:
Code:
. ~/.profile
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 03:44 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0