zoukankan      html  css  js  c++  java
  • Linux学习第一章作业.zxs

    linux系统管理第一章作业

    上机作业:

    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 内嵌(由此可见该命令pwd为内部命令)

    [root@localhost ~]# type ls

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

    [root@localhost ~]# type ifconfig

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

    [root@localhost ~]# type du

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

     

    3、请在/下创建目录abc

    [root@localhost /]# mkdir abc

    [root@localhost /]# ls

    abc  boot  etc   lib    media  opt   root  sbin  sys  usr

    bin  dev   home  lib64  mnt    proc  run   srv   tmp  var

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

        root@localhost /]# cd abc

    [root@localhost abc]# mkdir -pv /liangjian/liyunlong/weiheshang/duanpengcd

    mkdir: 已创建目录 "/liangjian"

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

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

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

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

        [root@localhost abc]# mkdir {1..1000}{12}

    [root@localhost abc]# ls

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

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

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

    [root@localhost duanpengcd]# pwd

    /liangjian/liyunlong/weiheshang/duanpengcd

    [root@localhost duanpengcd]#cd ..

    [root@localhost weiheshang]# cd ..

    [root@localhost liyunlong]#

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

    [root@localhost abc]# rm -rf *{12}

    [root@localhost abc]# ls

    [root@localhost abc]#

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

    [root@localhost abc]# ls

    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 boot]# cp vmlinuz-* /abc/

       [root@localhost boot]# cd /abc

    [root@localhost abc]# ls

    stu10.txt  stu18.txt  stu6.txt

    stu11.txt  stu19.txt  stu7.txt

    stu12.txt  stu1.txt   stu8.txt

    stu13.txt  stu20.txt  stu9.txt

    stu14.txt  stu2.txt   vmlinuz-0-rescue-31f765095e1440c19a6355c391d8b37b

    stu15.txt  stu3.txt   vmlinuz-3.10.0-693.el7.x86_64

    stu16.txt  stu4.txt

    stu17.txt  stu5.txt

    [root@localhost abc]# du -hs vmlinuz-*

    5.7M  vmlinuz-0-rescue-31f765095e1440c19a6355c391d8b37b

    5.7M  vmlinuz-3.10.0-693.el7.x86_64

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

       [root@localhost abc]# mv vmlinuz-0-rescue-31f765095e1440c19a6355c391d8b37b kgc

    [root@localhost abc]# ls

    kgc        stu14.txt  stu19.txt  stu4.txt  stu9.txt

    stu10.txt  stu15.txt  stu1.txt   stu5.txt  vmlinuz-3.10.0-693.el7.x86_64

    stu11.txt  stu16.txt  stu20.txt  stu6.txt

    stu12.txt  stu17.txt  stu2.txt   stu7.txt

    stu13.txt  stu18.txt  stu3.txt   stu8.txt

       [root@localhost abc]# mv vmlinuz-3.10.0-693.el7.x86_64 /tmp

    [root@localhost abc]# ls /tmp

    anaconda.log

    hsperfdata_root

    ifcfg.log

    ks-script-95TaI1

    packaging.log

    program.log

    sensitive-info.log

    ssh-4Logf2koCIeh

    ssh-FQa1t5Qo4UsR

    storage.log

    systemd-private-0934a3c225da4868914ecc6b4bcd82d5-chronyd.service-R6Kolm

    systemd-private-0934a3c225da4868914ecc6b4bcd82d5-colord.service-BzfhDY

    systemd-private-0934a3c225da4868914ecc6b4bcd82d5-cups.service-ViZWqL

    systemd-private-0934a3c225da4868914ecc6b4bcd82d5-rtkit-daemon.service-X9xzj0

    systemd-private-0934a3c225da4868914ecc6b4bcd82d5-vgauthd.service-cnIl76

    systemd-private-0934a3c225da4868914ecc6b4bcd82d5-vmtoolsd.service-2wcrGe

    systemd-private-3a9601c16f974e588a53ad9636f64bfb-chronyd.service-2IDYE8

    systemd-private-3a9601c16f974e588a53ad9636f64bfb-colord.service-pIx6wA

    systemd-private-3a9601c16f974e588a53ad9636f64bfb-cups.service-LRQiaT

    systemd-private-3a9601c16f974e588a53ad9636f64bfb-rtkit-daemon.service-V1OqLf

    systemd-private-3a9601c16f974e588a53ad9636f64bfb-vgauthd.service-Gn2UWm

    systemd-private-3a9601c16f974e588a53ad9636f64bfb-vmtoolsd.service-Bmodgu

    tracker-extract-files.0

    tracker-extract-files.1000

    vmlinuz-3.10.0-693.el7.x86_64

    yum.log

    yum_save_tx.2019-07-23.19-40.H01igY.yumtx

    yum_save_tx.2019-07-24.09-15.KtMn3n.yumtx

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

       [root@localhost tmp]# stat /tmp/vmlinuz-3.10.0-693.el7.x86_64

      文件:"/tmp/vmlinuz-3.10.0-693.el7.x86_64"

      大小:5877760        块:11480      IO 块:4096   普通文件

    设备:fd00h/64768d      Inode:4534555     硬链接:1

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

    最近访问:2019-07-23 17:22:31.352435913 +0800

    最近更改:2019-07-23 17:27:02.701843250 +0800

    最近改动:2019-07-23 17:28:09.402714318 +0800

    创建时间:-

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

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

    ./vmlinuz-3.10.0-693.el7.x86_64

  • 相关阅读:
    通过HTTP发包工具了解HTTP协议
    Oracle之数据库安全
    SQL注入深入剖析
    apache中如何调用CGI脚本
    fastcgi php-cgi与php-fpm区别和之间的关系
    使用PHPExcel实现Excel文件的导入和导出(模板导出)
    学会数据库读写分离、分表分库
    框架Thinkphp5 简单的实现行为 钩子 Hook
    php文件下载
    PHP为JSON数据的API返回空数组或者空对象
  • 原文地址:https://www.cnblogs.com/wangjia120/p/11238116.html
Copyright © 2011-2022 走看看