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 内嵌 (由此可见该命令cd为内部命令)
[root@localhost ~]# type ls
ls 是 `ls --color=auto' 的别名  (由此可见该命令cd为外部命令)
[root@localhost ~]#type ifconfig
ifconfig 是 /usr/sbin/ifconfig  (由此可见该命令cd为外部命令)
[root@localhost ~]#type du
du 是 /usr/bin/du  (由此可见该命令cd为外部命令)
3、请在/下创建目录abc
[root@localhost ~]#mkdir -pv /abc
mkdir:
 已创建目录 "/abc"  

请在/下创建目录/liangjian/liyunlong/weiheshang/duanpeng
 [root@localhost  abc]#mkdir -pv /liangjian/liyunlong/weiheshang/duanpeng
 mkdir:已创建目录 "/liangjian"
 mkdir: 已创建目录 "/liangjian/liyunlong"
 mkdir: 已创建目录 "/liangjian/liyunlong/weiheshang"
 mkdir: 已创建目录 "/liangjian/liyunlong/weiheshang/duanpeng"
  请在/abc下一次创建1000个目录,名字自己拟定。
[root@localhost ~]#cd /
[root@localhost /]#cd abc
[root@localhost abc]#mkdir jhc{1..1000}
[root@localhost abc]#ls
jhc1     jhc168  jhc237  jhc306  jhc376  jhc445  jhc514  jhc584  jhc653  jhc722  jhc792  jhc861  jhc930jhc10    jhc169  jhc238  jhc307  jhc377  jhc446  jhc515  jhc585  jhc654  jhc723  jhc793  jhc862  jhc931jhc100   jhc17   jhc239  jhc308  jhc378  jhc447  jhc516  jhc586  jhc655  jhc724  jhc794  jhc863  jhc932jhc1000  jhc170  jhc24   jhc309  jhc379  jhc448  jhc517  jhc587  jhc656  jhc725  jhc795  jhc864  jhc933jhc101   jhc171  jhc240  jhc31   jhc38   jhc449  jhc518  jhc588  jhc657  jhc726  jhc796  jhc865  jhc934jhc102   jhc172  jhc241  jhc310  jhc380  jhc45   jhc519 ......
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]#pwd/liangjian/liyunlong/weiheshang
[root@localhost weiheshang]#cd ..
[root@localhost liyunlong]#pwd/liangjian/liyunlong
5、请一次删除/abc下一次创建的1000个目录,请在/abc下用touch再创建20个以stu开头的普通可读文档,文档后缀为.txt
[root@localhost /]#rm -rf /abc/jhc{1..1000}
[root@localhost ~]#cd /
[root@localhost /]#cd /abc
[root@localhost abc]#touch stu.txt{1..20}
[root@localhost abc]#ls
stu.txt1   stu.txt12  stu.txt15  stu.txt18  stu.txt20  stu.txt5  stu.txt8stu.txt10  stu.txt13  stu.txt16  stu.txt19  stu.txt3   stu.txt6  stu.txt9stu.txt11  stu.txt14  stu.txt17  stu.txt2   stu.txt4   stu.txt7
6、请用cp命令将/boot/目录下以vmlinuz开头的文件拷贝到/abc下,并以查看他们占磁盘的空间大小。
[root@localhost /]#cp -pv /boot/vmlinuz /abc
[root@localhost ~]#cd /abc
[root@localhost abc]#ls
stu.txt1   stu.txt13  stu.txt17  stu.txt20  stu.txt6  vmlinuz-0-rescue-6e2e1a50f0f14054bc3dbfef60ac5839  stu.txt10  stu.txt14  stu.txt18  stu.txt3   stu.txt7  vmlinuz-3.10.0-229.el7.x86_64 stu.txt11  stu.txt15  stu.txt19  stu.txt4   stu.txt8stu.txt12  stu.txt16  stu.txt2   stu.txt5   stu.txt9
 [root@localhost abc]#du -sh vmlinuz
 4.8M 
 vmlinuz-0-rescue-6e2e1a50f0f14054bc3dbfef60ac58394.8M 
 4.8M
 vmlinuz-3.10.0-229.el7.x86_64
7、将其中一个vmlinuz开头的文件改名为kgc,另外一个剪切到/tmp目录下。
[root@localhost abc]#mv vmlinuz-0-rescue-6e2e1a50f0f14054bc3dbfef60ac5839 kgc
[root@localhost abc]#ls
kgc        stu.txt11  stu.txt14  stu.txt17  stu.txt2   stu.txt4  stu.txt7  vmlinuz-3.10.0-229.el7.x86_64stu.txt1   stu.txt12  stu.txt15  stu.txt18  stu.txt20  stu.txt5  stu.txt8stu.txt10  stu.txt13  stu.txt16  stu.txt19  stu.txt3   stu.txt6  stu.txt9
[root@localhost abc]#mv vmlinuz-3.10.0-229.el7.x86_64 /tmp
[root@localhost abc]#ls
kgc        stu.txt11  stu.txt14  stu.txt17  stu.txt2   stu.txt4  stu.txt7stu.txt1   stu.txt12  stu.txt15  stu.txt18  stu.txt20  stu.txt5  stu.txt8stu.txt10  stu.txt13  stu.txt16  stu.txt19  stu.txt3   stu.txt6  stu.txt9
[root@localhost /]#cd /tmp
[root@localhost tmp]#ls
hsperfdata_root        
systemd-private-q2fIIW 
vmlinuz-3.10.0-229.el7.x86_64ks-script-Sh71U1       
systemd-private-rz9Cua  vmware-rootssh-R7UdyCNlkt4X      
systemd-private-VxU9FO 
yum.logsystemd-private-MfqphL 
systemd-private-YRCaCn 
yum_save_tx.2019-07-23.09-18.ddZD5c.yumtx
8、查看/tmp/目录下以vmlinuz开头文件的详细状态信息。
[root@localhost tmp]#stat /tmp/vmlinuz
文件:"/tmp/vmlinuz-3.10.0-229.el7.x86_64" 
大小:5029136    
块:9824      
IO 块:4096  
普通文件设备:fd00h/64768d Inode:205422604  
硬链接:
1权限:(0755/-rwxr-xr-x) 
Uid:(    0/    root)  
Gid:(    0/    root)
环境:unconfined_u:object_r:default_t:s0
最近访问:2019-07-23 17:06:34.136982659 +0800
最近更改:2015-03-06 19:45:29.000000000 +0800
最近改动:2019-07-24 08:31:50.437234114 +0800
创建时间:-
9、用find命令查找/tmp目录下以vmlinuz开头及大小超过1M的文件
[root@localhost tmp]#find /tmp -size +1M
/tmp/yum_save_tx.2019-07-23.09-18.ddZD5c.yumtx
/tmp/vmlinuz-3.10.0-229.el7.x86_64

原文地址:https://www.cnblogs.com/990114-jhc/p/11254769.html