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

快速上手Linux核心命令(九):文件備份與壓縮

這篇具有很好參考價值的文章主要介紹了快速上手Linux核心命令(九):文件備份與壓縮。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點擊"舉報違法"按鈕提交疑問。

目錄
  • tar 打包備份
  • gzip 壓縮或解壓文件
  • zip 打包和壓縮文件
  • unzip 解壓zip文件
  • scp 遠程文件復制
  • rsync 文件同步工具

這期呢主要說一說Linux中文件備份與壓縮命令,一共6個命令。這6個命令都是平常工作中非常非常常用的。

快速上手Linux核心命令(九):文件備份與壓縮

tar 打包備份

1、簡介

tar 可以將多個文件壓縮打包、壓縮。是工作中經(jīng)常用到的命令

2、語法格式

tar [參數(shù)選項] [文件或目錄]

3、參數(shù)說明

參數(shù) 參數(shù)說明
z 通過gzip壓縮或解壓
c 創(chuàng)建新的tar包
v 顯示詳細的tar命令執(zhí)行過程
f 指定壓縮文件名字
t 不解壓查看tar包的內(nèi)容
p 保持文件的原有屬性
j 通過bzip2命令壓縮或解壓
x 解開tar包
C 指定解壓的目錄路徑
--exclude=PATTERN 打包時排除不需要處理的文件或目錄
-h 打包軟連接文件指向的真實源文件
-hard-dereference 打包硬鏈接文件

4、實踐操作

① 打包博客文件(將/home/hexoBlog 打包成hexoBlog.tar.gz)

[root@xiezhr home]# tar zcvf hexoBlog.tar.gz hexoBlog
hexoBlog/
hexoBlog/page/
hexoBlog/page/3/
hexoBlog/page/3/index.html
hexoBlog/page/2/
hexoBlog/page/2/index.html
hexoBlog/contact/
hexoBlog/contact/index.html
hexoBlog/baidusitemap.xml
hexoBlog/movies/
hexoBlog/movies/index.html
hexoBlog/images/
hexoBlog/images/0.jpg
hexoBlog/images/2020年年終總結(jié).jpg
hexoBlog/archives/
hexoBlog/archives/87a8e6ef.html
hexoBlog/archives/93a2b0e4.html
hexoBlog/archives/b55ad976.html
hexoBlog/archives/page/
hexoBlog/archives/page/3/

[root@xiezhr home]# ll 
drwxr-xr-x 30 git    git        4096 Jun  6 20:42 hexoBlog
-rw-r--r--  1 root   root   43478804 Jun 14 22:43 hexoBlog.tar.gz

② 不解壓查看壓縮包的內(nèi)容

[root@xiezhr home]# tar ztvf hexoBlog.tar.gz 
drwxr-xr-x git/git           0 2022-06-06 20:42 hexoBlog/
drwxr-xr-x git/git           0 2022-02-26 16:43 hexoBlog/page/
drwxr-xr-x git/git           0 2022-06-03 14:57 hexoBlog/page/3/
-rw-r--r-- git/git       56427 2022-06-03 14:57 hexoBlog/page/3/index.html
drwxr-xr-x git/git           0 2022-06-03 14:57 hexoBlog/page/2/
-rw-r--r-- git/git       63574 2022-06-03 14:57 hexoBlog/page/2/index.html
drwxr-xr-x git/git           0 2022-06-03 14:57 hexoBlog/contact/
-rw-r--r-- git/git       43745 2022-06-03 14:57 hexoBlog/contact/index.html
-rw-r--r-- git/git        4169 2022-06-03 14:57 hexoBlog/baidusitemap.xml
drwxr-xr-x git/git           0 2022-06-03 14:57 hexoBlog/movies/
-rw-r--r-- git/git       43246 2022-06-03 14:57 hexoBlog/movies/index.html
drwxr-xr-x git/git           0 2021-02-13 19:32 hexoBlog/images/
-rw-r--r-- git/git      570852 2020-11-29 16:42 hexoBlog/images/0.jpg
-rw-r--r-- git/git      133945 2021-02-13 19:32 hexoBlog/images/2020年年終總結(jié).jpg
drwxr-xr-x git/git           0 2022-06-06 20:42 hexoBlog/archives/
-rw-r--r-- git/git       97587 2022-06-03 14:57 hexoBlog/archives/87a8e6ef.html

③ 解壓文件到指定目錄

[root@xiezhr home]# tar -zxvf hexoBlog.tar.gz -C /home/test/
hexoBlog/
hexoBlog/page/
hexoBlog/page/3/
hexoBlog/page/3/index.html
hexoBlog/page/2/
hexoBlog/page/2/index.html
hexoBlog/contact/
hexoBlog/contact/index.html
hexoBlog/baidusitemap.xml
hexoBlog/movies/
hexoBlog/movies/index.html
hexoBlog/images/
hexoBlog/images/0.jpg
hexoBlog/images/2020年年終總結(jié).jpg
hexoBlog/archives/
hexoBlog/archives/87a8e6ef.html

[root@xiezhr home]# cd /home/test/
[root@xiezhr test]# ll
total 1
drwxr-xr-x 30 git    git      4096 Jun  6 20:42 hexoBlog

④ 排除指定文件后打包

# hexoBlog/books 目錄下的文件將被排除后打包
[root@xiezhr home]#  tar zcvf hexoBlog.tar.gz  hexoBlog --exclude=hexoBlog/books
hexoBlog/
hexoBlog/page/
hexoBlog/page/3/
hexoBlog/page/3/index.html
hexoBlog/page/2/
hexoBlog/page/2/index.html

⑤ 使用-h參數(shù)打包鏈接文件

[root@xiezhr etc]# tar zcfh local_h.tar.gz ./rc.local 
[root@xiezhr etc]# tar tfv local_h.tar.gz 
-rwxr-xr-x root/root       749 2022-03-22 09:10 ./rc.local

tar 使用小結(jié)

  • 打包一個目錄時,一般需要進入到目錄的上級目錄,然后再執(zhí)行打包命令。解壓時需要非常注意,文件是否會覆蓋原文件

  • 打包記憶:**tar zcvf /路徑/籃子.tar.gz 相對路徑/雞蛋 ** 【把雞蛋放到籃子里】

gzip 壓縮或解壓文件

1、簡介

gzip 命令用于將一個大的文件通過壓縮算法變成一個小文件。

注意: gzip 命令不能直接壓縮目錄,如果要壓縮目錄時,先要用tar 將目錄打包成一個文件,然后tar 再調(diào)用gzip壓縮

2、語法格式

gzip [參數(shù)選項] [文件]

3、參數(shù)說明

參數(shù) 參數(shù)說明
-d 解壓文件
-v 顯示命令執(zhí)行的過程
-l 列出壓縮文件的內(nèi)容信息
-c 將內(nèi)容輸出到標準輸出,不改變原始文件
-r 對目錄下的所有文件遞歸進行壓縮
-數(shù)字<1-9> 指定壓縮率,默認是6,值越大壓縮率越高
-t 測試,檢查壓縮文件是否完整

4、實踐操作

① 把目錄下的每個文件都單獨壓縮成.gz文件

[root@xiezhr dir3]# ls
a.txt  b.txt  c.txt  money.java  test.java  test.txt  tt.txt  user.java  xiezhr.java  xiezhr.txt
[root@xiezhr dir3]# gzip *.txt
[root@xiezhr dir3]# ls
a.txt.gz  b.txt.gz  c.txt.gz  money.java  test.java  test.txt.gz  tt.txt.gz  user.java  xiezhr.java  xiezhr.txt.gz

② 不解壓顯示壓縮文件信息

[root@xiezhr dir3]# gzip -l xiezhr.txt.gz 
         compressed        uncompressed  ratio uncompressed_name
                 31                   0   0.0% xiezhr.txt

③解壓文件,并顯示解壓過程

[root@xiezhr dir3]# ls
a.txt.gz  b.txt.gz  c.txt.gz  money.java  test.java  test.txt.gz  tt.txt.gz  user.java  xiezhr.java  xiezhr.txt.gz
[root@xiezhr dir3]# gzip -dv *.gz
a.txt.gz:         0.0% -- replaced with a.txt
b.txt.gz:         0.0% -- replaced with b.txt
c.txt.gz:         0.0% -- replaced with c.txt
test.txt.gz:     15.9% -- replaced with test.txt
tt.txt.gz:        0.0% -- replaced with tt.txt
xiezhr.txt.gz:    0.0% -- replaced with xiezhr.txt
[root@xiezhr dir3]# ls
a.txt  b.txt  c.txt  money.java  test.java  test.txt  tt.txt  user.java  xiezhr.java  xiezhr.txt

注: 以上實踐我們看到gzip命令在壓縮和解壓文件時,都會把源文件刪除。當然也有其他方法可以解決這個問題,但是使用起來有點麻煩。

zip 打包和壓縮文件

1、簡介

zip 壓縮格式是Windows和Linux通用的壓縮格式。和gzip命令相比,zip命令壓縮文件不會刪除源文件,還可以壓縮目錄。所以相比gzip命令,我們使用zip命令會更多一些

2、語法格式

zip [參數(shù)選項] [文件或目錄]

3、參數(shù)說明

參數(shù) 參數(shù)說明
-r 指定目錄下的所有文件和子目錄一并壓縮
-x 壓縮文件時排除某個文件
-q 不顯示壓縮信息

4、實踐操作

① 壓縮文件

[root@xiezhr testdir]# ls
xiezhr.txt
[root@xiezhr testdir]# zip xiezhr.zip xiezhr.txt 
  adding: xiezhr.txt (deflated 17%)
[root@xiezhr testdir]# ls
xiezhr.txt  xiezhr.zip

②壓縮目錄

# 這里只將testdir這個目錄壓縮了,目錄下的文件并沒有壓縮
[root@xiezhr test]# zip testdir.zip ./testdir/
  adding: testdir/ (stored 0%)
# 使用-r參數(shù)可以將目錄及目錄下的文件也遞歸壓縮了
[root@xiezhr test]# zip -r testdir.zip ./testdir/
updating: testdir/ (stored 0%)
  adding: testdir/xiezhr.txt (deflated 17%)

③ 排除壓縮

# 將abc.txt 文件排除到壓縮之外
[root@xiezhr testdir]# ll
total 8
-rw-r--r-- 1 root root  49 Jun 26 16:01 abc.txt
-rw-r--r-- 1 root root 527 Jun 26 15:50 xiezhr.txt
[root@xiezhr testdir]# cd ..
[root@xiezhr test]# zip -r testdir.zip ./testdir/ -x testdir/abc.txt 
updating: testdir/ (stored 0%)
updating: testdir/xiezhr.txt (deflated 17%)xxxxxxxxxx -[root@xiezhr testdir]# lltotal 8-rw-r--r-- 1 root root  49 Jun 26 16:01 abc.txt-rw-r--r-- 1 root root 527 Jun 26 15:50 xiezhr.txt[root@xiezhr testdir]# cd ..[root@xiezhr test]# zip -r testdir.zip ./testdir/ -x testdir/abc.txt updating: testdir/ (stored 0%)updating: testdir/xiezhr.txt (deflated 17%)shell

unzip 解壓zip文件

1、簡介

unzip 命令可以解壓zip格式的文件,一般與zip配套使用

2、語法格式

unzip [參數(shù)選項] [壓縮文件]

3、參數(shù)選項

參數(shù) 參數(shù)說明
-l 在不解壓的情況下顯示壓縮包的內(nèi)容
-o 解壓時不提示是否覆蓋文件
-d 指定解壓目錄
-v 解壓時顯示詳細信息

4、實踐操作

①不解壓查看壓縮包里的文件

[root@xiezhr test]# unzip -l testdir.zip 
Archive:  testdir.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
        0  06-26-2022 16:01   testdir/
      527  06-26-2022 15:50   testdir/xiezhr.txt
---------                     -------
      527                     2 files

② 解壓文件

# 不帶參數(shù)解壓文件時,會提示是否覆蓋文件
# [y]es, [n]o, [A]ll, [N]one, [r]ename  
# y--是  n--否  A--所有文件都替換 N--所有文件都不替換 r--重命名
[root@xiezhr test]# unzip testdir.zip 
Archive:  testdir.zip
replace testdir/xiezhr.txt? [y]es, [n]o, [A]ll, [N]one, [r]ename: y
  inflating: testdir/xiezhr.txt 
# -o 參數(shù),解壓時不提示覆蓋
[root@xiezhr test]# unzip -o testdir.zip 
Archive:  testdir.zip
  inflating: testdir/xiezhr.txt 

③ 指定解壓目錄解壓文件

# 將testdir.zip 解壓到指定目錄dir7下
[root@xiezhr test]# mkdir dir7
[root@xiezhr test]# unzip -d /home/test/dir7/ testdir.zip 
Archive:  testdir.zip
   creating: /home/test/dir7/testdir/
  inflating: /home/test/dir7/testdir/xiezhr.txt  
[root@xiezhr test]# cd dir7/
[root@xiezhr dir7]# ls
testdir

scp 遠程文件復制

1、簡介

scp 命令用于不同主機之間文件復制。scp命令每次都是全量完整復制,因此效率不高,適合第一次復制時候使用,增量復制建議使用rsync命令

2、語法格式

scp [參數(shù)選擇] [用戶@主機1:文件1] [用戶@主機2:文件2]

3、參數(shù)選項

參數(shù) 參數(shù)說明
-C 壓縮傳輸
-l 指定傳輸占用的寬帶,單位Kbit/s
-P

指定傳輸?shù)亩丝谔?/td>
-p 傳輸后保留文件原始屬性
-q 不顯示傳輸進度
-r 遞歸復制整個目錄

4、實踐操作

① 將本地文件或目錄復制到遠程服務器

[root@xiezhr ~]# scp  /home/test/xie.txt  42.192.46.248:/tmp
root@42.192.46.248's password: 

② 從遠程服務器將數(shù)據(jù)復制到本地

[root@xiezhr ~]# scp 42.192.21.248:/tmp .

rsync 文件同步工具

1、簡介

rsync 可以實現(xiàn)全量或增量的文件復制的開源工具。 可以在本地計算機與遠程計算機之間,或者兩個本地目錄之間同步文件 。 它也可以當作文件復制工具,替代cpmv命令

2、語法格式

# 1、本地模式
rsync [參數(shù)選項] [源文件] [目標文件]
# 2、遠程同步模式
# 拉取文件
rsync [參數(shù)選項] [用戶@主機:源文件] [目標文件]
# 推送文件
rsync [參數(shù)選項] [源文件] [用戶@主機:目標文件]

3、參數(shù)選項

參數(shù) 參數(shù)說明
-r 遞歸方式同步目錄
-a 可以替代-r參數(shù),除了可以遞歸同步,還可以同步文件屬性(修改時間、權(quán)限等)
-n 不確定 rsync 執(zhí)行后會產(chǎn)生什么結(jié)果,可以先用-n參數(shù)模擬執(zhí)行結(jié)果
--delete 使目標目錄內(nèi)容和源保持目錄一致,刪除不同文件
--exclude 同步時,排除不需要的文件或目錄
--include 同步時,必須包含的文件

4、實踐操作

注: 有些Linux系統(tǒng)中可能沒有默認安裝rsync ,我們只需按照如下命令安裝即可

yum -y install rsync

① 將當前目錄下的hexoBlog 同步到 dir7目錄下

[root@xiezhr test]# rsync -r hexoBlog/ dir7/hexoBlog
[root@xiezhr test]# cd dir7/
[root@xiezhr dir7]# ll
total 4
drwxr-xr-x 30 root root 4096 Jun 29 20:54 hexoBlog

② 將當前目錄下的logo.png 和hexoBlog 同步到dir8/test 目錄下

[root@xiezhr test]# rsync -r logo.png hexoBlog/  dir8/test
[root@xiezhr test]# cd dir8/test/
[root@xiezhr test]# ll
total 1420
drwxr-xr-x  2 root root   4096 Jun 29 21:00 about
drwxr-xr-x  6 root root   4096 Jun 29 21:00 archives
drwxr-xr-x  2 root root   4096 Jun 29 21:00 artitalk

注: -r表示遞歸,即包含子目錄。注意,-r是必須的,否則 rsync 運行不會成功

③-a 參數(shù),遞歸同步,同步修改時間、權(quán)限等信息

# rsync -a hexoBlog hexoBlog_new
# 目標目錄hexoBlog_new 如果不存在,rsync 會自動創(chuàng)建。
# 執(zhí)行上面的命令后,源目錄hexoBlog被完整地復制到了目標目錄hexoBlog_new下面,hexoBlog_new/hexoBlog的目錄結(jié)構(gòu)。

[root@xiezhr test]# ll
total 16
drwxr-xr-x  2 xiezhr xiezhr 4096 Mar 26 21:46 dir
drwxr-xr-x 30 git    git    4096 Jun  6 20:42 hexoBlog
-rw-r--r--  1 root   root     35 May  9 21:36 xie.txt
-rw-r--r--  1 root   root    527 Apr  9 10:55 xiezhr.txt
[root@xiezhr test]# rsync -a hexoBlog hexoBlog_new
[root@xiezhr test]# ll
total 20
drwxr-xr-x  2 xiezhr xiezhr 4096 Mar 26 21:46 dir
drwxr-xr-x 30 git    git    4096 Jun  6 20:42 hexoBlog
drwxr-xr-x  3 root   root   4096 Jul  2 09:15 hexoBlog_new
-rw-r--r--  1 root   root     35 May  9 21:36 xie.txt
-rw-r--r--  1 root   root    527 Apr  9 10:55 xiezhr.txt

#如果只想同步源目錄 hexoBlog 里面的內(nèi)容到目標目錄hexoBlog_new,則需要在源目錄后面加上斜杠。
[root@xiezhr test]# rsync -a hexoBlog/ hexoBlog_new
#上面命令執(zhí)行后,hexoBlog目錄里面的內(nèi)容,就都被復制到了hexoBlog_new目錄里面,并不會在hexoBlog_new下面創(chuàng)建一個hexoBlog子目錄。

-n 參數(shù)模擬執(zhí)行結(jié)果

注: 如果不確定 rsync 執(zhí)行后會產(chǎn)生什么結(jié)果,可以先用-n 參數(shù)模擬執(zhí)行結(jié)果

[root@xiezhr test]# rsync -anv xie.txt testdir
sending incremental file list
xie.txt

sent 49 bytes  received 19 bytes  136.00 bytes/sec
total size is 35  speedup is 0.51 (DRY RUN)

# -n參數(shù)模擬命令執(zhí)行的結(jié)果,并不真的執(zhí)行命令。-v參數(shù)則是將結(jié)果輸出到終端,這樣就可以看到哪些內(nèi)容會被同步。

--delete 參數(shù)的使用,保持源目錄和目標目錄文件一致

[root@xiezhr test]# rsync -av --delete hexoBlog hexoBlog_0702
sending incremental file list
created directory hexoBlog_0702
hexoBlog/
hexoBlog/Staticfile.txt
hexoBlog/baidu_urls.txt
hexoBlog/baidusitemap.xml
hexoBlog/favicon.png
hexoBlog/tags/問卷調(diào)查/index.html

sent 63,638,655 bytes  received 8,246 bytes  42,431,267.33 bytes/sec
total size is 63,597,216  speedup is 1.00

注: 默認情況下,rsync 只確保源目錄的所有內(nèi)容(明確排除的文件除外)都復制到目標目錄。它不會使兩個目錄保持相同,并且不會刪除文件。使用--delete參數(shù),這將刪除只存在于目標目錄、不存在于源目錄的文件。

--exclude 參數(shù) 的使用,同步時排除某些文件

[root@xiezhr test]# rsync -av --exclude '*.txt' hexoBlog hexoBlog_test
sending incremental file list
created directory hexoBlog_test
hexoBlog/
hexoBlog/baidusitemap.xml
hexoBlog/favicon.png
hexoBlog/favicon1.png
hexoBlog/tags/問卷調(diào)查/index.html

sent 63,638,026 bytes  received 8,208 bytes  127,292,468.00 bytes/sec
total size is 63,596,717  speedup is 1.00

注: 上面腳本將hexoBlog 目錄下除了.txt外的文件都同步到了hexoBlog_test 目錄下

--include 參數(shù)的使用,同步時必須包含某些文件

[root@xiezhr test]# rsync  -av --include "*.txt" --exclude "*" hexoBlog hexo_xie
sending incremental file list

sent 18 bytes  received 12 bytes  60.00 bytes/sec
total size is 0  speedup is 0.00

注:上述命令將hexoBlog目錄下的所有文件排除,但包含txt文件同步到hexo_xie目錄下

⑧遠程同步資源

注: rsync 命令除了可以本地同步之外,還支持遠程同步資源

# 以下命令是將本地資源source 同步到遠程服務器destination
[root@xiezhr test]# rsync -av source/ username@remote_host:destination
# 以下命令是將遠程服務器資源source同步到本地 destination
[root@xiezhr test]# rsync -av username@remote_host:source/ destination

由于博主比較窮,手上只有一臺云服務器,這里就沒法做具體演示了??

⑨增量備份

[root@xiezhr test]# rsync -a --delete --link-dest /compare/path /source/path /target/path

上述命令解釋

  • --link-dest參數(shù)指定基準目錄/compare/path

  • /source/path 代表源目錄

  • /target/path 代表目標目錄

  • 命令的第一次備份時是全量備份,后面 源目錄/source/path跟基準目錄/compare/path 進行比較,找出變動的文件,將它們拷貝到目標目錄/target/path 實現(xiàn)增量更新

注: 上面命令可以寫成shell腳本,然后添加到Linux任務調(diào)度里,就實現(xiàn)了增量備份文件的功能。

關(guān)于rsync命令小結(jié)

  • rsync 用法很多,所以上面說了好多常用例子,當然還有很多用法沒法一一例舉出來。
  • rsync 不僅用于Linux,也同樣可以再Windows上使用,用于文章上關(guān)于Linux的,所以沒列舉Windows上使用方法。感興趣的小伙伴可自行查找資料,或者后面出一篇文章具體介紹
  • 關(guān)于rsync命令的用法,阮一峰大佬也寫了一篇文章,講的也非常好。大家可以去看看,文章地址:https://www.ruanyifeng.com/blog/2020/08/rsync.html

這期主要是說了Linux系統(tǒng)文件備份與壓縮相關(guān)命令,大概內(nèi)容就這些了。下期根據(jù)思維導圖就到了 軟件安裝相關(guān) 的命令了。

涉及到的命令有: rpm、 yum兩個命令

這些命令呢比較基礎(chǔ),但也是比較常用比較重要的

敬請期待哦(●’?’●)

專欄目錄:快速上手Linux核心命令專欄目錄

上一篇:快速上手Linux核心命令(七):Linux系統(tǒng)信息相關(guān)命令
下一篇:快速上手Linux核心命令(九):文件備份與壓縮文章來源地址http://www.zghlxwxcb.cn/news/detail-427806.html

到了這里,關(guān)于快速上手Linux核心命令(九):文件備份與壓縮的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

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

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

相關(guān)文章

  • 快速上手Linux核心命令(八):網(wǎng)絡相關(guān)命令

    快速上手Linux核心命令(八):網(wǎng)絡相關(guān)命令

    目錄 前言 測試主機之間網(wǎng)絡是否聯(lián)通 ifconfig 配置或顯示網(wǎng)絡信息 route 顯示或管理路由表 netstat 查看網(wǎng)絡狀況 telnet 遠程登錄主機 ssh 安全的遠程登錄主機 wget 命令行下載工具 ip網(wǎng)絡配置工具 tcpdump 監(jiān)聽網(wǎng)絡流量 nmap 網(wǎng)絡探測工具和安全/端口掃描器 ifup 激活網(wǎng)絡接口 ifdown 禁

    2024年02月01日
    瀏覽(20)
  • 快速上手Linux核心命令(十一):Linux用戶相關(guān)命令

    快速上手Linux核心命令(十一):Linux用戶相關(guān)命令

    目錄 前言 useradd 創(chuàng)建用戶 usermod 修改用戶信息 userdel 刪除用戶 groupadd 創(chuàng)建新的用戶組 groupdel 刪除用戶組 passwd 修改用戶密碼 chage 修改用戶密碼有效期 批量更新用戶密碼 su 切換用戶 visudo 編輯sudoers文件 sudo 以另一個用戶身份執(zhí)行命令 id 顯示用戶與用戶組信息 w 顯示已登錄用

    2024年02月03日
    瀏覽(25)
  • 快速上手Linux核心命令(七):Linux系統(tǒng)信息相關(guān)命令

    快速上手Linux核心命令(七):Linux系統(tǒng)信息相關(guān)命令

    目錄 前言 uname 顯示系統(tǒng)信息 hostname 顯示或設(shè)置系統(tǒng)主機名 du 統(tǒng)計磁盤空間使用情況 echo 顯示一行文本 watch 監(jiān)視命令執(zhí)行情況 stat whereis 顯示命令及其相關(guān)文件的全路徑 date 顯示與設(shè)置系統(tǒng)時間 which 顯示命令全路徑 locate 快速定位文件路徑 這期呢主要說一說Linux中與系統(tǒng)相關(guān)

    2023年04月27日
    瀏覽(20)
  • 快速上手Linux核心命令(十):Linux安裝軟件

    快速上手Linux核心命令(十):Linux安裝軟件

    目錄 前言 rpm rpm包管理器 yum 自動化RPM包管理工具 這期呢主要說一說Linux中包軟件管理相關(guān)命令,這一期的命令雖然只有兩個。但 軟件包的安裝和卸載都是我們平常最常用的,需要熟練掌握。 rpm和yum 是CentOS 主要的包軟件管理。 兩個命令各有用處,①yum需要互聯(lián)網(wǎng),yum會去網(wǎng)

    2024年02月01日
    瀏覽(23)
  • 快速上手Linux核心命令(五):文本處理三劍客

    快速上手Linux核心命令(五):文本處理三劍客

    目錄 前言 正則表達式 第一劍客 grep 第二劍客 sed 第三 劍客 awk 小結(jié) 上一篇中已經(jīng)預告,我們這篇主要說Linux文本處理 三劍客 。他們分別是 grep 、 sed 、 awk 。既然能被業(yè)界稱為三劍客,可見其在Linux命令中占有舉足輕重得地位。所以呢,這里也專門寫一篇文章說一說其用法。

    2023年04月25日
    瀏覽(21)
  • 【Shell 命令集合 備份壓縮 】Linux 解壓縮文件 unzip命令 使用指南

    【Shell 命令集合 備份壓縮 】Linux 解壓縮文件 unzip命令 使用指南

    Shell 命令專欄:Linux Shell 命令全解析 unzip 命令在 Linux 系統(tǒng)中主要用于解壓 .zip 格式的壓縮文件。 在這個命令中, -x 選項表示解壓, -z 選項表示處理 .gz 壓縮, -v 選項表示顯示詳細信息, -f 選項表示指定文件名。 使用unzip命令可以將壓縮文件解壓縮到當前目錄或指定的目錄

    2024年02月08日
    瀏覽(27)
  • 快速上手Linux核心命令(六):Linux的文本編輯器vi和vim

    快速上手Linux核心命令(六):Linux的文本編輯器vi和vim

    目錄 前言 簡介 小試牛刀 vi/vim 工作原理及三種模式 常用快捷鍵 命令行圖解 上一篇中已經(jīng)預告,我們這篇主要說Linux中vi/vim 編輯器。它是我們使用Linux系統(tǒng)不可缺少的工具,學會了,你就可以在Linux世界里暢通無阻,學廢了,常用操作你也會了,也是夠用了,O(∩_∩)O vi是L

    2023年04月26日
    瀏覽(29)
  • 「Linux系列」Linux網(wǎng)絡通訊/系統(tǒng)管理/系統(tǒng)設(shè)置/備份壓縮/設(shè)備管理命令

    Linux網(wǎng)絡通訊命令是Linux系統(tǒng)中用于管理和調(diào)試網(wǎng)絡功能的一系列工具。這些命令可以幫助用戶查看網(wǎng)絡狀態(tài)、測試網(wǎng)絡連接、查詢DNS記錄以及進行其他網(wǎng)絡相關(guān)操作。以下是一些常用的Linux網(wǎng)絡通訊命令及其案例: ping命令 功能 :用于檢查與目標主機之間的連接是否正常,通

    2024年04月10日
    瀏覽(27)
  • Linux日志相關(guān)命令—查看\關(guān)鍵詞查詢\截取\日志壓縮備份

    Linux日志相關(guān)命令—查看\關(guān)鍵詞查詢\截取\日志壓縮備份

    1、動態(tài)日志查看。 說明:程序啟動可以動態(tài)查看運行日志。 2、顯示最后100行 說明:動態(tài)日志沒有寫入的時候,可以用該命令查詢最后的幾行 常用(可記?。?說明:會查詢?nèi)罩疚募猩婕暗哪且恍?,并顯示出來,在日志中出現(xiàn)太多就不好定位。 說明:搜索

    2024年02月17日
    瀏覽(121)
  • 快速上手linux | 一文秒懂Linux各種常用命令(下)

    快速上手linux | 一文秒懂Linux各種常用命令(下)

    ?? 鴿芷咕 :個人主頁 ??? 個人專欄 :《C語言初階篇》 《C語言進階篇》 ??生活的理想,就是為了理想的生活! 前倆篇我們給大家介紹完了,linux的常用文件操作和目錄操作。而今天介紹的命令可就厲害了 既可以操作文件又可以操作目錄 有 rm cp mv 等快來看看吧! 命令名稱

    2024年02月04日
    瀏覽(20)

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

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

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

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

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包