運行fdisk命令時,彈出 bash:fdisk:command not found


原因:命令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
……

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM