04-22-2002
Changing the UNIX command prompt
I am having a hard time figuring out how to change the command prompt in my UNIX shell.
I am using the bash shell, and I would like to set the prompt to show me the full path of the current working directory along with my username, I suppose... The main thing I want is the full path of the current working directory.
This is for a web hosting shell account... I have three files in my root directory: local.cshrc, local.profile, and local.login. I know I need to put something in one of these files, but I'm not sure. Any help would be appreciated...
Keli'i Martin
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Me again,
What is the difficulty to display the full directory Path before my prompt command ? (like DOS)
I'm using Solaris 8 + Bash
Thanks again
Fabien (4 Replies)
Discussion started by: unclefab
4 Replies
2. UNIX for Dummies Questions & Answers
Phew simple question,
I want to display the my directory path in prompt.
Did the following in .profile
PS1=`pwd`
export PS!
Worked, but it always points to HOME directory.
When i do a cd, it doesn't change.
What am i missing.
Thanks (7 Replies)
Discussion started by: vibhor_agarwali
7 Replies
3. UNIX for Dummies Questions & Answers
I know no one has ever asked this before {not :D } but I am trying to set the prompt in the .profile under sh. I have tried everything I have seen on the web in regards to this, with no success. The OS is SCO Unixware 7.1.1, {not by my choice}. All the examples I see seem to be for ksh, which is... (1 Reply)
Discussion started by: jcc5169
1 Replies
4. Shell Programming and Scripting
Hi,
I want to change my command prompt to contain the current username and the current directory in it, instead of just the '$' symbol.
I tried the command:-
export PS1="$(echo \\n$) "
But whenever I switch the user or change the directory, the changes are not reflected in the command... (10 Replies)
Discussion started by: unipepper
10 Replies
5. UNIX for Dummies Questions & Answers
Hi,
When i try to connect to the db2 database from unix solaris 5.8 version by typing "db2" from the .../sqllib/bin/ folder, i am not getting the db2 command prompt. Could anyone help me resolve this? Here the db2 is executable only. But still iam not getting the db2 prompt.
The error i get is... (4 Replies)
Discussion started by: ragavhere
4 Replies
6. Solaris
I currently have this as my prompt when I log in (shell is sh):
PS1="`hostname ` # "
My question is how do I add the current directory to that prompt? Is there a way?
Thanks. (5 Replies)
Discussion started by: kjbaumann
5 Replies
7. UNIX for Advanced & Expert Users
Hi,
While typing the Unix command, entire command is not visible.When the input command is long, it is not visible. I want the entire command to be displayed when i type it. Please help to resolve this issue.
Thanks
Sampath (7 Replies)
Discussion started by: sampath.giri
7 Replies
8. Shell Programming and Scripting
Hello,
I work on Windows and I use Putty to access a remote UNIX server.
I am trying to build a shell script that will have as main task to open the
Windows command prompt (cmd) and run some Windows commands thereafter. The commands are actually file transfer commands that will download a file... (14 Replies)
Discussion started by: rookie2785
14 Replies
9. UNIX Desktop Questions & Answers
Hi all,
I wish to know whether Unix can access window's file in Unix's terminal?
Apart from that, how to copy files or share files between Window and Unix? I get to know of secure copy, however, my company's Unix does not support the feature of secure copy? Any other method for me to share/... (5 Replies)
Discussion started by: jessy83
5 Replies
10. UNIX for Dummies Questions & Answers
Hi,
I am using git bash terminal window to do git operations. I have set the prompt string variable PS1 in the ~/.bashrc file as follows:
export PS1=" "
This is intended to show me the current git branch's name which is active as part of the prompt string. But, the problem is when I do a git... (2 Replies)
Discussion started by: royalibrahim
2 Replies
SU(1) BSD General Commands Manual SU(1)
NAME
su -- substitute user identity
SYNOPSIS
su [-] [-flm] [login [args]]
DESCRIPTION
The su utility requests appropriate user credentials via PAM and switches to that user ID (the default user is the superuser). A shell is
then executed.
PAM is used to set the policy su(1) will use. In particular, by default only users in the ``admin'' or ``wheel'' groups can switch to UID 0
(``root''). This group requirement may be changed by modifying the ``pam_group'' section of /etc/pam.d/su. See pam_group(8) for details on
how to modify this setting.
By default, the environment is unmodified with the exception of USER, HOME, and SHELL. HOME and SHELL are set to the target login's default
values. USER is set to the target login, unless the target login has a user ID of 0, in which case it is unmodified. The invoked shell is
the one belonging to the target login. This is the traditional behavior of su.
The options are as follows:
-f If the invoked shell is csh(1), this option prevents it from reading the ``.cshrc'' file.
-l Simulate a full login. The environment is discarded except for HOME, SHELL, PATH, TERM, and USER. HOME and SHELL are modified as
above. USER is set to the target login. PATH is set to ``/bin:/usr/bin''. TERM is imported from your current environment. The
invoked shell is the target login's, and su will change directory to the target login's home directory.
- (no letter) The same as -l.
-m Leave the environment unmodified. The invoked shell is your login shell, and no directory changes are made. As a security precau-
tion, if the target user's shell is a non-standard shell (as defined by getusershell(3)) and the caller's real uid is non-zero, su
will fail.
The -l (or -) and -m options are mutually exclusive; the last one specified overrides any previous ones.
If the optional args are provided on the command line, they are passed to the login shell of the target login. Note that all command line
arguments before the target login name are processed by su itself, everything after the target login name gets passed to the login shell.
By default (unless the prompt is reset by a startup file) the super-user prompt is set to ``#'' to remind one of its awesome power.
ENVIRONMENT
Environment variables used by su:
HOME Default home directory of real user ID unless modified as specified above.
PATH Default search path of real user ID unless modified as specified above.
TERM Provides terminal type which may be retained for the substituted user ID.
USER The user ID is always the effective ID (the target user ID) after an su unless the user ID is 0 (root).
FILES
/etc/pam.d/su PAM configuration for su.
EXAMPLES
su man -c catman
Runs the command catman as user man. You will be asked for man's password unless your real UID is 0.
su man -c 'catman /usr/share/man /usr/local/man'
Same as above, but the target command consists of more than a single word and hence is quoted for use with the -c option being passed
to the shell. (Most shells expect the argument to -c to be a single word).
su -l foo
Simulate a login for user foo.
su - foo
Same as above.
su - Simulate a login for root.
SEE ALSO
csh(1), sh(1), group(5), passwd(5), environ(7), pam_group(8)
HISTORY
A su command appeared in Version 1 AT&T UNIX.
BSD
September 13, 2006 BSD