日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪(fǎng)問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 运维知识 > linux >内容正文

linux

Linux下的文件系统

發(fā)布時(shí)間:2025/4/16 linux 47 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Linux下的文件系统 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

Linux下的文件系統(tǒng)

  • 一、tar的用法
  • 二、文件的歸檔
    • 1.對(duì)目錄文件進(jìn)行歸檔
    • 2.查看歸檔包內(nèi)容
  • 三、文件的解壓縮
    • 1.壓縮和解壓縮工具介紹
    • 2.使用gzip解壓縮
      • ①gzip壓縮
      • ②gzip解壓
    • 3.使用bizp2解壓縮
      • ①.bzip2壓縮
      • ②.bzip解壓
    • 4.查看壓縮包內(nèi)容
  • 四、目錄大小查看
    • 1.目錄下各子目錄大小
    • 2.目錄匯總大小
  • 五、查看已掛載的文件系統(tǒng)情況
    • 1.查看文件系統(tǒng)使用狀態(tài)
    • 2.查看inode的使用情況
    • 3.查看文件系統(tǒng)類(lèi)型
  • 六、硬鏈接和軟鏈接
    • 1.硬鏈接
      • ①硬鏈接介紹
      • ②設(shè)置硬鏈接
      • ③查看inode
    • 2.軟鏈接
      • ①軟鏈接介紹
      • ②生成軟鏈接
      • ③查看inode
  • 七、文件系統(tǒng)的掛載

一、tar的用法

-c 建議歸檔 -f 指定歸檔文件名 -x 解壓文件 -t 列出歸檔內(nèi)容 -z 調(diào)用gzip壓縮工具,進(jìn)行歸檔壓縮 -j 調(diào)用bzip2壓縮工具,進(jìn)行歸檔壓縮 -v 顯示操作進(jìn)行的所有進(jìn)程 -C 將文件解壓到指定目錄下

二、文件的歸檔

1.對(duì)目錄文件進(jìn)行歸檔

[root@control test]# ls file1 file2 file3 file4 file5 file6[root@control test]# tar -c * -f huizong [root@control test]# ls file1 file2 file3 file4 file5 file6 huizong

2.查看歸檔包內(nèi)容

[root@control test]# tar -tf huizong file1 file2 file3 file4 file5 file6

三、文件的解壓縮

1.壓縮和解壓縮工具介紹

# gzip/gunzip # bizp2/bunzip2 # xz/unzx

2.使用gzip解壓縮

①gzip壓縮

[root@control tmp]# ls file1 file2 file3 file4 file5 file6 [root@control tmp]# tar -czf /tmp/test.tar.gz ./* [root@control tmp]# ls file1 file2 file3 file4 file5 file6 [root@control tmp]# ls /tmp test.tar.gz

②gzip解壓

[root@control tmp]# tar -xzf /tmp/test.tar.gz -C /wenjian/ [root@control tmp]# ls /wenjian file1 file2 file3 file4 file5 file6

3.使用bizp2解壓縮

①.bzip2壓縮

[root@control tmp]# tar -cjf /tmp/test.tar.bz ./* [root@control tmp]# ls /tmp/ test.tar.bz test.tar.gz

②.bzip解壓

[root@control tmp]# tar -xjf /tmp/test.tar.bz -C /wenjian01/ [root@control tmp]# ls /wenjian01/ file1 file2 file3 file4 file5 file6 [root@control tmp]#

4.查看壓縮包內(nèi)容

[root@control tmp]# tar -tf /tmp/test.tar.bz ;tar -tf /tmp/test.tar.gz ./file1 ./file2 ./file3 ./file4 ./file5 ./file6 ./file1 ./file2 ./file3 ./file4 ./file5 ./file6

四、目錄大小查看

1.目錄下各子目錄大小

[root@control tmp]# du -h /data 0 /data/dir1 0 /data/dir2 0 /data/redhat 64K /data/scripts 40M /data/audit 0 /data/tmp 4.0K /data/log 88K /data/net 8.0K /data/net_log 4.0K /data/test 1.2G /data

2.目錄匯總大小

[root@control tmp]# du -h -s /data 1.2G /data

五、查看已掛載的文件系統(tǒng)情況

1.查看文件系統(tǒng)使用狀態(tài)

[root@control tmp]# df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 1.9G 0 1.9G 0% /dev tmpfs 2.0G 0 2.0G 0% /dev/shm tmpfs 2.0G 9.7M 2.0G 1% /run tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup /dev/nvme0n1p5 13G 8.5G 4.1G 68% / /dev/nvme0n1p1 495M 139M 356M 29% /boot /dev/nvme0n1p2 5.0G 69M 5.0G 2% /home tmpfs 392M 16K 392M 1% /run/user/42 tmpfs 392M 4.0K 392M 1% /run/user/0

2.查看inode的使用情況

Filesystem Inodes IUsed IFree IUse% Mounted on devtmpfs 498030 408 497622 1% /dev tmpfs 501573 1 501572 1% /dev/shm tmpfs 501573 875 500698 1% /run tmpfs 501573 17 501556 1% /sys/fs/cgroup /dev/nvme0n1p5 6558720 178306 6380414 3% / /dev/nvme0n1p1 256000 300 255700 1% /boot /dev/nvme0n1p2 2621440 155 2621285 1% /home tmpfs 501573 19 501554 1% /run/user/42 tmpfs 501573 11 501562 1% /run/user/0

3.查看文件系統(tǒng)類(lèi)型

[root@control tmp]# df -T Filesystem Type 1K-blocks Used Available Use% Mounted on devtmpfs devtmpfs 1992120 0 1992120 0% /dev tmpfs tmpfs 2006292 0 2006292 0% /dev/shm tmpfs tmpfs 2006292 9852 1996440 1% /run tmpfs tmpfs 2006292 0 2006292 0% /sys/fs/cgroup /dev/nvme0n1p5 xfs 13107200 8831836 4275364 68% / /dev/nvme0n1p1 xfs 506528 142332 364196 29% /boot /dev/nvme0n1p2 xfs 5232640 70064 5162576 2% /home tmpfs tmpfs 401256 16 401240 1% /run/user/42 tmpfs tmpfs 401256 4 401252 1% /run/user/0

六、硬鏈接和軟鏈接

1.硬鏈接

①硬鏈接介紹

# 多個(gè)文件名指向同一個(gè)inode # 增加文件的鏈接數(shù) 1.rm會(huì)減少文件的鏈接數(shù) 2.指導(dǎo)文件的鏈接數(shù)變?yōu)?.文件才會(huì)徹底刪除

②設(shè)置硬鏈接

[root@control ~]# ln /wenjian01/file2 /tmp/lianjie2

③查看inode

[root@control ~]# ll -i /wenjian01/file2 1278062 -rw-r--r-- 2 root root 0 Jul 25 17:21 /wenjian01/file2 [root@control ~]# ll -i /tmp/lianjie2 1278062 -rw-r--r-- 2 root root 0 Jul 25 17:21 /tmp/lianjie2

2.軟鏈接

①軟鏈接介紹

一個(gè)文件指向另外一個(gè)文件,是兩個(gè)不用的文件。
軟鏈接可以跨文件系統(tǒng)。

②生成軟鏈接

[root@control ~]# ln -s /wenjian01/file1 /tmp/lianjie01 [root@control ~]# ls /tmp/ lianjie01 test.tar.bz test.tar.gz [root@control ~]# ll /tmp total 8 lrwxrwxrwx 1 root root 16 Jul 25 17:37 lianjie01 -> /wenjian01/file1 -rw-r--r-- 1 root root 172 Jul 25 17:26 test.tar.bz -rw-r--r-- 1 root root 167 Jul 25 17:21 test.tar.gz

③查看inode

七、文件系統(tǒng)的掛載

[root@control ~]# mount /dev/cdrom /mnt/cdrom/ mount: /mnt/cdrom: WARNING: device write-protected, mounted read-only. [root@control ~]# df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 1.9G 0 1.9G 0% /dev tmpfs 2.0G 0 2.0G 0% /dev/shm tmpfs 2.0G 9.7M 2.0G 1% /run tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup /dev/nvme0n1p5 13G 8.5G 4.1G 68% / /dev/nvme0n1p1 495M 139M 356M 29% /boot /dev/nvme0n1p2 5.0G 69M 5.0G 2% /home tmpfs 392M 16K 392M 1% /run/user/42 tmpfs 392M 4.0K 392M 1% /run/user/0 /dev/sr0 6.7G 6.7G 0 100% /mnt/cdrom

總結(jié)

以上是生活随笔為你收集整理的Linux下的文件系统的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。