Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Command Line problems with Redhat 6.2

Status
Not open for further replies.

idiotboy

Programmer
Apr 20, 2001
21
GB
I have installed redhat Linux 6.2 on an 486 with no problems. No reported errors. However, whenever I try to invoke a command (e.g. adduser, shutdown, wall,) the command line informs me that no such command exists, despite everything being in my /sbin.

Can anyone help. My aim is to run redhat from the command line only to gain admin skills and manage a 'mock up' system from home.

thanks
 
Yes I was logged in as root (I didn't think it was possible to perform a shutdown with the standard default user settings?)

The puzzling thing is that the command line prompt kept referring to the command not existing in the shell. Is it possible that I've not selected the correct shell? That doesn't sound right, I mean it can't be possible to install the server and not install the correct shell from which to administer the system. My default shell is bash. Is this correct?
 
Have you tried specifying the full path to the command. e.g. /sbin/shutdown It might be that your paths are set up incorrectly. I don't have access to a linux machine any more so this is all from my head. Check your .bash_profile and look for shell and path commands. Mise Le Meas,

Mighty :)
 
will do. Will have to wait til tonight. Will try later. Thanks for the help.
 
If you need to add paths to your user config, just go into .bash_profile and look for a line that starts with Path=. in it place the path that you want, split by a colon.
EX:
PATH=$PATH:$HOME/bin:/sbin:/usr/local/bin

NOTE: be careful as you may fudge it up if you don't understand this. To experiment, try a test account so if you mess up the command line, you can just restore it with root.
 
Well folks,
it looks like the .bash_profile and .bash_rc (I think its called .bash_rc) have bits missing. I have copies so if I have made a mistake I can easliy rectify this. The path doesn't point to the /sbin so I amended that, but it still came back with no joy when executing commands on the command line. Could someone post there .bash_profile and .bash_rc? Would that be a potential security breach? If so, could someone point me in the right direction as to where to find one. I've had a look in my 'Complete Unix' manual and it doesn't have one!

Has anyone come across this before? I've installed the 'server'. Can I just run this from the command line or do I require to use Linuxconf to manage the system?

Thanks to mighty and rninja for the help so far
 
I only grasping at straws here as I have no access to Linux. Did you log out after you changed your bash_rc and bash_profile. These files only activate at login. Mise Le Meas,

Mighty :)
 
You could try accessing the man pages for information. I am not sure if there is any but there most likely is.

Try typing:

man bash_profile or variations Mise Le Meas,

Mighty :)
 
Mighty,

I logged out and tried again. No changes. The man pages are good, but as I've never actually beed root on anything before, I've no idea whether the .bash_profile is right or not.

I'll try again later tonight (at work at the moment). I'd thought I'd just cut to the quick and get my hands on a copy that works (for someone elses system and clone it) as at present, I have no frame of reference to see if the one supplied is indeed the correct format/content.

I've had a mooch around the Redhat site but couldn't find any.

I thought somebody might send me a copy.

But, I think your right its got to be the .bash_profile it makes perfect sense. everytime I try to execute an exe the command line automatically returns the prompt "not found in shell" (or something like that) so the exe's exist but when executing them from the command line the .bash_profile doesn't know where to look so while the system has them safetly tucked away, my root profile doesn't point to them. I have another question though, when logged in as root I thought of this and tried to execute them by typing the full path...but again the same problem. Do you know why?
 
As far as I remember, there is also some shell commands in the .bash_profile or .bash_rc. It might be that your shell has not been set up correctly. Also check the /etc/password file as there is a reference to your shell at the end of your login string. I say that it all comes back to the content of those files.

Sorry I can't be of more help but as I said before I don't have access to a linux machine. Mise Le Meas,

Mighty :)
 
Mighty,

as I said before, your help has certainly put me on the right track and I appreciate your help. I'll have a trawl round the internet to see if I can find more.

Once again thanks for your help.

I'll let you know how I get on.

Cheers

Idiotboy
 
Can you run any of the commandswhile in the sbin directory and using ./ before the command? The ./ tells the system to look in the existing directory first. Also, in the PATH, if you add the .: entry, the system will look in the current directory as well. One more thing you can try, change to a different shell. Type csh to get to the c-shell environment. The command structures are slightly different in some cases, but for the most part thaey are the same.
 
Cheers Timsr,

will give this a try tonight. Will let you and Mighty posted.

Thanks

idiotboy
 
Hello Mighty,Rninja and Timsr


Well taking your advice has proved to be beneficial. But, things haven't changed that much. Last night I tried to execute the command shutdown -a -t 60 by typing /sbin/shutdown -a -t 60 and nothing happend except a different system prompt telling me I had the incorrect syntax! Aha success! Well no actually, trying to shutdown the system, nothing worked except when I specified the "now" option which actually brought the system down to level "3" and returned to the bash# prompt. Then it would return to the standard login.

So today's questions. I'm not sure about my .bash_profile/.bashrc. I understand that the .bash_profile is basically a file which tells the shell that I "ROOT" can execute the following commands (as pointed to by the path in the .bash_profile) and that the .bashrc is basically a shell descriptor that executes the command requested at the command line (which is asctually an .exe in the /usr/local/bin/bashrc. I think that's what happens. I'll probably make a copy of my .bash_profile and post it too you all tonight (wife is baby sitting!) so you can take a look and point out any errors.

Believe it or not I've still yet to find a full example of a .bash_profile on the web!

My other question:
1) shutdown -a -t 60
2) /sbin/shutdown -a -t 60
3) (pwd = /sbin)/sbin/shutdown -a -t 60

The question is, which of the above is the standard (no errors with your .bash_profile) syntax. I'm used to just typing the command name (without the directory tag or being the directory) am I correct to expect this in Redhat 6.2 Server also.

Speak to you all soon,

Thanks for the encouraging advice, patience and good will.


idiotboy
 
Here is a slightly modified version of my .bashrc. The paths are for the Mandrake distribution which is based on Red Hat so they should be the same. Don't know if this helps.

# User specific aliases and functions

alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
alias d='ls'
alias s='cd ..'
alias p='cd -'

# Tell to df to don't see the supermount filesystems.
alias df='df -x supermount'

#
[ -z $DISPLAY ] || . /etc/profile.d/color_ls.sh

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi

PATH=.:/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin
ENV=$HOME/.bashrc
USERNAME="root"
export USERNAME ENV PATH

[ -z $INPUTRC ] && export INPUTRC=/etc/inputrc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top