最近在用RedHat Linux5的时候,使用fdisk命令,遇到了下面的错误:
bash:fdisk:command not found
在网上找了找,解决方案如下:
首先,这个错误的原因是因为fdisk不在PATH的路径中
查看PATH路径:
[TrishBoay@localhost ~]$echo $PATH
/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/baixiaohu/bin
找到fdisk路径:
[TrishBoay@localhost ~]$whereis fdisk
fdisk: /sbin/fdisk /usr/share/man/man8/fdisk.8.gz
讲fdisk路径加入到PATH路径中,使用ln指令:
[TrishBoay@localhost ~]$su
passwd:
[root@localhost ~]#ln -s /sbin/fdisk /usr/bin
查看/usr/bin目录:
[root@localhost ~]#find /usr/bin|grep "fdisk"
/usr/bin/fdisk
下面就可以使用fdisk指令了
[root@localhost ~]#fdisk -l
Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 25 200781 83 Linux
/dev/sda2 26 2065 16386300 82 Linux swap / Solaris
/dev/sda3 2066 65806 511999582+ 83 Linux
/dev/sda4 65807 121601 448173337+ 5 Extended
/dev/sda5 65807 84928 153597433+ 83 Linux
/dev/sda6 84929 97676 102398278+ 83 Linux
/dev/sda7 97677 102775 40957686 83 Linux
/dev/sda8 102776 105325 20482843+ 83 Linux
/dev/sda9 105326 109150 30720000 83 Linux