Linux/Unix Tutorial
Estimated reading: 3 minutes 40 views

πŸ’Ύ Linux/Unix: Storage, Archiving & Compression – Tools, Mounting, Disk Space & Compression Explained

🧲 Introduction – Master Storage & Space Management in Linux

Linux and Unix systems offer powerful tools for managing disks, mounting partitions, tracking disk usage, and compressing files for archiving or transmission. Whether you’re a developer, sysadmin, or power user, understanding these commands is essential for effective space management and backup strategies.

🎯 In this guide, you’ll learn:

  • How to inspect drives and partitions
  • How to mount and unmount storage volumes
  • How to track file and directory disk usage
  • How to compress and extract files using tar, gzip, zip, and more

πŸ“˜ Topics Covered

πŸ”΅ SubtopicπŸ“– Description
Storage Tools (lsblk, blkid, etc.)Identify disks, partitions, and their properties
Mounting (mount, umount)Attach or detach filesystems to directories
Disk Usage (df, du)Check space availability on filesystems and usage by files/directories
Compression Tools (tar, gzip, etc.)Archive, compress, or extract files with popular formats

πŸ”΅ Linux/Unix: Storage Tools (lsblk, blkid, fdisk, parted)

πŸ”Ή lsblk – List Block Devices

lsblk

βœ… Shows all connected disks and partitions in a tree-like format.


πŸ”Ή blkid – View Partition UUIDs & File Systems

blkid

πŸ”Ή fdisk – Partition Table Editor (MBR)

sudo fdisk /dev/sda

βœ… Useful for viewing and editing MBR partition tables.


πŸ”Ή parted – Manage GPT & Large Drives

sudo parted /dev/sda

πŸ”΅ Linux/Unix: Mounting (mount, umount)

πŸ”Ή mount – Mount a File System

sudo mount /dev/sdb1 /mnt

βœ… Attaches the partition /dev/sdb1 to /mnt.


πŸ”Ή umount – Unmount a Mounted Volume

sudo umount /mnt

πŸ”Ή View All Mounts

mount | column -t

πŸ”Ή Create and Mount ISO

sudo mount -o loop file.iso /mnt

πŸ”΅ Linux/Unix: Disk Usage (df, du)

πŸ”Ή df – View Filesystem Disk Space

df -h

βœ… Shows space usage on each mounted partition in human-readable format.


πŸ”Ή du – Estimate File/Folder Space

du -sh /home/user/*

βœ… Useful for identifying large directories.


πŸ”΅ Linux/Unix: Compression Tools (tar, gzip, zip, bzip2, xz, 7z)

πŸ”Ή tar – Archive Multiple Files

tar -cvf archive.tar file1 file2
tar -xvf archive.tar

πŸ”Ή gzip / gunzip – Compress Single File

gzip file.txt
gunzip file.txt.gz

πŸ”Ή zip / unzip – Portable Compression

zip archive.zip file1 file2
unzip archive.zip

πŸ”Ή bzip2 / xz – Better Compression Ratios

bzip2 file.txt
xz file.txt

πŸ”Ή 7z – High-Ratio Archiving (needs p7zip package)

7z a archive.7z file1 file2
7z x archive.7z

πŸ“Œ Summary – Recap & Next Steps

Linux provides an efficient suite of commands for analyzing storage, managing disk usage, and archiving data. These tools are essential for system maintenance, backups, and keeping your file systems optimized and organized.

πŸ” Key Takeaways:

  • Use lsblk and blkid to identify drives and partitions.
  • Use mount and umount to attach or detach volumes.
  • Monitor space with df and inspect heavy files with du.
  • Compress and extract files using tar, gzip, zip, xz, and 7z.

βš™οΈ Real-World Applications:

  • Back up a project directory with tar.gz
  • Mount external drives or ISO files
  • Analyze disk usage to prevent system overload
  • Share files efficiently using compressed archives

❓ Frequently Asked Questions

❓ What is the difference between df and du?
βœ… df shows disk space for mounted filesystems. du shows space used by individual files or directories.


❓ Which compression tool gives the best compression?
βœ… xz and 7z often give higher compression than gzip or zip, but may take longer.


❓ How can I mount an ISO file in Linux?
βœ… Use:

sudo mount -o loop file.iso /mnt

❓ Can I extract .zip files without a GUI?
βœ… Yes, use the unzip command in the terminal.


❓ Is fdisk safe to use on a running system?
βœ… It’s safe for viewing partitions, but avoid changes unless you understand the risks.


Share Now :

Leave a Reply

Your email address will not be published. Required fields are marked *

Share

πŸ’Ύ Linux/Unix: Storage, Archiving & Compression

Or Copy Link

CONTENTS
Scroll to Top