LinuxQuestions.org
Visit Jeremy's Blog.
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 06-25-2008, 12:31 AM   #1
sky rulz
Member
 
Registered: Jun 2008
Posts: 40

Rep: Reputation: 15
fdisk command does not work on my sytem?


fdisk command does not work on my sytem?

i have tried the following command...

fdisk -l

The output was:
bash: fdisk: command not found

as u can see i use the bash shell?
There is a man page which shows all the options of the command, but the shell says the command not found..Whats the problem?
 
Old 06-25-2008, 12:43 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 15,186

Rep: Reputation: 1953Reputation: 1953Reputation: 1953Reputation: 1953Reputation: 1953Reputation: 1953Reputation: 1953Reputation: 1953Reputation: 1953Reputation: 1953Reputation: 1953
Not in your path probably - what does "which fdisk" return ??.
Use that.
 
Old 06-25-2008, 07:30 AM   #3
farslayer
LQ Guru
 
Registered: Oct 2005
Location: Willoughby, Ohio
Distribution: linuxdebian
Posts: 7,232
Blog Entries: 5

Rep: Reputation: 190Reputation: 190
You were not root..

Quote:
user@it-etch:~$ fdisk -l
bash: fdisk: command not found

user@it-etch:~$ /sbin/fdisk -l

user@it-etch:~$ su -
Password:

it-etch:~# fdisk -l

Disk /dev/sda: 160.0 GB, 160000000000 bytes
255 heads, 63 sectors/track, 19452 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x0e1069f4

Device Boot Start End Blocks Id System
/dev/sda1 * 1 851 6835626 83 Linux
/dev/sda2 852 19452 149412532+ 5 Extended
/dev/sda5 852 1181 2650693+ 82 Linux swap / Solaris
/dev/sda6 1182 19452 146761776 83 Linux
 
Old 06-25-2008, 08:03 AM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 15,186

Rep: Reputation: 1953Reputation: 1953Reputation: 1953Reputation: 1953Reputation: 1953Reputation: 1953Reputation: 1953Reputation: 1953Reputation: 1953Reputation: 1953Reputation: 1953
You may well be right - but that (requiring root) is just incredibly lame.
How can the devs justify that ???.
 
Old 06-25-2008, 08:10 AM   #5
farslayer
LQ Guru
 
Registered: Oct 2005
Location: Willoughby, Ohio
Distribution: linuxdebian
Posts: 7,232
Blog Entries: 5

Rep: Reputation: 190Reputation: 190
Why would you want a normal user to be able to run a utility that could wipe out all the partitions on a system ?

there is no granular control in fdisk to allow a user to list but not delete or change, that I am aware of..

Last edited by farslayer; 06-25-2008 at 08:18 AM.
 
Old 06-25-2008, 09:18 AM   #6
twlilinux
Member
 
Registered: Jan 2006
Distribution: debian
Posts: 63

Rep: Reputation: 15
I don't know if this is what you want, but if you just want to list the disk usage, then try the command "df"

df [return] will give you a listing of all your partitions and their usage. type man df for more tutorial.
 
Old 06-25-2008, 11:38 AM   #7
onebuck
Moderator
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 12,616
Blog Entries: 26

Rep: Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988
Hi,
Quote:
Originally Posted by syg00 View Post
You may well be right - but that (requiring root) is just incredibly lame.
How can the devs justify that ???.
Not to get into a flamewar but to have user access to tools or command(s) that could be disastrous to a system is just plain stupid.

Superuser rights should be guarded as if life/death situation. Limit the root access to known good admins.
 
Old 06-25-2008, 08:11 PM   #8
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 15,186

Rep: Reputation: 1953Reputation: 1953Reputation: 1953Reputation: 1953Reputation: 1953Reputation: 1953Reputation: 1953Reputation: 1953Reputation: 1953Reputation: 1953Reputation: 1953
Yeah you're probably right - I had been fighting partition problems all day, and was pissed off at the world.
Probably why I find myself running as root (almost) all the time.

Why shouldn't "fdisk -l" be available to all and sundry ???. Guess it needs to a separate program.
 
Old 06-25-2008, 08:15 PM   #9
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 61
Quote:
Originally Posted by syg00 View Post
Y
Why shouldn't "fdisk -l" be available to all and sundry ???. Guess it needs to a separate program.

Simple. Non-privileged users do not have access to the raw disk or partition. If they did, they could dd the entire disk and gain access to everything on the partition. Probably not a good idea.
 
Old 06-25-2008, 08:18 PM   #10
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671
Quote:
Originally Posted by syg00 View Post
Yeah you're probably right - I had been fighting partition problems all day, and was pissed off at the world.
Probably why I find myself running as root (almost) all the time.

Why shouldn't "fdisk -l" be available to all and sundry ???. Guess it needs to a separate program.
There are two things that are issues here. First if you use sudo to run the command, you need to add the full path.

sudo /sbin/fdisk -l

Secondly, the fdisk command access the raw devices for the disks. Only root has read or write access to them.

You shouldn't be running as root so much. For disk partitioning however, you do need to.
 
Old 06-25-2008, 10:27 PM   #11
asadrony
LQ Newbie
 
Registered: May 2008
Posts: 8

Rep: Reputation: 0
You should logon as a ROOT. fdisk command is only for Root. If you don't have root passwd, then you have to apply new passwd for root........Thanks
 
Old 06-25-2008, 11:08 PM   #12
onebuck
Moderator
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 12,616
Blog Entries: 26

Rep: Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988
Hi,

I really think it is wise to guard the family jewels. As far as I'm concerned no one but me will have root privileges on my systems. Now for clients that's another story. It is up to the admin to decide who has superuser rights on their systems. I warn them about what can happen when someone who has rights but doesn't know what to do. Things can go awry quickly with someone who knows just enough to get themselves and the company into BIG trouble but $$$$ for me.
 
Old 06-26-2008, 02:09 AM   #13
shahz
Member
 
Registered: Sep 2006
Location: Quetta, Pakistan
Distribution: RHEL 4
Posts: 363

Rep: Reputation: 29
Dear

as already the seniors have many suggations for you, can you try to ls the sbin directory. if you have fdisk in it.

#ls -ali /sbin/fdisk
 
Old 06-26-2008, 11:53 PM   #14
sky rulz
Member
 
Registered: Jun 2008
Posts: 40

Original Poster
Rep: Reputation: 15
hi everyone,

I have tried the fdisk command as root but doest not work.
But as the senior member syg00 said i have tried 'Which fdisk'...The output of this command on my system was some thing like this:

Quote:
/usr/bin/which: no fdisk in (/usr/kerberos/sbin:/usr/lib/qt-3.3/bin:/usr/kerberos/bin:/usr/lib/ccache:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/Sravan/bin)
i have used the df command and got the disk info.
 
Old 06-26-2008, 11:56 PM   #15
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 61
What do you mean by "does not work"?
 
  


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
sytem hangs up after giving init0 command rhea Linux - Networking 14 01-27-2006 03:30 AM
unable to create files using touch command on remote Win2003 sytem using samba xylo Linux - Networking 4 07-15-2004 10:59 AM
fdisk command - can't get it to work!! sknarf Linux - Software 4 06-23-2004 01:59 AM
fdisk command thefetus Linux - Newbie 5 11-19-2003 02:15 PM
fdisk not a command? toob Linux - Newbie 11 04-26-2003 10:56 PM


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

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