Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Changing the UNIX command prompt Post 20191 by auswipe on Monday 22nd of April 2002 11:34:47 PM
Old 04-23-2002
This what I use on my systems with the bash shell:

Code:
PS1='`uname`:`whoami`:$PWD $ ';export PS1

At the command prompt I see:

Code:
FreeBSD:joeuser:/home/joeuser $

I use the `uname` so that I am reminded which system that I am on. I have a FreeBSD and OpenBSD machine and jump back and forth a whole bunch.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Changing Unix Prompt

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

Changing the prompt

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

Changing Prompt in sh

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

Changing text in the command prompt

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

Unable to get the db2 command prompt in unix

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

Changing prompt

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

Entire Input command not visible in Unix prompt

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

Use Unix shell script to open Windows command prompt (cmd)

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

Can Unix access Windows' File through Command Prompt in Unix

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

[Solved] Help needed to have changing value to the command prompt string variable PS1

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
WHICH(1)						      General Commands Manual							  WHICH(1)

NAME
which - shows the full path of (shell) commands. SYNOPSIS
which [options] [--] programname [...] DESCRIPTION
Which takes one or more arguments. For each of its arguments it prints to stdout the full path of the executables that would have been exe- cuted when this argument had been entered at the shell prompt. It does this by searching for an executable or script in the directories listed in the environment variable PATH using the same algorithm as bash(1). This man page is generated from the file which.texinfo. OPTIONS
--all, -a Print all matching executables in PATH, not just the first. --read-alias, -i Read aliases from stdin, reporting matching ones on stdout. This is useful in combination with using an alias for which itself. For example alias which='alias | which -i'. --skip-alias Ignore option `--read-alias', if any. This is useful to explicity search for normal binaries, while using the `--read-alias' option in an alias or function for which. --read-functions Read shell function definitions from stdin, reporting matching ones on stdout. This is useful in combination with using a shell func- tion for which itself. For example: which() { declare -f | which --read-functions $@ } export -f which --skip-functions Ignore option `--read-functions', if any. This is useful to explicity search for normal binaries, while using the `--read-functions' option in an alias or function for which. --skip-dot Skip directories in PATH that start with a dot. --skip-tilde Skip directories in PATH that start with a tilde and executables which reside in the HOME directory. --show-dot If a directory in PATH starts with a dot and a matching executable was found for that path, then print "./programname" rather than the full path. --show-tilde Output a tilde when a directory matches the HOME directory. This option is ignored when which is invoked as root. --tty-only Stop processing options on the right if not on tty. --version,-v,-V Print version information on standard output then exit successfully. --help Print usage information on standard output then exit successfully. RETURN VALUE
Which returns the number of failed arguments, or -1 when no `programname' was given. EXAMPLE
The recommended way to use this utility is by adding an alias (C shell) or shell function (Bourne shell) for which like the following: [ba]sh: which () { (alias; declare -f) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot $@ } export -f which [t]csh: alias which 'alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde' This will print the readable ~/ and ./ when starting which from your prompt, while still printing the full path when used from a script: > which q2 ~/bin/q2 > echo `which q2` /home/carlo/bin/q2 BUGS
The HOME directory is determined by looking for the HOME environment variable, which aborts when this variable doesn't exist. Which will consider two equivalent directories to be different when one of them contains a path with a symbolic link. AUTHOR
Carlo Wood <carlo@gnu.org> SEE ALSO
bash(1) WHICH(1)
All times are GMT -4. The time now is 06:20 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy