码迷,mamicode.com
首页 > 其他好文 > 详细

运行fdisk命令时,弹出 bash:fdisk:command not found

时间:2018-07-18 01:17:01      阅读:199      评论:0      收藏:0      [点我收藏+]

标签:grub   password   bsp   alt   分享   span   tool   html   head   

原因:命令fdisk 不在你的命令搜索路径中

第一种解决办法,将fdisk添加到你的命令搜索路径中

首先查看你当前的命令搜索路径:

[root@host sbin]# echo $PATH
/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/vurtne/bin

再查一下fdisk命令在哪个路径下

[root@host home]# whereis fdisk
fdisk: /sbin/fdisk /usr/share/man/man8/fdisk.8.gz

此时fdisk 命令不在当前命令搜索路径里

 

将fdisk添加到当前命令搜索路径中即可

执行命令:

技术分享图片
[root@host home]# ln -s /sbin/fdisk /usr/kerberos/bin

[root@host home]# cd /usr/kerberos/bin

[root@host bin]# ll
total 836
lrwxrwxrwx 1 root root     11 Aug 21 23:46 fdisk -> /sbin/fdisk
-rwxr-xr-x 1 root root 101596 Nov 25 2008 ftp
-rwxr-xr-x 1 root root 16212 Nov 25 2008 gss-client
-rwxr-xr-x 1 root root   6864 Nov 25 2008 kdestroy
……
技术分享图片

再次运行fdisk

技术分享图片
[root@host ~]# fdisk -l

Disk /dev/sda: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

  Device Boot      Start         End      Blocks   Id System
/dev/sda1   *           1           6       48163+ 83 Linux
/dev/sda2               7         515     4088542+ 83 Linux
……
技术分享图片

第二种方法:使用 $ su -命令就可以了

技术分享图片
[vurtne@host grub]$ su -
Password: 
[root@host ~]# fdisk -l

Disk /dev/sda: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

  Device Boot      Start         End      Blocks   Id System
/dev/sda1   *           1           6       48163+ 83 Linux
/dev/sda2               7         515     4088542+ 83 Linux
……
技术分享图片
转自https://www.cnblogs.com/vurtne-lu/p/6550732.html

运行fdisk命令时,弹出 bash:fdisk:command not found

标签:grub   password   bsp   alt   分享   span   tool   html   head   

原文地址:https://www.cnblogs.com/shizhijie/p/9326901.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!