Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 09-29-2012, 04:50 AM   #1
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, 04:56 AM   #2
LQ 5k Club
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2019 CentOS6.10 CentOS7.6 + 50+ other Linux OS, for test only.
Posts: 17,251

Rep: Reputation: 3564Reputation: 3564Reputation: 3564Reputation: 3564Reputation: 3564Reputation: 3564Reputation: 3564Reputation: 3564Reputation: 3564Reputation: 3564Reputation: 3564
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, 01:03 PM   #3
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, 10:06 AM   #4
David the H.
Bash Guru
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian + kde 4 / 5
Posts: 6,842

Rep: Reputation: 2003Reputation: 2003Reputation: 2003Reputation: 2003Reputation: 2003Reputation: 2003Reputation: 2003Reputation: 2003Reputation: 2003Reputation: 2003Reputation: 2003
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:
Old 09-30-2012, 11:27 AM   #5
LQ Newbie
Registered: Jul 2012
Posts: 24

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

$ 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:

$ ls /sbin | grep fdisk
Run this command as root.
Old 09-30-2012, 12:37 PM   #6
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)

which fdisk
- Raj


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 10:40 AM
grub fdisk command not found pavankonka Linux - Laptop and Netbook 3 02-08-2006 05:06 PM
fdisk/parted/cfdisk: command not found indole Linux - Software 2 02-17-2005 12:08 PM
fdisk command not found ryancherry Fedora 2 06-12-2004 06:56 PM
fdisk command not found? tiang_ono Linux - Newbie 7 05-17-2004 10:48 PM > Forums > Linux Forums > Linux - Newbie

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

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration