Linux基本命令(3)
文章目录
1.tar命令:
1.1常用选项:
1.2代码演示:
(1)打包temp/解压temp
[root@iZ2ze8prly56kg8in4hqa2Z learn]# tar -czf temp.tgz temp
[root@iZ2ze8prly56kg8in4hqa2Z learn]# ll
total 16
-rw-r--r-- 1 root root 9901 Dec 13 15:57 dir
drwxr-xr-x 4 root root 26 Dec 13 20:28 mydir
drwxr-xr-x 7 root root 82 Dec 14 20:51 temp
-rw-r--r-- 1 root root 195 Dec 14 20:51 temp.tgz
-rw-r--r-- 1 root root 0 Dec 12 22:06 test.c
[root@iZ2ze8prly56kg8in4hqa2Z /]# mv temp.tgz learn/mydir/
[root@iZ2ze8prly56kg8in4hqa2Z mydir]# tar -xzf temp.tgz
[root@iZ2ze8prly56kg8in4hqa2Z mydir]# ll
total 4
drwxr-xr-x 3 root root 15 Dec 13 20:28 a
drwxr-xr-x 2 root root 20 Dec 12 21:23 dir
drwxr-xr-x 7 root root 82 Dec 14 20:51 temp
-rw-r--r-- 1 root root 195 Dec 14 20:51 temp.tgz
[root@iZ2ze8prly56kg8in4hqa2Z mydir]# tree temp
temp
├── test.c
├── test.cpp
├── test.py
├── test.sh
└── test.txt
5 directories, 0 files
(2)不解压查看压缩包中的东西:
[root@iZ2ze8prly56kg8in4hqa2Z mydir]# tar -ztvf temp.tgz
drwxr-xr-x root/root 0 2022-12-14 20:51 temp/
drwxr-xr-x root/root 0 2022-12-14 20:48 temp/test.c/
drwxr-xr-x root/root 0 2022-12-14 20:48 temp/test.cpp/
drwxr-xr-x root/root 0 2022-12-14 20:48 temp/test.py/
drwxr-xr-x root/root 0 2022-12-14 20:48 temp/test.sh/
drwxr-xr-x root/root 0 2022-12-14 20:51 temp/test.txt/
[root@iZ2ze8prly56kg8in4hqa2Z mydir]# tar -ztf temp.tgz
temp/
temp/test.c/
temp/test.cpp/
temp/test.py/
temp/test.sh/
temp/test.txt/
(3)解包到指定路径:
[root@iZ2ze8prly56kg8in4hqa2Z mydir]# tar xzf temp.tgz -C ../dir
[root@iZ2ze8prly56kg8in4hqa2Z mydir]# ll ../dir
total 0
drwxr-xr-x 7 root root 82 Dec 14 20:51 temp
2.bc命令:
2.1代码演示:
[root@iZ2ze8prly56kg8in4hqa2Z mydir]# bc
bc 1.07.1
Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006, 2008, 2012-2017 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
1+1
2
2+2
4
pi+3
3
3.1232144+4.21312
7.3363344
^C
(interrupt) Exiting bc.
3.uname –r指令:
3.1常用选项:
3.2代码演示:
[root@iZ2ze8prly56kg8in4hqa2Z mydir]# uname -a
Linux iZ2ze8prly56kg8in4hqa2Z 4.18.0-193.14.2.el8_2.x86_64 #1 SMP Sun Jul 26 03:54:29 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
内容含义:
4热键(2):
1.crtl + r
: 搜索之前输入过的命令:
2.⬆ 和 ⬇
: 可以按时间顺序展示之前输入过的命令;
3.输入history
查看全部的历史命令:
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-W86bOF0c-1671030202486)(C:\Users\jason\AppData\Roaming\Typora\typora-user-images\image-20221214220247229.png)]
3.1history > cmd.txt
将历史命令存在cmd.txt中:
5.关机:
5.1常用选项:
6.shell命令以及运行原理
shell是什么:
shell存在的意义:
Windows GUI: