LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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 03-18-2010, 03:02 AM   #1
inaki
Member
 
Registered: Mar 2005
Posts: 94

Rep: Reputation: 15
command not found


Dear all,
It is weird when i su - <username> it shows

[root@virtual ~]# su - <username>
-bash: [<username>: command not found
[root@virtual ~]#

I need the explanation to furnish my knowledge

TQ
 
Old 03-18-2010, 03:08 AM   #2
TheIndependentAquarius
Senior Member
 
Registered: Dec 2008
Posts: 4,674
Blog Entries: 29

Rep: Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917
Quote:
I need the explanation to furnish my knowledge
We need to know your distribution name to furnish your knowledge !

EDIT
Quote:
[root@virtual ~]# su - <username>
As I can see you typed this from root !
What command did you use to log in root ?

Last edited by TheIndependentAquarius; 03-18-2010 at 03:18 AM.
 
Old 03-18-2010, 03:14 AM   #3
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
I think the explanation is that you are supposed to replace <username> with an actual username, such as root. However, in the example you give, I see the # sign at your prompt, and the name 'root@host' in your prompt, which means (usually) that you are already the root user, and should probably put some other username there instead.

As Anish implied, when asking questions, the more information you provide, the better! At the very very least, it helps to know what Linux you are running, in case the suggestions to help you might vary from one OS to another.

Sasha

Last edited by GrapefruiTgirl; 03-18-2010 at 03:15 AM.
 
Old 03-18-2010, 03:18 AM   #4
inaki
Member
 
Registered: Mar 2005
Posts: 94

Original Poster
Rep: Reputation: 15
[root@icbavirtual ~]# su - oradb
-bash: [oradb: command not found
[oradb@icbavirtual ~]$
 
Old 03-18-2010, 03:20 AM   #5
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,330

Rep: Reputation: 227Reputation: 227Reputation: 227
Try just su oradb
 
Old 03-18-2010, 03:22 AM   #6
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,330

Rep: Reputation: 227Reputation: 227Reputation: 227
or sudo -u oradb bash
 
Old 03-18-2010, 03:25 AM   #7
Sayan Acharjee
Member
 
Registered: Feb 2010
Location: Chennai, India
Distribution: Manjaro
Posts: 616

Rep: Reputation: 64
Quote:
Originally Posted by inaki View Post
[root@icbavirtual ~]# su - oradb
-bash: [oradb: command not found
[oradb@icbavirtual ~]$
I can see from your post that you are already logged in as the user oradb. And bash is trying to execute the username as a command here, thats weird.
 
Old 03-18-2010, 03:39 AM   #8
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
What is the output of
Code:
alias su
echo "'$PS1'"
echo "'$PROMPT_COMMAND'"
 
Old 03-18-2010, 04:16 AM   #9
inaki
Member
 
Registered: Mar 2005
Posts: 94

Original Poster
Rep: Reputation: 15
this is the output

[root@icbavirtual users]# alias su
-bash: alias: su: not found
[root@icbavirtual users]# echo "'$PS1'"
'[\u@\h \W]\$ '
[root@icbavirtual users]# echo "'$PROMPT_COMMAND'"
'echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}\007"'
[root@icbavirtual users]#
 
Old 03-18-2010, 04:51 AM   #10
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
Quote:
Originally Posted by inaki View Post
this is the output

[root@icbavirtual users]# alias su
-bash: alias: su: not found
[root@icbavirtual users]# echo "'$PS1'"
'[\u@\h \W]\$ '
[root@icbavirtual users]# echo "'$PROMPT_COMMAND'"
'echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}\007"'
[root@icbavirtual users]#
Thanks for the information. I don't see any problem there.

Unfortunately I forgot that su could be a function as well an alias What is the output of
Code:
type su
 
Old 03-18-2010, 05:10 AM   #11
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
Please note that PS1 and PROMPT_COMMAND should be checked for user oradb (not root), since the "switch user" command succeeded and maybe there is something weird after that.
 
Old 03-18-2010, 08:05 AM   #12
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
Quote:
Originally Posted by colucix View Post
Please note that PS1 and PROMPT_COMMAND should be checked for user oradb (not root), since the "switch user" command succeeded and maybe there is something weird after that.
Thanks for spotting that colucix

On re-reading the thread, the symptoms are uncertain. From the first post
Code:
[root@virtual ~]# su - <username>
-bash: [<username>: command not found
[root@virtual ~]#
but later
Code:
[root@icbavirtual ~]# su - oradb
-bash: [oradb: command not found
[oradb@icbavirtual ~]$
Guessing the first was entered manually and the last line is wrong, then the "su -" command does succeed in switching user and the error message most likely comes from oradb's shell initialisation files.

Assuming the login shell is bash, this can be tested, as oradb, by running
Code:
bash --login
bash --login --noprofile
If the first generates the error message but the second doesn't then the problem is in one of ~/.bash_profile, ~/.bash_login or ~/.profile.
 
  


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
Command not found??? elsheepo Linux - Software 5 03-17-2008 08:46 PM
Shell: command not found / Runs fine with "Run command" badbunny Linux - Newbie 1 01-22-2007 02:21 AM
bc command not found numero7 Linux - Newbie 3 01-09-2007 08:08 AM
bash: rpm: command not found && sudo: alien: command not found Java_Code Ubuntu 7 07-28-2006 12:57 AM
bash: <command name> command not found smash Programming 5 03-13-2006 09:48 AM


All times are GMT -5. The time now is 04:45 PM.

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