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 09-29-2012, 04: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, 04:56 AM   #2
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
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
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, 10:06 AM   #4
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
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, 11:27 AM   #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, 12: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



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

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

All times are GMT -5. The time now is 07:19 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
Open Source Consulting | Domain Registration