LinuxQuestions.org
Register a domain and help support LQ
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 04-26-2012, 11:26 AM   #1
BigBack666
LQ Newbie
 
Registered: Mar 2012
Posts: 7

Rep: Reputation: Disabled
What is the prupose for this command? echo $PS1


My school work has me entering this command

echo $PS1

The output of this command is [\u @\h \W]\$

I'm just wondering what this all means haha.

Any help is much appreciated.

Last edited by BigBack666; 04-26-2012 at 11:29 AM. Reason: Clearer title
 
Old 04-26-2012, 11:30 AM   #2
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 5,990

Rep: Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611
Why don't you google it and learn something rather than just asking for the answer?
 
Old 04-26-2012, 11:40 AM   #3
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
Presumably the purpose of running that command is to show you what the prompt string is so you get curious to know how it works to provide the command prompt you see.
 
1 members found this post helpful.
Old 04-26-2012, 11:48 AM   #4
BigBack666
LQ Newbie
 
Registered: Mar 2012
Posts: 7

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by 273 View Post
Why don't you google it and learn something rather than just asking for the answer?
Thanks for the help man. This is not a question for school work or anything I'm just curious because I did not understand it when my professor was going over it. Did you really think I didn't google it before I posted here? Come on man think.
 
Old 04-26-2012, 11:57 AM   #5
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,258

Rep: Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947
Quote:
Originally Posted by BigBack666 View Post
My school work has me entering this command

echo $PS1

The output of this command is [\u @\h \W]\$

I'm just wondering what this all means haha.

Any help is much appreciated.
It's the format string for your prompt
\u = user
\h = hostname
\W = working directory

If your user is BigBack, your host is "mycomputer", and your working directory is /etc, that format string would give you a command prompt that looks like:

Code:
[BigBack @mycomputer /etc]$
 
1 members found this post helpful.
Old 04-26-2012, 12:17 PM   #6
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 5,990

Rep: Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611
Quote:
Originally Posted by BigBack666 View Post
Thanks for the help man. This is not a question for school work or anything I'm just curious because I did not understand it when my professor was going over it. Did you really think I didn't google it before I posted here? Come on man think.
I googled it before I posted and saw the answer in a few places, otherwise I wouldn't have suggested it. If it is mentioned in your school work it is mentioned to help you learn -- just asking somebody else and having your question answered is not helping you learn.
 
Old 04-26-2012, 01:58 PM   #7
BigBack666
LQ Newbie
 
Registered: Mar 2012
Posts: 7

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by suicidaleggroll View Post
It's the format string for your prompt
\u = user
\h = hostname
\W = working directory

If your user is BigBack, your host is "mycomputer", and your working directory is /etc, that format string would give you a command prompt that looks like:

Code:
[BigBack @mycomputer /etc]$
This helped a bunch thanks!
 
  


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
Executing shell command from JSP file with command line arg from URL orcusomega Programming 2 01-13-2012 04:38 PM
Bash Command Line Editor, while typing run another command before executing current? gumaheru Linux - General 5 04-13-2010 12:21 PM
how to copy drive using dd and tee command parallely? source code of dd command mdfakkeer Linux - Software 1 02-10-2010 02:31 PM
URGENT! Is there any command to get a history command lines and time in SUSE Linux.? igsoper Linux - Software 5 06-25-2009 03:14 AM
LXer: The Linux Command Shell For Beginners: Fear Not The Command Line! LXer Syndicated Linux News 0 12-22-2008 07:30 PM


All times are GMT -5. The time now is 12:48 AM.

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