LINUX02_概述、文件系统详解、vim、cd、ls、mkdir、touch、rm、cp、less、tail、head、find、locate、打包或解压tar(八)

简介: LINUX02_概述、文件系统详解、vim、cd、ls、mkdir、touch、rm、cp、less、tail、head、find、locate、打包或解压tar(八)

⑩②. 打包或解压tar 重点


  • ①. 打包为 tar 格式的文件:


  [root@localhost home]# tar -cvf hello.tar hello hello-hard hello-soft 
  hello
  hello-hard
  hello-soft
  [root@localhost home]# ls
  hello  hello-hard  hello-soft  hello.tar  test  test-soft
  [root@localhost home]# 


②. 压缩为 tar.gz 格式的文件:


  [root@localhost home]# tar -zcvf test.tar.gz test test-soft
  test/
  test-soft
  [root@localhost home]# ls
  hello  hello-hard  hello-soft  hello.tar  test  test-soft  test.tar.gz
  [root@localhost home]# 


③. 解打包 tar 格式的文件:


  [root@localhost home]# tar -xvf hello.tar 
  hello
  hello-hard
  hello-soft
  [root@localhost home]# ls
  hello  hello-hard  hello-soft  hello.tar  test.tar.gz
  [root@localhost home]# 


④. 解压缩 tar.gz 格式的文件:



  [root@localhost home]# tar -zxvf test.tar.gz 
   test/
   test-soft
   [root@localhost home]# ls
   hello  hello-hard  hello-soft  hello.tar  test  test-soft  test.tar.gz
   [root@localhost home]# 


微信图片_20220108193023.png


⑩③. 软链接 (快捷方式)


  • ①. 也成为符号链接,类似于windows里的快捷方式,有自己的数据块,主要存放了链接其他文件的路径
  • ②. 命令 ln –s 原文件或目录名 软链接名
  • ③. 查询:通过 ls -l 就可以查看,列表属性第1位是l,尾部会有位置指向


[root@izuf6ge69gbpc9ab8f8dvfz /]# ln -s /opt myOpt
[root@izuf6ge69gbpc9ab8f8dvfz /]# ll
total 68
lrwxrwxrwx.  1 root root     7 Aug 18  2017 bin -> usr/bin
dr-xr-xr-x.  4 root root  4096 Sep 12  2017 boot
drwxr-xr-x  19 root root  2960 Jul 22 20:30 dev
drwxr-xr-x. 83 root root 12288 Jul 23 00:47 etc
drwxr-xr-x.  4 root root  4096 May 30 09:54 home
lrwxrwxrwx.  1 root root     7 Aug 18  2017 lib -> usr/lib
lrwxrwxrwx.  1 root root     9 Aug 18  2017 lib64 -> usr/lib64
drwx------.  2 root root 16384 Aug 18  2017 lost+found
drwxr-xr-x.  2 root root  4096 Nov  5  2016 media
drwxr-xr-x.  2 root root  4096 Nov  5  2016 mnt
lrwxrwxrwx   1 root root     4 Jul 23 10:36 myOpt -> /opt
drwxr-xr-x.  2 root root  4096 Nov  5  2016 opt
dr-xr-xr-x  78 root root     0 Jul 22 20:30 proc
dr-xr-x---. 10 root root  4096 Jul 23 00:46 root
drwxr-xr-x  21 root root   620 Jul 23 00:47 run
lrwxrwxrwx.  1 root root     8 Aug 18  2017 sbin -> usr/sbin
drwxr-xr-x.  2 root root  4096 Nov  5  2016 srv
dr-xr-xr-x  13 root root     0 Jul 23 04:30 sys
drwxrwxrwt. 10 root root  4096 Jul 23 00:47 tmp
drwxr-xr-x. 14 root root  4096 Jul 22 23:38 usr
drwxr-xr-x. 19 root root  4096 Jul 23 04:30 var
[root@izuf6ge69gbpc9ab8f8dvfz /]# cd myOpt/
[root@izuf6ge69gbpc9ab8f8dvfz myOpt]# ll
total 0
[root@izuf6ge69gbpc9ab8f8dvfz myOpt]# cd /opt
total 0
相关文章
|
9天前
|
Linux
Linux压缩与解压“助手”
gzip压缩解压 因为都是系统自带的我们不需要安装; ls 看一下目录当前的文件,创建一个 touch 123.txt 文件; 原文件消失,压缩解压 gzip 进行压缩,(“ gzip 123.txt ”),这样就压缩完毕了; gzip 进行解压,(“ gzip -d 123.txt.gz”),这样就解压完毕了; 原文件保留,gzip -k 123.txt、gzip -dk 123.txt.gz ;
25 9
|
7月前
|
Linux
Linux中将文件解压到指定目录
Linux中将文件解压到指定目录
|
6月前
|
存储 监控 安全
在Linux中,⼀个EXT3的文件分区,当使用touch test.file命令创建⼀个新文件时报错,报错的信息是提示磁盘已满,但是采用df -h命令查看磁盘大小时,只使用了,60%的磁盘空间,为什么会出现这个情况?
在Linux中,⼀个EXT3的文件分区,当使用touch test.file命令创建⼀个新文件时报错,报错的信息是提示磁盘已满,但是采用df -h命令查看磁盘大小时,只使用了,60%的磁盘空间,为什么会出现这个情况?
|
3月前
|
监控 Linux 开发者
如何在 Linux 中优雅的使用 head 命令,用来看日志简直溜的不行
`head` 命令是 Linux 系统中一个非常实用的工具,用于快速查看文件的开头部分内容。本文介绍了 `head` 命令的基本用法、高级用法、实际应用案例及注意事项,帮助用户高效处理文件和日志,提升工作效率。
62 7
|
4月前
|
Linux
Linux的cp命令如何使用?
Linux的cp命令如何使用?
124 3
|
5月前
|
Linux
深入理解Linux中的cp命令:文件与目录的复制利器
深入理解Linux中的cp命令:文件与目录的复制利器
|
6月前
|
Linux
【Deepin 20系统】Linux系统批量解压*.gz文件(不是.tar.gz)
在Deepin 20 Linux系统中如何使用命令行批量解压*.gz文件,提供了具体的命令示例,并简要提及了批量解压*.tar.gz和*.tar.bz2文件的方法。
78 2
|
6月前
|
存储 算法 Linux
.bz2是什么格式的文件?Linux如何解压这种类型的文件?
【8月更文挑战第3天】.bz2是什么格式的文件?Linux如何解压这种类型的文件?
459 1
|
6月前
|
数据建模 Linux vr&ar
Linux下解压命令大全
Linux下解压命令大全
80 0
|
6月前
|
Linux
Linux命令行文档查看cat、less、more、head、tail和图片查看
Linux命令行文档查看cat、less、more、head、tail和图片查看
82 0