LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 12-12-2011, 11:06 PM   #1
BMan8577
Member
 
Registered: Apr 2011
Posts: 73

Rep: Reputation: 0
Talking I would like to create an alias that tells me the current directory I am in...


I know how to use the ~/.bashrc file and how to use the alias command within the .bashrc file. I would like to alias whereami that would show me the current directory listing of a absolute path reference if I change directories. I hope this is an accurate question or you get the gist of what I am looking to do. Thanks.

Last edited by BMan8577; 12-12-2011 at 11:08 PM.
 
Old 12-12-2011, 11:19 PM   #2
Telengard
Member
 
Registered: Apr 2007
Location: USA
Distribution: Kubuntu 8.04
Posts: 579
Blog Entries: 8

Rep: Reputation: 148Reputation: 148
Code:
help alias
But what is wrong with pwd?
 
Old 12-12-2011, 11:30 PM   #3
hemanthv414
Member
 
Registered: Oct 2008
Posts: 37

Rep: Reputation: 15
alias

Quote:
Originally Posted by BMan8577 View Post
I know how to use the ~/.bashrc file and how to use the alias command within the .bashrc file. I would like to alias whereami that would show me the current directory listing of a absolute path reference if I change directories. I hope this is an accurate question or you get the gist of what I am looking to do. Thanks.
use \w to give you the current working directory
eg: PS1="Testmachine:\w"
 
Old 12-12-2011, 11:38 PM   #4
BMan8577
Member
 
Registered: Apr 2011
Posts: 73

Original Poster
Rep: Reputation: 0
Thanks, the pwd does work, but I wanted to play around with aliases lol. And thanks, that solved my question as well. alias whereami='pwd'. Ha ha success. Thanks. I should have thought of that...lol.
 
Old 12-12-2011, 11:39 PM   #5
wile_coyote
Member
 
Registered: Aug 2010
Location: Somewhere in NM USA
Distribution: Gentoo, Vector, Slackware , Arch
Posts: 47

Rep: Reputation: 3
Quote:
Originally Posted by Telengard View Post
Code:
help alias
But what is wrong with pwd?
Agreed, pwd won't give you what you need?
 
Old 12-13-2011, 12:28 AM   #6
Telengard
Member
 
Registered: Apr 2007
Location: USA
Distribution: Kubuntu 8.04
Posts: 579
Blog Entries: 8

Rep: Reputation: 148Reputation: 148
Quote:
Originally Posted by BMan8577 View Post
alias whereami='pwd'. Ha ha success.
Three times more typing for the same effect? That's kind of silly

If you're just messing around you should try hemanthv414's suggestion. Playing with PS1 is fun.

Customizing the Terminal: The Prompt Lindesk
 
  


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
move all files in current directory into a subdirectory in the current directory jakykong Linux - Newbie 8 07-17-2013 12:46 AM
How to Copy files from local directory to a particular directory using alias dynamics Linux - Newbie 7 09-11-2009 05:19 PM
how to create a new partition for current /home directory? parv Linux - Hardware 3 02-27-2007 10:21 AM
A command that tells the name of the current HDD Sh1r0 Linux - General 5 03-05-2006 02:38 PM
create alias ohade Mandriva 1 08-09-2005 05:12 PM

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

All times are GMT -5. The time now is 08:55 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