搜索查找
- find
從指定目錄向下遞歸地遍歷其各個子目錄,將滿足條件的文件或目錄顯示在終端。
find /home -name hello.log
----------------------------
-name # 按照指定文件名查找模式查找文件
-user 用戶名 # 查找屬于指定用戶名的所有文件
-size 大小 # 按照指定文件大小查找文件
+n 大于n
-n 小于n
n 等于n
find / -size +200M # 查找大于200M的文件
----------------------------
- locate
快速定位文件的路徑。
查詢是通過遍歷數據庫進行查找的,因此,在執行該命令之前需要更新locate的數據庫。
即:updatedb
命令。
updatedb
locate temp.log
-----------------------------
[admin@centos7 ~]$ sudo updatedb
[admin@centos7 ~]$ locate temp.txt
/home/admin/temp.txt
[admin@centos7 ~]$
-----------------------------
- which
可以檢索或查看某指令所在目錄。
which ls
------------------------------
[admin@centos7 ~]$ which ls
alias ls='ls --color=auto'
/usr/bin/ls
[admin@centos7 ~]$
------------------------------
- grep
grep
過濾查找,通常與管道符'|'結合使用,表示將前一個命令的輸出傳遞給后面的命令作輸入。
grep [選項] 查找內容 源文件
-------------------------------
-n # 顯示匹配行及行號
-i # 忽略字母大小寫
-------------------------------
[admin@centos7 ~]$ cat /etc/profile | grep -n 'etc'
1:# /etc/profile
4:# Functions and aliases go in /etc/bashrc
8:# /etc/profile.d/ to make custom changes to your environment, as this
65:for i in /etc/profile.d/*.sh /etc/profile.d/sh.local ; do
[admin@centos7 ~]$
-------------------------------
[admin@centos7 ~]$ grep -n 'etc' /etc/profile
1:# /etc/profile
4:# Functions and aliases go in /etc/bashrc
8:# /etc/profile.d/ to make custom changes to your environment, as this
65:for i in /etc/profile.d/*.sh /etc/profile.d/sh.local ; do
[admin@centos7 ~]$
壓縮和解壓
gzip和gunzip
gzip
用于壓縮文件,gunzip
用于解壓縮文件。
# 壓縮文件,只能將文件壓縮為*.gz格式
gzip 文件
---------------------------------
# 解壓縮文件
gunzip 文件.gz
---------------------------------
[admin@centos7 ~]$ gzip /home/admin/temp.txt
[admin@centos7 ~]$ ls -lh
總用量 4.0K
drwxrwxr-x. 2 admin admin 6 4月 5 10:36 Downloads
-rw-rw-r--. 1 admin admin 30 4月 8 11:35 temp.txt.gz
[admin@centos7 ~]$ gunzip temp.txt.gz
[admin@centos7 ~]$ ls -lh
總用量 4.0K
drwxrwxr-x. 2 admin admin 6 4月 5 10:36 Downloads
-rw-rw-r--. 1 admin admin 1 4月 8 11:35 temp.txt
[admin@centos7 ~]$
zip和unzip
zip
用于壓縮文件/目錄,unzip
用于解壓。
zip [選項] XXX # 壓縮
unzip [選項] XXX # 解壓
-----------------------------
-r:遞歸壓縮,即壓縮目錄
-d <目錄>:指定解壓后的文件存放目錄
-----------------------------
tar
tar
指令是打包指令,最后打包的文件格式為.tar.gz的文件。
# 打包目錄,壓縮后的文件為.tar.gz格式
tar [選項] XXX.tar.gz 打包的內容
------------------------------------
-c 產生.tar打包文件
-v 顯示詳細的打包過程
-f 指定壓縮后的文件名稱
-z 打包同時壓縮
-x 解包、解壓縮tar文件
-C 指定解壓后的文件存儲目錄
------------------------------------
# 打包 tar zcvf 打包后的文件名 待壓縮文件
[admin@centos7 ~]$ tar zcvf temp.tar.gz temp.txt temp2.txt
temp.txt
temp2.txt
[admin@centos7 ~]$ ls -l
總用量 8
drwxrwxr-x. 2 admin admin 6 4月 5 10:36 Downloads
-rw-rw-r--. 1 admin admin 0 4月 8 15:30 temp2.txt
-rw-rw-r--. 1 admin admin 147 4月 8 15:32 temp.tar.gz
-rw-rw-r--. 1 admin admin 1 4月 8 11:35 temp.txt
[admin@centos7 ~]$
--------------------------------------
# 解包 tar zxvf 文件
[admin@centos7 ~]$ tar zxvf temp.tar.gz
temp.txt
temp2.txt
[admin@centos7 ~]$ ls -l
總用量 8
drwxrwxr-x. 2 admin admin 6 4月 5 10:36 Downloads
-rw-rw-r--. 1 admin admin 0 4月 8 15:30 temp2.txt
-rw-rw-r--. 1 admin admin 147 4月 8 15:32 temp.tar.gz
-rw-rw-r--. 1 admin admin 1 4月 8 11:35 temp.txt
[admin@centos7 ~]$
聲明:本文內容及配圖由入駐作者撰寫或者入駐合作網站授權轉載。文章觀點僅代表作者本人,不代表電子發燒友網立場。文章及其配圖僅供工程師學習之用,如有內容侵權或者其他違規問題,請聯系本站處理。
舉報投訴
-
Linux
+關注
關注
87文章
11432瀏覽量
212474 -
指令
+關注
關注
1文章
614瀏覽量
36161 -
Find
+關注
關注
0文章
55瀏覽量
11788 -
文件
+關注
關注
1文章
577瀏覽量
25149 -
命令
+關注
關注
5文章
724瀏覽量
22643
發布評論請先 登錄
相關推薦
熱點推薦
Linux中常用的壓縮和解壓縮命令介紹
在Linux中,壓縮和解壓縮文件是常見的操作。有時候,我們需要將大文件壓縮成較小的文件,以便于傳輸和存儲。同時,我們也需要解壓縮文件來獲得原
發表于 07-31 11:50
?2376次閱讀
A u率壓縮解壓縮
A u率壓縮解壓縮# # A率/u率 壓縮與解壓縮的IP核,。# 由AHDL語言寫成,可在MaxplusII和QuartusII中使用,源代碼加密。## 使用方法# 1.將以下FEAT
發表于 08-10 18:12
[轉載]linux 解壓縮命令大全
[轉載]linux 解壓縮命令大全感謝lemaker Andy不在為記不住linux命令而苦惱,給上連接:http://www.cnblog
發表于 08-09 20:51
基于FPGA的高性能無損數據解壓縮IP
)的LZO IP 對外接口:1.標準的AXI4-Stream數據總線 性能指標:1.4.8Gbps解壓縮速率@300MHz內核時鐘 資源使用(XCKU115為例,32KB搜索窗口大小):1.LUTs
發表于 12-21 23:12
Ubuntu壓縮與解壓縮的相關資料分享
常常見的操作,在 Windows 下我們有很多壓縮和解壓縮的工具,比如 zip、360 壓縮等等。在 Ubuntu 下也有壓縮工具,我們學習 Ubuntu 下圖形化以及
發表于 02-11 06:48
VRV解壓縮軟件
VRV解壓縮軟件:VRV解壓縮軟件WinRAR is a powerful archiver. It provides complete support of RAR and ZIP files unpacking of ARJ CAB LZH ACE
發表于 03-15 12:32
?39次下載
Samplify推出新版Prism 壓縮/解壓縮技術
Samplify推出新版Prism 壓縮/解壓縮技術
? 賽靈思聯盟合作伙伴,混合信號半導體和 IP 信號壓縮廠商 Samplify Systems 公司現已推出面向 FPGA 實施的 Prism
發表于 02-08 10:12
?676次閱讀
第1期Ubuntu入門篇:【10】Ubuntu下壓縮與解壓縮
常常見的操作,在 Windows 下我們有很多壓縮和解壓縮的工具,比如 zip、360 壓縮等等。在 Ubuntu 下也有壓縮工具,我們學習 Ubuntu 下圖形化以及
發表于 12-07 18:06
?13次下載

高性能無損數據解壓縮FPGA IP,LZO無損數據解壓縮IP
LZOAccel-D是一個無損數據解壓縮引擎的FPGA硬件實現,兼容LZO 2.10標準。
Core接收壓縮的輸入數據塊,產生解壓縮后的數據塊。Core分析數據塊的頭和尾,檢查輸入數據塊的錯誤

如何使用gzip壓縮和解壓縮技術
Nginx是一款高性能的Web服務器,它也能夠充當反向代理服務器和負載均衡器。在Web應用開發中,優化網站速度是一個非常重要的工作。使用gzip壓縮和解壓縮技術,可以有效減小傳輸文件的大小,提升網站的訪問速度。
評論