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
Want to hide password arpitk Shell Programming and Scripting 1 09-29-2006 05:42 AM
Hide a script ? new2ss Shell Programming and Scripting 5 06-01-2006 04:31 AM
Hide Passwords lesstjm Shell Programming and Scripting 3 04-04-2005 10:18 PM
how to hide Rameshmca Shell Programming and Scripting 3 11-30-2004 02:45 AM
hide hostname in dns lusifer UNIX for Advanced & Expert Users 4 10-15-2001 06:38 AM

Closed Thread
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 12-06-2003
a25khan's Avatar
Registered User
 

Join Date: Dec 2003
Location: My home :D
Posts: 35
Question Hide Directory name

Hello everyone,
i am new to unix and still learning about different commands. Can some one tell me how can i hide my directory name. For instance someone is logged in a directory named [home:/user/myname]$ .
I've seen some people hiding their above path name by just one word or letter like [anything]$ in order to keep their path hidden for security reasons. I also heard from some people that i have to do changes in my .profile file. Can some one help me out with this and tell me how do i do so!
Thank You

Last edited by a25khan; 12-06-2003 at 11:27 PM.
Forum Sponsor
  #2  
Old 12-07-2003
Moderator
 

Join Date: Sep 2002
Location: Hong Kong, China
Posts: 1,477
If you use (ba)sh, try

export PS1='[\u@\h]$'

But I don't think it's a security feature having to remove the current directory from the shell prompt. It's just inconveniencing yourself when you need to use relative paths and don't know whether your current directory is the one intended.
  #3  
Old 12-07-2003
a25khan's Avatar
Registered User
 

Join Date: Dec 2003
Location: My home :D
Posts: 35
Thumbs up

Hello cbkihong,
Yes I use bash and it worked . Thanks to you ofcourse!

Last edited by a25khan; 12-07-2003 at 07:13 AM.
  #4  
Old 12-08-2003
Kelam_Magnus's Avatar
Registered User
 

Join Date: Aug 2001
Location: DFW McKinney, TX,
Posts: 1,069
I dont know about you, but I really like to know what directory I am in... and whether I am root or not...

I use this as my root prompt. So I know for a fact when root is logged in and where I am. That is 2 lines on purpose for root... if you were wondering.


PS1="`hostname`-$LOGNAME:\${PWD#*}
# "


For my users, I use this prompt.

PS1="`hostname`:/\${PWD#*}> "
__________________
My brain is your brain
  #5  
Old 12-08-2003
a25khan's Avatar
Registered User
 

Join Date: Dec 2003
Location: My home :D
Posts: 35
Question

Hi there,
ok i used the command you posted i.e. PS1="`hostname`:/\${PWD#*}> "
But can you tell me how does this work? I mean what is PS1 (i guess it's a variable)?
Why do you have a hash sign after pwd and what about the curly braces? And you are redirecting it with ">".
Can you please elaborate on the above? Thank you
  #6  
Old 12-08-2003
Registered User
 

Join Date: Nov 2003
Location: HK
Posts: 53
you can type command 'set' to view all command prompts.

PS1 to PS4

PS1 is default shell prompt

PS2 is secondary prompt string. If you type command like ls -l "file* and then press enter. Then you will see this prompt.

PS3 is a selection prompt string and it is used for select loop usually. The prompt lets user know that who need to enter something to reply to the script.

PS4 is used for execution trace. If you have a script and the content is
ls -l
Then you run it as
ksh -x scriptname

Then you will see a symbol before each process for execution trace. Which is useful for troubleshoot any script errors.

About the prompt question,
PS1="`hostname`:/\${PWD#*}> "

`hostname`
I think that you should know the this part.

${PWD#*}
To get the same prompt, then I will type
export PS1=`hostname`':/$PWD >'

">" it doesn't mean redirect because it has been quoted by double quotes
__________________
tikual :)
  #7  
Old 12-09-2003
Kelam_Magnus's Avatar
Registered User
 

Join Date: Aug 2001
Location: DFW McKinney, TX,
Posts: 1,069
My prompt appears as follows for root:


THIS :

PS1="`hostname`-$LOGNAME:\${PWD#*}
# "

GIVES THIS:

hostname-root:/root
#
__________________
My brain is your brain
Google The UNIX and Linux Forums
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




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