2019.7.25 Linux系統第一章做業

一、請用命令查出ifconfig命令程序的絕對路徑node

[root@localhost ~]# which ifconfigshell

/usr/sbin/ifconfigspa

二、請用命令展現如下命令哪些是內部命令,哪些是外部命令?(cd \ pwd \ ls \ ifconfig \ du)文檔

[root@localhost ~]# type cdobject

cd shell 內嵌權限

[root@localhost ~]# type pwdgc

pwd shell 內嵌程序

[root@localhost ~]# type lstouch

ls `ls --color=auto' 的別名di

[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 ~]# mkdir /abc

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

mkdir: 已建立目錄 "/liangjian"

mkdir: 已建立目錄 "/liangjian/liyunlong"

mkdir: 已建立目錄 "/liangjian/liyunlong/weiheshang"

mkdir: 已建立目錄 "/liangjian/liyunlong/weiheshang/duanpeng"

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

4、請用絕對路徑方式切換到/liangjian/liyunlong/weiheshang/duanpeng 目錄下

並用pwd查看當前的路徑,請用上級目錄名".."方式切換到 /liangjian/liyunlong

[root@localhost ~]# 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 abc]# rm -rf *

[root@localhost abc]# ll

總用量 0

[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

六、請用cp命令將/boot/目錄下以vmlinuz開頭的文件拷貝到/abc下,並以查看他們佔磁盤的空間大小。

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

[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-73813a34ed7c4bebafd0f923f348d906

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

stu14.txt  stu1.txt   stu6.txt

stu15.txt  stu20.txt  stu7.txt

[root@localhost abc]# du vmlinuz-*

6488 vmlinuz-0-rescue-73813a34ed7c4bebafd0f923f348d906

6488 vmlinuz-3.10.0-957.el7.x86_64

 

7、將其中一個vmlinuz開頭的文件更名爲kgc,另一個剪切到/tmp目錄下。

[root@localhost abc]# mv vmlinuz-0-rescue-73813a34ed7c4bebafd0f923f348d906 /abc/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-957.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 abc]# mv vmlinuz-3.10.0-957.el7.x86_64 /tmp

8、查看/tmp/目錄下以vmlinuz開頭文件的詳細狀態信息。

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

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

  大小:6639904    塊:12976      IO 塊:4096   普通文件

設備:fd00h/64768d Inode75722       硬連接:1

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

環境:unconfined_u:object_r:default_t:s0

最近訪問:2019-07-24 15:52:36.403881545 +0800

最近更改:2019-07-24 15:52:36.420881545 +0800

最近改動:2019-07-24 15:56:34.075879323 +0800

建立時間:-

9、用find命令查找/tmp目錄下以vmlinuz開頭及大小超過1M的文件

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

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

相關文章
相關標籤/搜索