chapter01作业

1、 请用命令查出ifconfig命令程序的绝对路径

[root@localhost chen]# which ifconfig

/usr/sbin/ifconfig

2、请用命令展示以下命令哪些是内部命令,哪些是外部命令?(cd \ pwd \ ls \ ifconfig \ du)

[root@localhost chen]# type cd

cd shell 内嵌(由此可见该命令cd为内部命令)

[root@localhost chen]# type pwd

pwd shell 内嵌(由此可见该命令shell为内部命令)

[root@localhost chen]# type ls

ls `ls --color=auto' 的别名(由此可见该命令ls为外部命令)

[root@localhost chen]# type ifconfig

扫描二维码关注公众号,回复: 6863456 查看本文章

ifconfig /usr/sbin/ifconfig(由此可见该命令ifconfig为外部命令)

[root@localhost chen]# type du

du /usr/bin/du(由此可见该命令du为外部命令)

 

3.请在/下创建目录abc

[root@localhost chen]# mkdir /abc

[root@localhost chen]# ls /

101  bin   dev  home  lib64  mnt  proc  run   srv  tmp  var

abc  boot  etc  lib   media  opt  root  sbin  sys  usr

请在/下创建目录/liangjian/liyunlong/weiheshang/duanpeng

[root@localhost chen]# mkdir -pv  /liangjian/liyunlong/weiheshang/duanpeng

mkdir: 已创建目录 "/liangjian"

mkdir: 已创建目录 "/liangjian/liyunlong"

mkdir: 已创建目录 "/liangjian/liyunlong/weiheshang"

mkdir: 已创建目录 "/liangjian/liyunlong/weiheshang/duanpeng"

[root@localhost chen]# ls -Rh /liangjian

/liangjian:

liyunlong

/liangjian/liyunlong:

weiheshang

/liangjian/liyunlong/weiheshang:

duanpeng

/liangjian/liyunlong/weiheshang/duanpeng:

请在/abc下一次创建1000个目录,名字自己拟定。

[root@localhost chen]# mkdir -p  /abc/a{1..1000}

[root@localhost chen]# ls /abc

a1     a168  a237  a306  a376  a445  a514  a584  a653  a722  a792  a861  a930

a10  a100   a17   a239  a308  a378  a447  a516  a586  a655  a724  a794  a1000  a170  a24   a309  a379  a448  a517  a587  a656  a725  a795  a864

……    a166   a235  a304  a374  a443  a512  a582  a651  a720  a790  a86   a929  a999

a167   a236  a305  a375  a444  a513  a583  a652  a721  a791  a860  a93

4、请用绝对路径方式切换到/liangjian/liyunlong/weiheshang/duanpeng 目录下

并用pwd查看当前的路径,请用上级目录名".."方式切换到 /liangjian/liyunlong

[root@localhost duanpeng]# cd /liangjian/liyunlong/weiheshang/duanpeng

[root@localhost duanpeng]# pwd

/liangjian/liyunlong/weiheshang/duanpeng

[root@localhost duanpeng]# cd ../../

[root@localhost liyunlong]# pwd

/liangjian/liyunlong

5、请一次删除/abc下一次创建的1000个目录,请在/abc下用touch再创建20个以stu开头的普通可读文档,文档后缀为.txt

[root@localhost liyunlong]# rm -rf /abc/a*

[root@localhost liyunlong]# touch /abc/stu{1..20}.txt

[root@localhost liyunlong]# ls /abc/

stu10.txt  stu13.txt  stu16.txt  stu19.txt  stu2.txt  stu5.txt  stu8.txt

stu11.txt  stu14.txt  stu17.txt  stu1.txt   stu3.txt  stu6.txt  stu9.txt

stu12.txt  stu15.txt  stu18.txt  stu20.txt  stu4.txt  stu7.txt

6、请用cp命令将/boot/目录下以vmlinuz开头的文件拷贝到/abc下,并以查看他们占磁盘的空间大小。

[root@localhost ~]# ls /boot/

config-3.10.0-862.el7.x86_64

efi

grub

grub2

initramfs-0-rescue-a98e3946315a4366a69c9cccd8aca211.img

initramfs-3.10.0-862.el7.x86_64.img

symvers-3.10.0-862.el7.x86_64.gz

System.map-3.10.0-862.el7.x86_64

vmlinuz-0-rescue-a98e3946315a4366a69c9cccd8aca211

vmlinuz-3.10.0-862.el7.x86_64

[root@localhost ~]# cp /boot/vmlinuz* /abc

[root@localhost ~]# ls /abc

stu10.txt  stu16.txt  stu2.txt  stu8.txt

stu11.txt  stu17.txt  stu3.txt  stu9.txt

stu12.txt  stu18.txt  stu4.txt  vmlinuz-0-rescue-a98e3946315a4366a69c9cccd8aca211

stu13.txt  stu19.txt  stu5.txt  vmlinuz-3.10.0-862.el7.x86_64

stu14.txt  stu1.txt   stu6.txt

stu15.txt  stu20.txt  stu7.txt

[root@localhost ~]# du -ah /abc/

0       /abc/stu1.txt

0       /abc/stu2.txt

0       /abc/stu3.txt

0       /abc/stu4.txt

0       /abc/stu5.txt

0       /abc/stu6.txt

0       /abc/stu7.txt

0       /abc/stu8.txt

0       /abc/stu9.txt

0       /abc/stu10.txt

0       /abc/stu11.txt

0       /abc/stu12.txt

0       /abc/stu13.txt

0       /abc/stu14.txt

0       /abc/stu15.txt

0       /abc/stu16.txt

0       /abc/stu17.txt

0       /abc/stu18.txt

0       /abc/stu19.txt

0       /abc/stu20.txt

6.0M        /abc/vmlinuz-0-rescue-a98e3946315a4366a69c9cccd8aca211

6.0M        /abc/vmlinuz-3.10.0-862.el7.x86_64

12M /abc/

 

7、将其中一个vmlinuz开头的文件改名为kgc,另外一个剪切到/tmp目录下。

[root@localhost abc]# ls

stu10.txt  stu16.txt  stu2.txt  stu8.txt

stu11.txt  stu17.txt  stu3.txt  stu9.txt

stu12.txt  stu18.txt  stu4.txt  vmlinuz-0-rescue-a98e3946315a4366a69c9cccd8aca211

stu13.txt  stu19.txt  stu5.txt  vmlinuz-3.10.0-862.el7.x86_64

stu14.txt  stu1.txt   stu6.txt

stu15.txt  stu20.txt  stu7.txt

[root@localhost abc]# mv vmlinuz-3.10.0-862.el7.x86_64 kgc

[root@localhost abc]# ls

kgc        stu15.txt  stu20.txt  stu7.txt

stu10.txt  stu16.txt  stu2.txt   stu8.txt

stu11.txt  stu17.txt  stu3.txt   stu9.txt

stu12.txt  stu18.txt  stu4.txt   vmlinuz-0-rescue-a98e3946315a4366a69c9cccd8aca211

stu13.txt  stu19.txt  stu5.txt

stu14.txt  stu1.txt   stu6.txt

[root@localhost abc]# mv vmlinuz-0-rescue-a98e3946315a4366a69c9cccd8aca211 /tmp/

[root@localhost abc]# ls /tmp/

vmlinuz-0-rescue-a98e3946315a4366a69c9cccd8aca211

8、查看/tmp/目录下以vmlinuz开头文件的详细状态信息。

[root@localhost abc]# stat  /tmp/vmlinuz*

  文件:"/tmp/vmlinuz-0-rescue-a98e3946315a4366a69c9cccd8aca211"

  大小:6224704     块:12160      IO 块:4096   普通文件

设备:fd00h/64768d     Inode102882318   硬链接:1

权限:(0755/-rwxr-xr-x)  Uid(    0/    root)   Gid(    0/    root)

最近访问:2019-07-23 20:01:47.568656306 +0800

最近更改:2019-07-23 20:01:48.051660464 +0800

最近改动:2019-07-23 20:11:48.088912567 +0800

创建时间:-

9、用find命令查找/tmp目录下以vmlinuz开头及大小超过1M的文件

[root@localhost abc]# find /tmp -name "vmlinuz*" -a -size +1M

/tmp/vmlinuz-0-rescue-a98e3946315a4366a69c9cccd8aca211

猜你喜欢

转载自www.cnblogs.com/chenxi123/p/11242065.html
今日推荐