日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

Linux下的文件系统

發布時間:2025/4/16 62 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Linux下的文件系统 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

Linux下的文件系統

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

一、tar的用法

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

二、文件的歸檔

1.對目錄文件進行歸檔

[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.查看歸檔包內容

[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.查看壓縮包內容

[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

五、查看已掛載的文件系統情況

1.查看文件系統使用狀態

[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.查看文件系統類型

[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.硬鏈接

①硬鏈接介紹

# 多個文件名指向同一個inode # 增加文件的鏈接數 1.rm會減少文件的鏈接數 2.指導文件的鏈接數變為0.文件才會徹底刪除

②設置硬鏈接

[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.軟鏈接

①軟鏈接介紹

一個文件指向另外一個文件,是兩個不用的文件。
軟鏈接可以跨文件系統。

②生成軟鏈接

[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

七、文件系統的掛載

[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

總結

以上是生活随笔為你收集整理的Linux下的文件系统的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。