zoukankan      html  css  js  c++  java
  • Linux Chapter01命令测试

    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 ifconfig

    ifconfig /usr/sbin/ifconfig命令ifconfig为外部命令)

    [root@localhost ~]# type ls

    ls `ls --color=auto' 的别名

    [root@localhost ~]# type du

    du 已被哈希 (/usr/bin/du) 命令du为外部命令)

     

    3、请在/下创建目录abc

    [root@localhost ~]# mkdir /abc

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

    //创建嵌套目录

     [root@localhost ~]# mkdir -p /liangjian/liyunlong/weiheshang/duanpeng

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

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

     

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

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

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

    [root@localhost duanpeng]# pwd

    /liangjian/liyunlong/weiheshang/duanpeng

    [root@localhost duanpeng]# cd ..

    [root@localhost weiheshang]# cd ..

    [root@localhost liyunlong]#

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

    [root@localhost abc]# rm -rf {1..1000}

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

    [root@localhost ~]# cd /abc

    [root@localhost abc]# ls

    stu10.txt  stu15.txt  stu1.txt   stu5.txt  vmlinuz-0-rescue-838f26c3e2384f26aae18f06e79bf4bb

    stu11.txt  stu16.txt  stu20.txt  stu6.txt  vmlinuz-3.10.0-229.el7.x86_64

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

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

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

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

    4.8M vmlinuz-0-rescue-838f26c3e2384f26aae18f06e79bf4bb

    4.8M vmlinuz-3.10.0-229.el7.x86_64

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

    //将文件改名为kgc,改名时注意要在源文件的文件夹中进行移动。

    [root@localhost ~]# cd /abc

    [root@localhost abc]# mv vmlinuz-0-rescue-838f26c3e2384f26aae18f06e79bf4bb kgc

    [root@localhost abc]# ls

    kgc        stu13.txt  stu17.txt  stu20.txt  stu5.txt  stu9.txt

    stu10.txt  stu14.txt  stu18.txt  stu2.txt   stu6.txt  vmlinuz-3.10.0-229.el7.x86_64

    stu11.txt  stu15.txt  stu19.txt  stu3.txt   stu7.txt

    stu12.txt  stu16.txt  stu1.txt   stu4.txt   stu8.txt

    [root@localhost ~]# cd /abc

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

    [root@localhost abc]# cd /tmp

    [root@localhost tmp]# ls

    hsperfdata_root         systemd-private-IA1NiL         yum.log

    ks-script-glUqTW        systemd-private-OgMqyS         yum_save_tx.2019-07-23.10-00.EjATxY.yumtx

    ssh-elp9gBQCnmC6        vmlinuz-3.10.0-229.el7.x86_64  yum_save_tx.2019-07-23.10-12.9IIbjS.yumtx

    systemd-private-fO8c2j  vmware-root                    yum_save_tx.2019-07-24.08-38.DzRQbS.yumtx

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

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

      文件:"vmlinuz-3.10.0-229.el7.x86_64"

      大小:5029136    块:9824       IO 块:4096   普通文件

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

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

    环境:unconfined_u:object_r:default_t:s0

    最近访问:2019-07-24 08:52:15.738403542 +0800

    最近更改:2019-07-24 08:52:15.748438284 +0800

    最近改动:2019-07-24 09:03:39.520029070 +0800

    创建时间:-

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

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

    /tmp/vmlinuz-3.10.0-229.el7.x86_64

    本文为作者 三岁半的胖啊 的原创,转载请标明出处 链接:https://home.cnblogs.com/u/tanxiaojuncom/
  • 相关阅读:
    Oracle常用系统查询SQL
    easyui中使用的遮罩层
    EasyUI相同的Tab只打开一个(即EasyUI方法的调用方法)
    jQueryEasyUI创建菜单主页
    linux 的环境变量的配置文件
    angular reactive form
    svn代码回滚
    golang restful api
    golang embedded structs
    Angular Multiple HTTP Requests with RxJS
  • 原文地址:https://www.cnblogs.com/tanxiaojuncom/p/11235845.html
Copyright © 2011-2022 走看看