centOS操作指令(一)

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 du
du 是 /usr/bin/du (由此可见此命令du是外部命令)
3、请在/下创建目录abc
[root@localhost ~]# mkdir abc
[root@localhost ~]# ls
222 abc anaconda-ks.cfg test 公共 模板 视频 图片 文档 下载 音乐 桌面
请在/下创建目录/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 /]# ls -a
. 1000liuchao 215liuchao 330liuchao 446liuchao 561liuchao 677liuchao 792liuchao 907liuchao
100liuchao 216liuchao 331liuchao 447liuchao 562liuchao 678liuchao 793liuchao 908liuchao
101liuchao
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]#

5、请一次删除/abc下一次创建的1000个目录,请在/abc下用touch再创建20个以stu开头的普通可读文档,文档后缀为.txt
[root@localhost abc]# rm -rf /{1..1000}liuchao*
[root@localhost abc]# ls
[root@localhost abc]# ls -a
. ..
[root@localhost abc]# touch sut{1..20}.txt
[root@localhost abc]# ls
10.txt 14.txt 18.txt 2.txt 6.txt sut10.txt sut14.txt sut18.txt sut2.txt sut6.txt
11.txt 15.txt 19.txt 3.txt 7.txt sut11.txt sut15.txt sut19.txt sut3.txt sut7.txt
6、请用cp命令将/boot/目录下以vmlinuz开头的文件拷贝到/abc下,并以查看他们占磁盘的空间大小。
[root@localhost /]# cp /boot/vmlinuz* /abc
cp:是否覆盖"/abc/vmlinuz-0-rescue-763c44ac9097424ab7f8faff2fe6db2e"? y
cp:是否覆盖"/abc/vmlinuz-3.10.0-229.el7.x86_64"? y
[root@localhost /]# du -a /abc/vmlinuz*
4912 /abc/vmlinuz-0-rescue-763c44ac9097424ab7f8faff2fe6db2e
4912 /abc/vmlinuz-3.10.0-229.el7.x86_64
7、将其中一个vmlinuz开头的文件改名为kgc,另外一个剪切到/tmp目录下。
[root@localhost /]# mv /abc/vmlinuz-0-rescue-763c44ac9097424ab7f8faff2fe6db2e /abc/kgc
[root@localhost /]# cd /abc
[root@localhost abc]# ls
10.txt 15.txt 1.txt 5.txt kgc sut14.txt sut19.txt sut4.txt sut9.txt
11.txt 16.txt 20.txt 6.txt sut10.txt sut15.txt sut1.txt sut5.txt vmlinuz-3.10.0-229.el7.x86_64
12.txt 17.txt 2.txt 7.txt sut11.txt sut16.txt sut20.txt sut6.txt
13.txt 18.txt 3.txt 8.txt sut12.txt sut17.txt sut2.txt sut7.txt
14.txt 19.txt 4.txt 9.txt sut13.txt sut18.txt sut3.txt sut8.txt
[root@localhost /]# mv /abc/vmlinuz-3.10.0-229.el7.x86_64 /tmp
[root@localhost /]# cd tmp
[root@localhost tmp]# ls
hsperfdata_root systemd-private-eYPxOe yum_save_tx.2019-07-20.08-41.QajCp8.yumtx
ks-script-b74stx systemd-private-jHeSJj yum_save_tx.2019-07-20.10-07.rczs4b.yumtx
ssh-xBaegK2kQjgZ systemd-private-YisXK1 yum_save_tx.2019-07-20.10-42.embE1k.yumtx
systemd-private-2rpu8O vmlinuz-3.10.0-229.el7.x86_64 yum_save_tx.2019-07-22.11-41.OfQUju.yumtx
8、查看/tmp/目录下以vmlinuz开头文件的详细状态信息。
[root@localhost /]# stat /tmp/vmlinuz-3.10.0-229.el7.x86_64
文件:"/tmp/vmlinuz-3.10.0-229.el7.x86_64"
大小:4096 块:8 IO 块:4096 目录
设备:fd00h/64768d Inode:138576247 硬链接:2
权限:(0755/drwxr-xr-x) Uid:( 0/ root) Gid:( 0/ root)
最近访问:2019-07-23 20:22:15.738868707 +0800
最近更改:2019-07-23 20:13:46.209809735 +0800
最近改动:2019-07-23 20:16:05.244298690 +0800
9、用find命令查找/tmp目录下以vmlinuz开头及大小超过1M的文件
[root@localhost /]# find /tmp -size +1M -a -name "vm*"
/tmp/vmlinuz-3.10.0-229.el7.x86_64/vmlinuz-3.10.0-229.el7.x86_64

原文地址:https://www.cnblogs.com/liu1584712/p/11234338.html