主页 > 电脑教程 > 电脑故障 >

Linux Issue | bash: fdisk-l: command not found解决

电脑故障 2017-05-25

[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


标签: Linux

电脑软硬件教程网 Copyright © 2016-2030 www.computer26.com. Some Rights Reserved.