1、请用命令查出ifconfig命令程序的绝对路径
[root@localhost ~]# which ifconfig
/usr/sbin/ifconfig
2、请用命令展示以下命令哪些是内部命令,哪些是外部命令?(cd \ pwd \ ls \ ifconfig \ du)
[root@localhost ~]# type cd
cd 是 shell 内嵌 (由此可见该命令cd为内部命令)
[root@localhost ~]# type pwd
pwd 是 shell 内嵌
[root@localhost ~]# type ls
ls 是 `ls --color=auto' 的别名
[root@localhost ~]# type ifconfig
ifconfig 是 /usr/sbin/ifconfig
[root@localhost ~]# type du
du 是 /usr/bin/du
3、请在/下创建目录abc
请在/下创建目录/liangjian/liyunlong/weiheshang/duanpeng
请在/abc下一次创建1000个目录,名字自己拟定。
[root@localhost ~]# cd /
[root@localhost /]# mkdir abc
[root@localhost /]# ls
abc bin boot dev etc home langjian liangjian lib lib64 media mnt opt proc root run sbin srv sys tmp usr var
[root@localhost /]# mkdir -p /liangjian/liyunlong/weiheshang/duanpeng
[root@localhost /]# ls
abc boot etc langjian lib media opt root sbin sys usr wuminyanbazu2
bin dev home liangjian lib64 mnt proc run srv tmp var
[root@localhost /]# ls /liangjian
liuyunlong liyunlong
[root@localhost /]# ls /liangjian/liyunlong
weiheshang
[root@localhost /]# ls /liangjian/liyunlong/weiheshang
Duanpeng
[root@localhost abc]# mkdir {1..1000}
[root@localhost abc]# ls
1 168 237 306 376 445 514 584 653 722 792 861 930
10 169 238 307 377 446 515 585 654 723 793 862 931
100 17 239 308 378 447 516 586 655 724 794 863 932
1000 170 24 309 379 448 517 587 656 725 795 864 933 .......(太多了,此处省略)
4、请用绝对路径方式切换到/liangjian/liyunlong/weiheshang/duanpeng 目录下
并用pwd查看当前的路径,请用上级目录名".."方式切换到 /liangjian/liyunlong下
[root@localhost /]# cd /liangjian/liyunlong/weiheshang/duanpeng
[root@localhost duanpeng]#
5、请一次删除/abc下一次创建的1000个目录,请在/abc下用touch再创建20个以stu开头的普通可读文档,文档后缀为.txt
[root@localhost abc]# rm -r -f {1..1000} 删除目录一定要加 (-r); 普通文件不需要
[root@localhost abc]# touch {1..20}.txt
[root@localhost abc]# ls
10.txt 13.txt 16.txt 19.txt 2.txt 5.txt 8.txt
11.txt 14.txt 17.txt 1.txt 3.txt 6.txt 9.txt
12.txt 15.txt 18.txt 20.txt 4.txt 7.txt
6、请用cp命令将/boot/目录下以vmlinuz开头的文件拷贝到/abc下,并以查看他们占磁盘的空间大小。
[root@localhost /]# cp boot/vmlinuz* /abc " * " 星号代表所有,就是以vmilnuz开头的所有文件
[root@localhost /]# ls /abc
vmlinuz-0-rescue-4794b643ab6c46f79bb0812941ef03b6 vmlinuz-3.10.0-229.el7.x86_64
7、将其中一个vmlinuz开头的文件改名为kgc,另外一个剪切到/tmp目录下。
[root@localhost /]# mv /abc/vmlinuz-0-rescue-4794b643ab6c46f79bb0812941ef03b6 /abc/kgc
[root@localhost /]# ls /abc
10.txt 12.txt 14.txt 16.txt 18.txt 1.txt 2.txt 4.txt 6.txt 8.txt kgc
11.txt 13.txt 15.txt 17.txt 19.txt 20.txt 3.txt 5.txt 7.txt 9.txt vmlinuz-3.10.0-229.el7.x86_64
[root@localhost /]# mv /abc/vmlinuz-3.10.0-229.el7.x86_64 /tmp
[root@localhost /]# ls /tmp
hsperfdata_root systemd-private-6BF4nx systemd-private-mE5DPu systemd-private-ztHm0i
ks-script-KBHRw0 systemd-private-73ioRF systemd-private-NhmB4S vmlinuz-3.10.0-229.el7.x86_64
7、查看/tmp/目录下以vmlinuz开头文件的详细状态信息。
[root@localhost /]# stat /tmp/vmlinuz*
文件:"/tmp/vmlinuz-3.10.0-229.el7.x86_64"
大小:5029136 块:9824 IO 块:4096 普通文件
设备:fd00h/64768dInode:141446558 硬链接:1
权限:(0755/-rwxr-xr-x) Uid:( 0/ root) Gid:( 0/ root)
环境:unconfined_u:object_r:default_t:s0
最近访问:2019-07-24 10:29:42.804490628 +0800
最近更改:2019-07-24 10:29:42.940492463 +0800
最近改动:2019-07-24 10:46:55.532330216 +0800
创建时间:-
9、用find命令查找/tmp目录下以vmlinuz开头及大小超过1M的文件
[root@localhost /]# find /tmp -name "vmlinuz*" -size +1M
/tmp/vmlinuz-3.10.0-229.el7.x86_64