[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 270
  • Last Modified:

TAB doesn't show available commands

When I log into this HP UNIX machine with the root account, everything works fine, but then i switch user to my own user account it doesn't work.

When I am root, the promt looks like this
[root@testserver] /systems >

When i use my own account, the promt looks like this

Anyone know how to fix this? so i can TAB my way through commands on my own account??
2 Solutions
your defaul login shell is sh, if you want to change your default login shell, modify /etc/passwd file, or run "sam" to change the login shell.

How the promt looks like, it depends on the setting of PS1 in your login script.
From the shell prompt it looks like the root has the default shell as 'bash'. If you want to make bash your default shell, use the method that yuzh suggests.

If you want to make changes to the /etc/passwd file, you should know the path of the bash shell command. You can do a 'which bash' or 'whereis bash' to get the path of bash. It will mostly be /usr/bin/bash or /usr/local/bin/bash.

To change the prompt, refer http://networking.ringofsaturn.com/Unix/Bash-prompts.php
For e.g. The "[root@testserver] /systems >" prompt can be created by doing the following
PS1="[\u@\h] \w>"
only bash completes commands and filenames

use chsh to chenge your shell
/etc/shells hints you with valid shells.

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Hi dreamer81,

I am going to give an answer to your questions and some explanation to you:

1. To use TAB, you are going to need the shell called "bash", it usually comes with Linux and not with HP-UX, so if you don't have it in your HP-UX, you can download it from http://hpux.connect.org.uk/hppd/hpux/Shells/bash-3.00.16/.
If you don't have how to "install" bash, there is a command you can use, it is similar to TAB, but it will be used for files in the current directory and commands you have already executed.
In the shell, type "set -o vi" and your shell will be similar to bash: you can start to write a filename that is in the current directory, press: "ESC + ESC", and it will finish to write the filename, also you can use it to check the commands you have already executed: press -> "Ctrl + k" -> Backward - "Ctrl + j" -> Forward. Be careful, k and j are lowercase.

2. About the prompt you want to change, you have to change and export the environment variable called: PS1
Try: echo ${PS1}

You can do a lot of things with this variable, I am going to show you some of them:
export PS1="[`/usr/bin/whoami`@`/usr/bin/uname -n`]:\$PWD# "

In the above, you will have something similar to:
[<Current User>@<Hostname>]:<Current Path>#

The good thing above is the <Current Path>, because it will always show the current directory with path to it.
[utest@Test]:/opt/java1.4# pwd
[utest@Test]:/opt/java1.4# cd ..
[utest@Test]:/opt# pwd

You can put the export in your profile:
cd $HOME
vi .profile

Just for further information, if you check in all unix environments, you will always have 4 PS variables: PS1, PS2, PS3, PS4
[utest@Test]:/opt# set | grep PS
If you want to know what they are used for, check the link: http://www.livefirelabs.com/unix_tip_trick_shell_script/apr_2003/04282003.htm

I hope it helps. =0)
Ops... I made a mistake above: when I say "press -> "Ctrl + k" -> Backward - "Ctrl + j" -> Forward", change the "Ctrl" to "ESC".

How I could do that? hahah

root_start, did you miss to tell us that your "set -o vi" is for ksh?

>  only bash completes commands and filenames
tcsh can do it also
csh completes directories and filenames too, but not commands
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.
I will leave the following recommendation for this question in the Cleanup topic area:

split between yuzh http:#16368394 and root_start http:#16651153

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

EE Cleanup Volunteer

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now