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 05:45 AM
Add keyboard shortcuts with KeyTouch iBot UNIX and Linux RSS News 0 05-29-2008 03:20 PM
Linking Files in UNIX (shortcuts) jays337 UNIX for Dummies Questions & Answers 3 11-15-2006 06:05 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-02-2006
sd12 sd12 is offline
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
  #2 (permalink)  
Old 08-02-2006
System Shock's Avatar
System Shock System Shock is offline Forum Advisor  
Registered User
  
 

Join Date: May 2006
Location: Tau Ceti V
Posts: 521
man the alias command.
  #3 (permalink)  
Old 08-03-2006
sd12 sd12 is offline
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
  #4 (permalink)  
Old 08-03-2006
monu_munish monu_munish is offline
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.....
  #5 (permalink)  
Old 08-03-2006
Mar1006 Mar1006 is offline
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')
  #6 (permalink)  
Old 08-03-2006
sd12 sd12 is offline
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
  #7 (permalink)  
Old 08-03-2006
vgersh99's Avatar
vgersh99 vgersh99 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,131
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

Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:15 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0