Computing.Net > Forums > Linux > how to use commands

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

how to use commands

Reply to Message Icon

Name: btech
Date: December 13, 2006 at 19:35:15 Pacific
OS: redhat 9
CPU/Ram: p2
Comment:

Hi I am new to linux i install redhat 9
I use ifconfig command it says command not found but when I use the full path I can able to use ifconfig command, my question is how can I use ifconfig without giving full path also how can I use any command without giving full path is there a way.


iam newbie i recently install suse linux 10.1 when i use su and type /etc/shadow it says permission denied i dont know why.



Sponsored Link
Ads by Google

Response Number 1
Name: ernie
Date: December 13, 2006 at 21:32:26 Pacific
Reply:

ifconfig is located in your system's /sbin directory. /sbin is not usually included in the user's PATH environment variable. For this reason, when you attempt to execute ifconfig, bash can not find it. You have several options available to you.

1). You can continue to enter the full path to ifconfig as you do now.

2). su to root, then run ifconfig. Use caution when logged in as root. The root user has a great deal of power. If that power is used carelessly, it can wreak havoc on your Linux system.

3). Create a symbolic link to /sbin/ifconfig in your ~/bin directory or in /usr/bin. Both should be in your user's PATH environment variable. If you put the link in /usr/bin, it will be available to all users on your system. If you put it in ~/bin, it will be available only to your user account. To create a symbolic link to /sbin/ifconfig, open a terminal window. Switch to your ~/bin directory:

cd ~/bin

or to /usr/bin

cd /usr/bin

If you put the link in /usr/bin, you must su to root before creating the link. Create the symbolic link:

ln --symbolic /sbin/ifconfig

4). You can add /sbin to your user's PATH environment variable. To do this, edit .bash_profile in your user's directory. If there is no .bash_profile, then edit .bashrc. There should be a line similar to:

PATH=$PATH:$HOME/bin

Edit the line to read:

PATH=$PATH:$HOME/bin:/sbin

Log out, then back in (no need to reboot). Now your bash command interpreter can locate any program in /sbin, and you can run them provided your user account has permission (authority) to do so.

Ernie Registered Linux User 247790
ICQ 41060744


0

Response Number 2
Name: 3Dave
Date: December 14, 2006 at 06:34:21 Pacific
Reply:

If you are using "su" to switch to root user you may have to use "su -" to get root's path as well.

Another way would be to use sudo which you can set to inherit root's path, eg "sudo ifconfig".


0

Response Number 3
Name: btech
Date: December 14, 2006 at 08:04:44 Pacific
Reply:

Thanks guys
i forgot to ask when i try to open /etc/hosts it says permission denied i change permission chmod 777 /etc/shadow but it still says permission denied how can i change permission for root, root has all access then how come it says permission denied.

iam newbie i recently install suse linux 10.1 when i use su and type /etc/shadow it says permission denied i dont know why.


0

Response Number 4
Name: 3Dave
Date: December 15, 2006 at 01:05:22 Pacific
Reply:

How are you trying to open /etc/hosts?


0

Response Number 5
Name: btech
Date: December 15, 2006 at 11:10:42 Pacific
Reply:

as root user /etc/hosts
do i need to use allow or denied with host file??


iam newbie i recently install suse linux 10.1 when i use su and type /etc/shadow it says permission denied i dont know why.


0

Related Posts

See More



Response Number 6
Name: 3Dave
Date: December 15, 2006 at 14:57:23 Pacific
Reply:

For info on the /etc/hosts file type:
man hosts

It sounds like you are trying to run text files and not binaries....what program are you using to edit /etc/hosts and /etc/shadow?


0

Sponsored Link
Ads by Google
Reply to Message Icon

postfix problems redhat 9.0 over xp



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Linux Forum Home


Sponsored links

Ads by Google


Results for: how to use commands

How to use RPM under windows? www.computing.net/answers/linux/how-to-use-rpm-under-windows/18015.html

How to use sed to remove ^M from files? www.computing.net/answers/linux/how-to-use-sed-to-remove-m-from-files/9335.html

how to use PHP to authenticate users www.computing.net/answers/linux/how-to-use-php-to-authenticate-users/7801.html