LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   I would like to create an alias that tells me the current directory I am in... (https://www.linuxquestions.org/questions/linux-newbie-8/i-would-like-to-create-an-alias-that-tells-me-the-current-directory-i-am-in-918432/)

BMan8577 12-12-2011 11:06 PM

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.

Telengard 12-12-2011 11:19 PM

Code:

help alias
But what is wrong with pwd?

hemanthv414 12-12-2011 11:30 PM

alias
 
Quote:

Originally Posted by BMan8577 (Post 4548420)
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"

BMan8577 12-12-2011 11:38 PM

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.

wile_coyote 12-12-2011 11:39 PM

Quote:

Originally Posted by Telengard (Post 4548428)
Code:

help alias
But what is wrong with pwd?

Agreed, pwd won't give you what you need?

Telengard 12-13-2011 12:28 AM

Quote:

Originally Posted by BMan8577 (Post 4548437)
alias whereami='pwd'. Ha ha success.

Three times more typing for the same effect? That's kind of silly :p

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

Customizing the Terminal: The Prompt Lindesk


All times are GMT -5. The time now is 07:21 AM.