[root@localhost ~]# rm f1
rm:是否删除普通文件 "f1"?y
[root@localhost ~]# rm -rf q1
[root@localhost etc]# rm -r a
rm:是否进入目录"a"? y
rm:是否进入目录"a/s"? y
rm:是否进入目录"a/s/d"? y
rm:是否进入目录"a/s/d/f"? y
rm:是否删除目录 "a/s/d/f/g"?y
- rm 删除 (remove)
rm 文件 删除文件
rm -rf 删除目录
-r 递归
-f force 强制
rm -rf /
[root@localhost ~]# mv f2 /etc
mv 移动(move)
[root@localhost ~]# clear
[root@localhost ~]# ^C
- clear 清屏
ctrl +l 清屏
- ctrl+c 中断当前命令
[root@localhost ~]# ^C
[root@localhost ~]# uname
Linux
[root@localhost ~]# uname -a
Linux localhost.localdomain 3.10.0-693.el7.x86_64 #1 SMP Tue Aug 22 21:09:27 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost ~]# uname -r
3.10.0-693.el7.x86_64
- uname 查看系统信息 uname (user name)
uname -a 查看系统详细信息
uname -r查看内核版本
[root@localhost ~]# shutdown -r 12:00
Shutdown scheduled for 五 2022-03-25 12:00:00 CST, use 'shutdown -c' to cancel.
[root@localhost ~]# shutdown -h 12:00
Shutdown scheduled for 五 2022-03-25 12:00:00 CST, use 'shutdown -c' to cancel.
- shutdown
关机
shutdown [参数] 时间 [警示信息]
-r reboot 重启
-h halt 关机
now 立即关机
hh:mm 小时:分钟
+m 在多少分钟之后关机
poweroff
shutdown -h now
没有警示信息
reboot
shutdown -r now
没有警示信息
halt
需要手动关闭电源
[root@localhost ~]# history
[root@localhost ~]# !72
ls
anaconda-ks.cfg f3 initial-setup-ks.cfg nginx-1.8.1-1.el7.ngx.x86_64.rpm q2
- history
列出使用过的命令
!1
!2
!3
重复利用1,2,3条命令
[root@localhost ~]# man
您需要什么手册页?
[root@localhost ~]# man ls
- man
man ls
查看ls命令的使用方法或帮助信息
man ls 等价于 ls --help
[root@localhost ~]# echo klq
klq
[root@localhost ~]# KLQ=klq
[root@localhost ~]# echo $KLQ
klq
- echo
echo xxxxxxxx 等价于 echo “xxxxxxx” 等价于 echo ‘xxxxx’
echo $SHELL
echo $etc etc是目录
[root@localhost ~]# dd if=/dev/zero of=test.txt bs=100M count=8
记录了8+0 的读入
记录了8+0 的写出
838860800字节(839 MB)已复制,6.92818 秒,121 MB/秒
[root@localhost ~]# zip test.zip test.txt
adding: test.txt (deflated 100%)
[root@localhost ~]# unzip test.zip -d /tmp/
Archive: test.zip
inflating: /tmp/test.txt
[root@localhost ~]# tar -zcf test.tar test.txt
[root@localhost ~]# tar -xzf test.tar
- zip文件压缩
zip test.zip test.txt
zip 压缩后的文件名 要压缩的文件
zip文件解压缩
unzip test.zip -d /tmp/
unzip 要解压的文件名 -d 指定解压路径
tar压缩与解压缩
-c 建立一个压缩文件
-x 解开一个压缩文件
-t 查看tar压缩文件里面的文件
以上三个参数不能同时使用,只能存在一个
-z 使用gzip压缩
-j 使用bzip2压缩
-v 压缩过程中显示文件*(常用)但不建议用在背景执行过程!
-f使用档名,注意:f之后要立即接档名,不能再接参数
eg:tar -zcvfP tfile sfile 这样写是不正确的
eg:tar -zcvPf tfile sfile 这样是正确的以上是tar常用的参数
-P 可以使用绝对路径进行压缩
-p 使用原文件的原属性(属性不会根据使用者而改变)
-N 后面接的是日期,比(yyyy/mm/dd)次日期之后还要新的文件才会被打包
eg:tar -zcvf test.tar /etc
eg:tar -cvf test.tar /etc 仅打包,不压缩
eg:tar -xvf test.tar
tar [参数] 文件与目录... ...
注意:打包只是把文件进行归档,打包文件体积大小不变
打包可以理解为把衣服放进压缩袋里面,压缩则是将里面的空气抽空
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)