Linux Issue | bash: fdisk-l: command not found解決
[root@localhost boot]# fdisk-l <--使用 fdisk命令時候 出現如下錯誤
bash: fdisk-l: command not found
[root@localhost boot]# whereis fdisk <--查詢fdisk命令的位置
fdisk: /sbin/fdisk /usr/share/man/man8/fdisk.8.gz
[root@localhost boot]# echo $PATH <---查詢環境變量
/nfs/smartsvn/bin:/usr/local/sbin:/sbin:/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin:/usr/sbin:/usr/local/bin:/usr/bin:/bin:/usr/java/jdk1.7.0_25/bin:/usr/dev/svnclient/smartsvn-7_5_2/bin
[root@localhost boot]# echo $PATH | grep /sbin/fdisk <--再次確認確實沒有fdisk命令所在位置
[root@localhost boot]# ln -s /sbin/fdisk /usr/local/sbin <--fdisk添加到當前命令搜索路徑中即可
[root@localhost boot]# cd /usr/local/sbin <--確認fdisk已經添加到環境變量
[root@localhost sbin]# ls -F |grep /sbin/fdisk
[root@localhost sbin]# ls -F
fdisk@
[root@localhost sbin]# fdisk -l<--使用fdisk命令
Disk /dev/sda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000f1e94
Device Boot Start End Blocks Id System
/dev/sda1 * 1 39 307200 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 39 2354 18598912 83 Linux
/dev/sda3 2354 2611 2064384 82 Linux swap / Solaris