LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 09-29-2012, 05:50 AM   #1
suraj_thadarai
LQ Newbie
 
Registered: Aug 2012
Location: India
Distribution: Red Hat Linux
Posts: 6

Rep: Reputation: Disabled
Angry bash: fdisk : command not found


I am using Red hat Enterprise Linux into my virtual machine
but when I am invoking the command fdisk as a root user from the /sbin directory the bash is giving the message command not found
actual command
fdisk /dev/sda

please help me guys

 
Old 09-29-2012, 05:56 AM   #2
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2016, Slack14.1 Deb Jessie, + 50+ other Linux OS, for test only.
Posts: 16,276

Rep: Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154
If you use 'su' to switch to root : No "root commands" in your PATH.
But you can use the full path : /sbin/<command> <option>


If you want to have /sbin/ and /usr/sbin/ in the PATH :
Please use 'su -' instead of 'su'.

.
 
1 members found this post helpful.
Old 09-29-2012, 02:03 PM   #3
nijinashok00
LQ Newbie
 
Registered: Sep 2012
Posts: 28

Rep: Reputation: Disabled
I think the script associated with the fdisk command have lost from your system. Use
which fdisk
to make sure that the script is present for your fdisk command. It is usually present in /sbin.
 
Old 09-30-2012, 11:06 AM   #4
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
I agree, the script is no-doubt inheriting the PATH from the user's original environment, rather than the root user's. "su -" usually overcomes this, as is using the full path to the executable.

Another option is to manually add it to the PATH in the script itself:
Code:
PATH=/sbin:$PATH
 
Old 09-30-2012, 12:27 PM   #5
techguru666
LQ Newbie
 
Registered: Jul 2012
Posts: 24

Rep: Reputation: Disabled
Check if the command is present:

Quote:
$ which fdisk
Also, check your path. If the proper path is not set, the above command is going to fail.
You have another option to check:

Quote:
$ ls /sbin | grep fdisk
Run this command as root.
 
Old 09-30-2012, 01:37 PM   #6
Rupadhya
Member
 
Registered: Sep 2012
Location: Hoffman Estates, IL
Distribution: Fedora 20
Posts: 167

Rep: Reputation: Disabled
For me, Fdisk is in the /usr/sbin directory (Fedora 17)

Quote:
which fdisk
/usr/sbin/fdisk
- Raj
 
  


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
[SOLVED] bash: fdisk: command not found eng_mohammedmostafa Linux - Software 10 04-28-2010 11:40 AM
grub fdisk command not found pavankonka Linux - Laptop and Netbook 3 02-08-2006 06:06 PM
fdisk/parted/cfdisk: command not found indole Linux - Software 2 02-17-2005 01:08 PM
fdisk command not found ryancherry Fedora 2 06-12-2004 07:56 PM
fdisk command not found? tiang_ono Linux - Newbie 7 05-17-2004 11:48 PM


All times are GMT -5. The time now is 01:08 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