国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

[Linux 基礎(chǔ)] linux基礎(chǔ)指令(2)head,tail,Cal,find,grep,zip/unzip,tar,bc,uname

這篇具有很好參考價值的文章主要介紹了[Linux 基礎(chǔ)] linux基礎(chǔ)指令(2)head,tail,Cal,find,grep,zip/unzip,tar,bc,uname。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點擊"舉報違法"按鈕提交疑問。

[Linux 基礎(chǔ)] linux基礎(chǔ)指令(2)head,tail,Cal,find,grep,zip/unzip,tar,bc,uname,Linux,linux


本篇文章接著上一篇基礎(chǔ)指令繼續(xù)講,將一篇文章 點這里跳轉(zhuǎn)

1、head指令

head 與 tail 就像它的名字一樣的淺顯易懂,它是用來顯示開頭或結(jié)尾某個數(shù)量的文字區(qū)塊, head 用來顯示檔案的開頭至標(biāo)準(zhǔn)輸出中,而 tail 想當(dāng)然爾就是看檔案的結(jié)尾。
語法: head [參數(shù)]… [文件]…
功能: head用來顯示檔案的開頭至標(biāo)準(zhǔn)輸出中,默認(rèn)head命令打印其相應(yīng)文件的開頭10行。

選項:
-n<行數(shù)> 顯示的行數(shù)

[root@alicloud ~]# head big.txt 
hello linux, hello 0
hello linux, hello 1
hello linux, hello 2
hello linux, hello 3
hello linux, hello 4
hello linux, hello 5
hello linux, hello 6
hello linux, hello 7
hello linux, hello 8
hello linux, hello 9
[root@alicloud ~]# head -5 big.txt 
hello linux, hello 0
hello linux, hello 1
hello linux, hello 2
hello linux, hello 3
hello linux, hello 4

[Linux 基礎(chǔ)] linux基礎(chǔ)指令(2)head,tail,Cal,find,grep,zip/unzip,tar,bc,uname,Linux,linux

2、tail指令

tail 命令從指定點開始將文件寫到標(biāo)準(zhǔn)輸出.使用tail命令的-f選項可以方便的查閱正在改變的日志文件,tail -f filename會把filename里最尾部的內(nèi)容顯示在屏幕上,并且不但刷新,使你看到最新的文件內(nèi)容。

語法: tail[必要參數(shù)][選擇參數(shù)][文件]
功能: 用于顯示指定文件末尾內(nèi)容,不指定文件時,作為輸入信息進(jìn)行處理。常用查看日志文件。
選項:
-f 循環(huán)讀取
-n<行數(shù)> 顯示行數(shù)

對文件操作的話默認(rèn)打印文本文件的后十行。

[root@alicloud ~]# tail big.txt 
hello linux, hello 991
hello linux, hello 992
hello linux, hello 993
hello linux, hello 994
hello linux, hello 995
hello linux, hello 996
hello linux, hello 997
hello linux, hello 998
hello linux, hello 999
hello linux, hello 1000
[root@alicloud ~]# tail -5 big.txt 
hello linux, hello 996
hello linux, hello 997
hello linux, hello 998
hello linux, hello 999
hello linux, hello 1000

[Linux 基礎(chǔ)] linux基礎(chǔ)指令(2)head,tail,Cal,find,grep,zip/unzip,tar,bc,uname,Linux,linux

引申:如何拿到中間行內(nèi)容

例如:在屏幕打印500~510行的內(nèi)容,怎么操作?

方案一:

我們使用head拿到前510行,重定向到一個臨時文件,再配合使用tail拿到后10行的內(nèi)容,這樣就解決了這個問題,我們來試試。

[root@alicloud ~]# head -510 big.txt > tmp.txt
[root@alicloud ~]# tail -10 tmp.txt 
hello linux, hello 500
hello linux, hello 501
hello linux, hello 502
hello linux, hello 503
hello linux, hello 504
hello linux, hello 505
hello linux, hello 506
hello linux, hello 507
hello linux, hello 508
hello linux, hello 509

[Linux 基礎(chǔ)] linux基礎(chǔ)指令(2)head,tail,Cal,find,grep,zip/unzip,tar,bc,uname,Linux,linux

這里存在一個弊端,這樣的話會創(chuàng)建一個文件,雖然解決了問題,但是有點臃腫, 我們再學(xué)習(xí)一下如果不創(chuàng)建臨時文件直接打印。

方案二:

我們使用head與tail配合,加上管道符 |,就可以實現(xiàn)了。

[root@alicloud ~]# head -510 big.txt | tail -10
hello linux, hello 500
hello linux, hello 501
hello linux, hello 502
hello linux, hello 503
hello linux, hello 504
hello linux, hello 505
hello linux, hello 506
hello linux, hello 507
hello linux, hello 508
hello linux, hello 509

[Linux 基礎(chǔ)] linux基礎(chǔ)指令(2)head,tail,Cal,find,grep,zip/unzip,tar,bc,uname,Linux,linux

我們這里簡單講解一下管道符:
[Linux 基礎(chǔ)] linux基礎(chǔ)指令(2)head,tail,Cal,find,grep,zip/unzip,tar,bc,uname,Linux,linux

方案三:

看到這里,我們還可以將cat、head、tail集聯(lián)起來使用,依舊可以解此問題。

[root@alicloud ~]# clear
[root@alicloud ~]# cat big.txt | head -510 | tail -10
hello linux, hello 500
hello linux, hello 501
hello linux, hello 502
hello linux, hello 503
hello linux, hello 504
hello linux, hello 505
hello linux, hello 506
hello linux, hello 507
hello linux, hello 508
hello linux, hello 509

[Linux 基礎(chǔ)] linux基礎(chǔ)指令(2)head,tail,Cal,find,grep,zip/unzip,tar,bc,uname,Linux,linux

補充指令:

(1) wc -l 文件名

作用: 統(tǒng)計文件行數(shù)的。
[Linux 基礎(chǔ)] linux基礎(chǔ)指令(2)head,tail,Cal,find,grep,zip/unzip,tar,bc,uname,Linux,linux

(2) uniq 文件名

作用: 對相鄰行去重的。

[root@alicloud ~]# cat file.txt 
111111
111111



222222
222222


333333




444444
[root@alicloud ~]# uniq file.txt 
111111

222222

333333

444444

[Linux 基礎(chǔ)] linux基礎(chǔ)指令(2)head,tail,Cal,find,grep,zip/unzip,tar,bc,uname,Linux,linux

(3) sort 文件名

作用: 對文件進(jìn)行排序的。

[root@alicloud ~]# sort file.txt 









111111
111111
222222
222222
333333
444444
[root@alicloud ~]# sort file.txt | uniq

111111
222222
333333
444444

[Linux 基礎(chǔ)] linux基礎(chǔ)指令(2)head,tail,Cal,find,grep,zip/unzip,tar,bc,uname,Linux,linux
這就是排序文件內(nèi)容,我們還可以配合排序后的去重使用。

3、時間相關(guān)的指令

date顯示
date 指定格式顯示時間: date +%Y:%m:%d
date 用法: date [OPTION]… [+FORMAT]
1.在顯示方面,使用者可以設(shè)定欲顯示的格式,格式設(shè)定為一個加號后接數(shù)個標(biāo)記,其中常用的標(biāo)記列表如下
%H : 小時(00…23)
%M : 分鐘(00…59)
%S : 秒(00…61)
%X : 相當(dāng)于 %H:%M:%S
%d : 日 (01…31)
%m :月份 (01…12)
%Y : 完整年份 (0000…9999)
%F : 相當(dāng)于 %Y-%m-%d
2.在設(shè)定時間方面
date -s //設(shè)置當(dāng)前時間,只有root權(quán)限才能設(shè)置,其他只能查看。
date -s 20080523 //設(shè)置成20080523,這樣會把具體時間設(shè)置成空00:00:00
date -s 01:01:01 //設(shè)置具體時間,不會對日期做更改
date -s “01:01:01 2008-05-23″ //這樣可以設(shè)置全部時間
date -s “01:01:01 20080523″//這樣可以設(shè)置全部時間
date -s “2008-05-23 01:01:01″ //這樣可以設(shè)置全部時間
date -s “20080523 01:01:01″ //這樣可以設(shè)置全部時間
3.時間戳
時間->時間戳: date +%s
時間戳->時間: date -d@1508749502
Unix時間戳(英文為Unix epoch, Unix time, POSIX time 或 Unix timestamp)是從1970年1月1日(UTC/GMT的午夜)開始所經(jīng)過的秒數(shù),不考慮閏秒。

當(dāng)我們想要獲取當(dāng)天的時間的話,我們可以執(zhí)行下面的指令:

[root@alicloud ~]# date +%Y-%m-%d
2023-09-18
[root@alicloud ~]# date +%Y-%m-%d_%H:%M:%S
2023-09-18_19:48:31

[Linux 基礎(chǔ)] linux基礎(chǔ)指令(2)head,tail,Cal,find,grep,zip/unzip,tar,bc,uname,Linux,linux

獲取時間戳:

[root@alicloud ~]# date +%s
1695037872

[Linux 基礎(chǔ)] linux基礎(chǔ)指令(2)head,tail,Cal,find,grep,zip/unzip,tar,bc,uname,Linux,linux

它是一個累計的秒數(shù),從1970年1月1日0點0時0秒,到此時刻的一個累計秒數(shù),是線性增長的,每一刻都是唯一的,可用來標(biāo)記一些東西。
時間戳轉(zhuǎn)為年月日時分秒:

[root@alicloud ~]# date -d@1695037872
Mon Sep 18 19:51:12 CST 2023
[root@alicloud ~]# date +%Y-%m-%d_%H:%M:%S -d@1695037872
2023-09-18_19:51:12

[Linux 基礎(chǔ)] linux基礎(chǔ)指令(2)head,tail,Cal,find,grep,zip/unzip,tar,bc,uname,Linux,linux

4、Cal指令

cal命令可以用來顯示公歷(陽歷)日歷。公歷是現(xiàn)在國際通用的歷法,又稱格列歷,通稱陽歷。
“陽歷”又名“太陽歷”,系以地球繞行太陽一周為一年,為西方各國所通用,故又名“西歷”。
命令格式: cal [參數(shù)][月份][年份]
功能: 用于查看日歷等時間信息,如只有一個參數(shù),則表示年份(1-9999),如有兩個參數(shù),則表示月份和年份
常用選項:
-3 顯示系統(tǒng)前一個月,當(dāng)前月,下一個月的月歷
-j 顯示在當(dāng)年中的第幾天(一年日期按天算,從1月1號算起,默認(rèn)顯示當(dāng)前月在一年中的天數(shù))
-y 顯示當(dāng)前年份的日歷

cal的使用很簡單,我們來看看
[Linux 基礎(chǔ)] linux基礎(chǔ)指令(2)head,tail,Cal,find,grep,zip/unzip,tar,bc,uname,Linux,linux
[Linux 基礎(chǔ)] linux基礎(chǔ)指令(2)head,tail,Cal,find,grep,zip/unzip,tar,bc,uname,Linux,linux
[Linux 基礎(chǔ)] linux基礎(chǔ)指令(2)head,tail,Cal,find,grep,zip/unzip,tar,bc,uname,Linux,linux

5、find指令:(灰常重要) -name

Linux下find命令在目錄結(jié)構(gòu)中搜索文件,并執(zhí)行指定的操作。
Linux下find命令提供了相當(dāng)多的查找條件,功能很強大。由于find具有強大的功能,所以它的選項也很多,其中大部分選項都值得我們花時間來了解一下。
即使系統(tǒng)中含有網(wǎng)絡(luò)文件系統(tǒng)( NFS),find命令在該文件系統(tǒng)中同樣有效,只你具有相應(yīng)的權(quán)限。在運行一個非常消耗資源的find命令時,很多人都傾向于把它放在后臺執(zhí)行,因為遍歷一個大的文件系統(tǒng)可能會花費很長的時間(這里是指30G字節(jié)以上的文件系統(tǒng))。
語法: find pathname -options
功能:用于在文件樹種查找文件,并作出相應(yīng)的處理(可能訪問磁盤)
常用選項:
-name 按照文件名查找文件

在某個目錄下,按照名字查找我們來句下面的例子。

[root@alicloud ~]# find /root/ -name file.txt
/root/file.txt

[Linux 基礎(chǔ)] linux基礎(chǔ)指令(2)head,tail,Cal,find,grep,zip/unzip,tar,bc,uname,Linux,linux

補充:which、ctrl+r

可以查看系統(tǒng)命令存放在哪里,按照絕對路徑顯示出來。

[root@alicloud ~]# which ls
alias ls='ls --color=auto'
	/bin/ls
[root@alicloud ~]# which ll
alias ll='ls -l --color=auto'
	/bin/ls
[root@alicloud ~]# which which
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
	/bin/alias
	/usr/bin/which

[Linux 基礎(chǔ)] linux基礎(chǔ)指令(2)head,tail,Cal,find,grep,zip/unzip,tar,bc,uname,Linux,linux
ctrl+r,可以根據(jù)之前的指令片段搜索到指令。
[Linux 基礎(chǔ)] linux基礎(chǔ)指令(2)head,tail,Cal,find,grep,zip/unzip,tar,bc,uname,Linux,linux

6、grep指令

語法: grep [選項] 搜尋字符串 文件
功能: 在文件中搜索字符串,將找到的行打印出來
常用選項:
-i :忽略大小寫的不同,所以大小寫視為相同
-n :順便輸出行號
-v :反向選擇,亦即顯示出沒有 ‘搜尋字符串’ 內(nèi)容的那一行

grep是行過濾工具指令。

[root@alicloud ~]# grep '99' big.txt

[Linux 基礎(chǔ)] linux基礎(chǔ)指令(2)head,tail,Cal,find,grep,zip/unzip,tar,bc,uname,Linux,linux

[root@alicloud ~]# grep 'main' -n mytest.c 

[Linux 基礎(chǔ)] linux基礎(chǔ)指令(2)head,tail,Cal,find,grep,zip/unzip,tar,bc,uname,Linux,linux

也可以在兩個文件里面一塊查找

[root@alicloud ~]# grep -n 'main' mytest.c newfile.txt

[Linux 基礎(chǔ)] linux基礎(chǔ)指令(2)head,tail,Cal,find,grep,zip/unzip,tar,bc,uname,Linux,linux

它也可以把指令輸出的結(jié)果作為管道的輸入源,以行為單位來進(jìn)行過濾
舉例:

[root@alicloud ~]# ps ajx | grep sshd

[Linux 基礎(chǔ)] linux基礎(chǔ)指令(2)head,tail,Cal,find,grep,zip/unzip,tar,bc,uname,Linux,linux

對于-i與-v選項,-i是忽略大小寫來查找,-v是把含有目標(biāo)的行過濾掉并且不打印,兩個選項可以一起使用,我們來看看:

[root@alicloud ~]# grep -vi 'lcx' newfile.txt 

[Linux 基礎(chǔ)] linux基礎(chǔ)指令(2)head,tail,Cal,find,grep,zip/unzip,tar,bc,uname,Linux,linux

7、zip/unzip指令

語法: zip 壓縮文件.zip 目錄或文件
功能: 將目錄或文件壓縮成zip格式
常用選項:
-r 遞歸處理,將指定目錄下的所有文件和子目錄一并處理

這里我們將所在目錄下的所有文件都打包壓縮一下,并且再解包解壓縮到指定目錄。

打包壓縮:zip -r name.zip dir/file //打包壓縮一個目錄下的所有文件/一個文件
解包解壓縮:unzip name.zip -d dir//解包解壓縮到指定目錄dir

(1)先打包現(xiàn)在目錄下的所有

[root@alicloud lesson2]# zip test.zip ./*

[Linux 基礎(chǔ)] linux基礎(chǔ)指令(2)head,tail,Cal,find,grep,zip/unzip,tar,bc,uname,Linux,linux

(2)將打包壓縮的文件移動到上級目錄

[root@alicloud lesson2]# mv test.zip ../

[Linux 基礎(chǔ)] linux基礎(chǔ)指令(2)head,tail,Cal,find,grep,zip/unzip,tar,bc,uname,Linux,linux

(3)解壓縮test.zip

[root@alicloud ~]# unzip test.zip 

[Linux 基礎(chǔ)] linux基礎(chǔ)指令(2)head,tail,Cal,find,grep,zip/unzip,tar,bc,uname,Linux,linux
我們再看看dir1里面有內(nèi)容沒有:
[Linux 基礎(chǔ)] linux基礎(chǔ)指令(2)head,tail,Cal,find,grep,zip/unzip,tar,bc,uname,Linux,linux
這里顯示是沒有任何文件或目錄的,這是因為我們在壓縮的時候沒有加-r選項,打包壓縮沒有遞歸打包壓縮,所以dir1里面的內(nèi)容就沒有被打包壓縮,我們試試加上-r選項。
[Linux 基礎(chǔ)] linux基礎(chǔ)指令(2)head,tail,Cal,find,grep,zip/unzip,tar,bc,uname,Linux,linux
這次我們的解壓縮后的dir1目錄里面就有了文件,因此在打包壓縮一個目錄下所有時,這個目錄下有子目錄,我們在打包的時候一定要加-r選項,不然子目錄的文件就沒有被打包壓縮,是不完整的。
這上面的解壓縮操作中,我們先把壓縮的文件移到上級目錄中,再去解壓縮,這樣太過麻煩了,我們在解壓縮的時候可以指定目錄,我們來看一下:
當(dāng)前我們在lesson目錄下有一個test.zip壓縮文件,我們想將它解包解壓縮到上級目錄下,就可以這樣操作

[root@alicloud lesson2]# unzip test.zip -d ../

[Linux 基礎(chǔ)] linux基礎(chǔ)指令(2)head,tail,Cal,find,grep,zip/unzip,tar,bc,uname,Linux,linux
當(dāng)解包解壓縮到指定目錄的時候要加上-d選項。

8、tar指令(重要):打包/解包,不打開它,直接看內(nèi)容

tar [-cxtzjvf] 文件與目錄 …參數(shù):
-c :建立一個壓縮文件的參數(shù)指令(create 的意思);
-x :解開一個壓縮文件的參數(shù)指令!
-t :查看 tarfile 里面的文件!
-z :是否同時具有 gzip 的屬性?亦即是否需要用 gzip 壓縮?
-j :是否同時具有 bzip2 的屬性?亦即是否需要用 bzip2 壓縮?
-v :壓縮的過程中顯示文件!這個常用,但不建議用在背景執(zhí)行過程!
-f :使用檔名,請留意,在 f 之后要立即接檔名喔!不要再加參數(shù)!
-C : 解壓到指定目錄

最常用的就是打包壓縮和解包解壓縮了,這里我們列出來兩個指令:

tar -czf test.tar.gz 目錄/文件 //打包或壓縮一個目錄/文件,以.tar.gz為后綴的壓縮文件
    						  //也可以寫作.ta.gz
tar -xzf test.tar.gz -C 目錄/文件 //這里解壓到指定目錄的時候需要加上-C選項,默認(rèn)為當(dāng)前目錄

下面我們使用一下打包壓縮與解包解壓縮指令:
這里壓縮文件的后綴可以是 .tar.gz 或者 .tgz,兩種形式都可以,我們這里就使用tgz來講。
打包壓縮當(dāng)前目錄的所有:

[root@alicloud lesson2]# tar -zcf test.tgz ./*

[Linux 基礎(chǔ)] linux基礎(chǔ)指令(2)head,tail,Cal,find,grep,zip/unzip,tar,bc,uname,Linux,linux
解包解壓縮到指定目錄:

[root@alicloud lesson2]# tar -xzf test.tgz -C ../

[Linux 基礎(chǔ)] linux基礎(chǔ)指令(2)head,tail,Cal,find,grep,zip/unzip,tar,bc,uname,Linux,linux
其他的選項大家看上面列出的就可以了。

9、bc指令

bc命令可以很方便的進(jìn)行浮點運算,當(dāng)輸入bc的時候進(jìn)入linux的一個簡單的計算器。
[Linux 基礎(chǔ)] linux基礎(chǔ)指令(2)head,tail,Cal,find,grep,zip/unzip,tar,bc,uname,Linux,linux
很簡單,就不多講了。

10、uname指令

語法: uname [選項]
功能: uname用來獲取電腦和操作系統(tǒng)的相關(guān)信息。
補充說明: uname可顯示linux主機(jī)所用的操作系統(tǒng)的版本、硬件的名稱等基本信息。
常用選項:
-a或–all 詳細(xì)輸出所有信息,依次為內(nèi)核名稱,主機(jī)名,內(nèi)核版本號,內(nèi)核版本,硬件名,處理器類 型,硬件平臺類型,操作系統(tǒng)名稱

uname -r/-a可以在linux操作系統(tǒng)下查看計算機(jī)的體系結(jié)構(gòu)。
[Linux 基礎(chǔ)] linux基礎(chǔ)指令(2)head,tail,Cal,find,grep,zip/unzip,tar,bc,uname,Linux,linux
[Linux 基礎(chǔ)] linux基礎(chǔ)指令(2)head,tail,Cal,find,grep,zip/unzip,tar,bc,uname,Linux,linux文章來源地址http://www.zghlxwxcb.cn/news/detail-721311.html

到了這里,關(guān)于[Linux 基礎(chǔ)] linux基礎(chǔ)指令(2)head,tail,Cal,find,grep,zip/unzip,tar,bc,uname的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實不符,請點擊違法舉報進(jìn)行投訴反饋,一經(jīng)查實,立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費用

相關(guān)文章

  • Linux tail & cat & grep 命令詳解

    在屏幕上顯示指定文件的末尾若干行 tail命令 用于輸入文件中的尾部內(nèi)容。 默認(rèn)在屏幕上顯示指定文件的末尾10行。 處理多個文件時會在各個文件之前附加含有文件名的行。 如果沒有指定文件或者文件名為 - ,則讀取標(biāo)準(zhǔn)輸入。 如果表示字節(jié)或行數(shù)的 NUM 值之前有一個 + 號

    2024年02月06日
    瀏覽(21)
  • Linux 終端命令之文件瀏覽(4) head, tail

    Linux 終端命令之文件瀏覽(4) head, tail

    cat, more, less, head, tail,此五個文件瀏覽類的命令皆為外部命令。 英文幫助 NAME ? ? ? ?head - output the first part of files SYNOPSIS ? ? ? ?head [OPTION]... [FILE]... DESCRIPTION ? ? ? ?Print the first 10 lines of each FILE to standard output. ?With more than one FILE, precede each with a header giving the file name. ? ?

    2024年02月11日
    瀏覽(17)
  • Linux文本處理(cat、more、head、less、tail)

    可以用來顯示文本文件的內(nèi)容(類似于 DOS 下的 type 命令),也可以把幾個文件內(nèi)容附加到另一個文件中,即連接合并文件。 cat 命令的基本格式如下: [root@localhost ~]# cat [選項] 文件名 或者 [root@localhost ~]# cat 文件1 文件2 文件3? ?這兩種格式中,前者用于顯示文件的內(nèi)容,常

    2024年02月15日
    瀏覽(19)
  • 【Linux】:文件查看 stat、cat、more、less、head、tail、uniq、wc

    【Linux】:文件查看 stat、cat、more、less、head、tail、uniq、wc

    ?? 嶼小夏 : 個人主頁 ??個人專欄 : Linux深造日志 ?? 莫道桑榆晚,為霞尚滿天! 在Linux系統(tǒng)中,文件是信息的核心。深入了解和操作文件內(nèi)容是每個系統(tǒng)管理員和開發(fā)者必備的技能。本文將為您揭開Linux文件魔法的面紗,介紹一系列強大的命令,包括stat、cat、more、less、

    2024年04月28日
    瀏覽(23)
  • Linux下查找文件(find、grep命令)

    Linux下查找文件(find、grep命令)

    目錄 一、find命令 1.按文件名 2.按文件類型查詢 3.按照文件大小查找 4.按照文件日期查找 4.1按照創(chuàng)建日期查找 4.2按照修改日期查找 4.3按照訪問日期查找 5.按深度查找 5.1查找起始點以下n層的目錄,不超過n層 ?5.2搜距離起始點n層以下的目錄(即最少n層) 6.高級查找 6.1-exec ?

    2024年01月16日
    瀏覽(721)
  • linux find rm grep 搭配使用

    find /home -name \\\"*.log\\\" | xargs rm -f find /opt/tomcat/logs -name \\\"*cloud*\\\" | grep ali | xargs rm -f linux 下用find命令查找文件,rm命令刪除文件。 刪除指定目錄下指定文件 find 要查找的目錄名? -name .svn |xargs rm -rf 刪除指定名稱的文件或文件夾:? find -type d | grep .svn$ | xargs rm -r 分析: find -type d | g

    2024年02月07日
    瀏覽(16)
  • 一分鐘學(xué)一個 Linux 命令 - find 和 grep

    大家好,我是 god23bin。歡迎來到《 一分鐘學(xué)一個 Linux 命令 》系列, 每天只需一分鐘,記住一個 Linux 命令不成問題 。今天需要你花兩分鐘時間來學(xué)習(xí)下,因為今天要介紹的是兩個常用的搜索命令: find 和 grep 命令。 find 命令用于在指定的目錄下搜索文件和目錄。它提供了豐

    2024年02月08日
    瀏覽(87)
  • Linux 搜索文件中find和grep命令的區(qū)別

    在使用linux時,經(jīng)常需要進(jìn)行文件查找。其中查找的命令主要有find和grep。兩個命令是有區(qū)的。 (1)find命令是根據(jù)文件的屬性進(jìn)行查找,如文件名,文件大小,所有者,所屬組,是否為空,訪問時間,修改時間等。 (2)grep是根據(jù)文件的內(nèi)容進(jìn)行查找,會對文件的每一行按照給定

    2024年02月16日
    瀏覽(234)
  • [Linux初階]which-find-grep-wc-管道符命令

    [Linux初階]which-find-grep-wc-管道符命令

    目錄 一.which ?二.find? a.-name b.-size? 三.grep? 四.wc? 五.管道符(|) 五.總結(jié) 語法格式: which [命令] Linux中的一個個命令, 本體上就是一個個的二進(jìn)制可執(zhí)行程序 (相當(dāng)于windows中的 .exe 文件). ? 在Linux中,一切皆文件. ?which命令:用于查看指定命令的可執(zhí)行程序在文件中的位置.( 在/e

    2024年03月26日
    瀏覽(96)
  • 【Linux指令集】---zip指令(超詳細(xì))

    【Linux指令集】---zip指令(超詳細(xì))

    個人主頁:平行線也會相交 歡迎 點贊?? 收藏? 留言? 加關(guān)注??本文由 平行線也會相交 原創(chuàng) 收錄于專欄【Linux專欄】?? 本專欄旨在分享學(xué)習(xí)Linux的一點學(xué)習(xí)心得,歡迎大家在評論區(qū)討論?? 演示環(huán)境: centos7 zip 指令用于在Linux系統(tǒng)上 創(chuàng)建和管理ZIP壓縮文件 。 命令格式

    2024年02月16日
    瀏覽(22)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包