LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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, 02: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, 02:08 AM   #2
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
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 Aquarius_Girl; 03-18-2010 at 02:18 AM.
 
Old 03-18-2010, 02:14 AM   #3
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
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 02:15 AM.
 
Old 03-18-2010, 02: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, 02:20 AM   #5
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,339

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

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

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, 02:39 AM   #8
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
What is the output of
Code:
alias su
echo "'$PS1'"
echo "'$PROMPT_COMMAND'"
 
Old 03-18-2010, 03: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, 03:51 AM   #10
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
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, 04:10 AM   #11
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
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, 07:05 AM   #12
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
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



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:12 AM.

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
Open Source Consulting | Domain Registration