Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
TetraWiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Linux 101 hacks
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=='''Hack 41. Create your own prompt using the available codes for PS1 variable'''== Use the following codes and create your own personal PS1 Linux prompt that is functional and suites your taste. o \a an ASCII bell character (07) # \d the date in “Weekday Month Date” format (e.g., “Tue May 26″) # \D{format} - the format is passed to strftime(3) and the result is inserted into the prompt string; an empty format results in a locale-specific time representation. The braces are required o \e an ASCII escape character (033)59 {| style="border-spacing:0;" | colspan="2" style="border:none;padding-top:0in;padding-bottom:0in;padding-left:0.075in;padding-right:0.075in;"| '''Linux 101 Hacks''' | style="border:none;padding-top:0in;padding-bottom:0in;padding-left:0.075in;padding-right:0.075in;"| www.thegeekstuff.com |- | colspan="2" style="border:none;padding-top:0in;padding-bottom:0in;padding-left:0.075in;padding-right:0.075in;"| o \h the hostname up to the first part | style="border:none;padding-top:0in;padding-bottom:0in;padding-left:0.075in;padding-right:0.075in;"| |- | style="border:none;padding-top:0in;padding-bottom:0in;padding-left:0.075in;padding-right:0.075in;"| o | style="border:none;padding-top:0in;padding-bottom:0in;padding-left:0.075in;padding-right:0.075in;"| \H the hostname | style="border:none;padding-top:0in;padding-bottom:0in;padding-left:0.075in;padding-right:0.075in;"| |- | colspan="3" style="border:none;padding-top:0in;padding-bottom:0in;padding-left:0.075in;padding-right:0.075in;"| o \j the number of jobs currently managed by the shell |- | colspan="3" style="border:none;padding-top:0in;padding-bottom:0in;padding-left:0.075in;padding-right:0.075in;"| o \l the basename of the shell’s terminal device name |- | style="border:none;padding-top:0in;padding-bottom:0in;padding-left:0.075in;padding-right:0.075in;"| o | style="border:none;padding-top:0in;padding-bottom:0in;padding-left:0.075in;padding-right:0.075in;"| \n newline | style="border:none;padding-top:0in;padding-bottom:0in;padding-left:0.075in;padding-right:0.075in;"| |- | style="border:none;padding-top:0in;padding-bottom:0in;padding-left:0.075in;padding-right:0.075in;"| o | style="border:none;padding-top:0in;padding-bottom:0in;padding-left:0.075in;padding-right:0.075in;"| \r carriage return | style="border:none;padding-top:0in;padding-bottom:0in;padding-left:0.075in;padding-right:0.075in;"| |} # \s the name of the shell, the basename of $0 (the portion following the final slash) o \t the current time in 24-hour HH:MM:SS format o \T the current time in 12-hour HH:MM:SS format o \@ the current time in 12-hour am/pm format o \A the current time in 24-hour HH:MM format o \u the username of the current user o \v the version of bash (e.g., 2.00) o \V the release of bash, version + patch level (e.g., 2.00.0) # \w the current working directory, with $HOME abbreviated with a tilde # \W the basename of the current working directory, with $HOME abbreviated with a tilde o \! the history number of this command o \# the command number of this command o \$ if the effective UID is 0, a #, otherwise a $ o \nnn the character corresponding to the octal number nnn o \\ a backslash # <nowiki>\[ begin a sequence of non-printing characters, which could be used to embed a terminal control sequence into the prompt </nowiki> o \] end a sequence of non-printing character
Summary:
Please note that all contributions to TetraWiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
TetraWiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)