亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

Table of Contents
1. Use the df Command
2. Use the du Command
3. Check Disk Usage with lsblk
4. Use the ncdu Interactive Tool
Home System Tutorial LINUX How to check disk space in Linux command line

How to check disk space in Linux command line

Sep 21, 2025 am 04:46 AM
linux disk space

To check disk space on Linux, use df -h for an overview of storage, du -sh to find directory sizes, lsblk to list block devices, or install ncdu for an interactive analysis. These tools help monitor and manage disk usage efficiently.

How to check disk space in Linux command line

If you need to check disk space usage on a Linux system, the command line offers several straightforward tools. Here's how to do it:

The operating environment of this tutorial: Dell XPS 13, Ubuntu 22.04

1. Use the df Command

The df command displays the amount of disk space used and available on mounted filesystems. It provides a high-level overview of storage across all mounted partitions.

  • Type df -h to view disk space in human-readable format (KB, MB, GB).
  • Add the -T flag (df -hT) to show the filesystem type (e.g., ext4, xfs).
  • To display information for a specific mount point, run df -h /path/to/directory.

2. Use the du Command

The du command estimates file and directory space usage. It is useful for identifying which directories are consuming the most space.

  • Run du -sh /path/to/directory to get the total size of a specific directory.
  • Use du -h --max-depth=1 /home to list the sizes of immediate subdirectories within /home.
  • Add the --exclude option to skip certain file types, such as du -sh --exclude="*.log" /var.

3. Check Disk Usage with lsblk

The lsblk command lists block devices, showing disks and their partitions in a tree-like format, including size and mount points.

  • Enter lsblk to view all block devices and their hierarchy.
  • For byte-sized output, use lsblk -b.
  • To include filesystem labels, run lsblk -f.

4. Use the ncdu Interactive Tool

ncdu is a curses-based version of du that provides an interactive interface for browsing disk usage and is especially helpful on remote servers.

  • Install it using your package manager: sudo apt install ncdu on Debian/Ubuntu systems.
  • Analyze a directory with ncdu /path/to/directory.
  • Navigate using arrow keys, press d to delete files, or q to quit.

The above is the detailed content of How to check disk space in Linux command line. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

ArtGPT

ArtGPT

AI image generator for creative art from text prompts.

Stock Market GPT

Stock Market GPT

AI powered investment research for smarter decisions

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Aisi Assistant's genuine download portal_Aisi Assistant's iPhone installation link Aisi Assistant's genuine download portal_Aisi Assistant's iPhone installation link Sep 16, 2025 am 11:30 AM

The official download portal of Aisi Assistant is located on the official website https://www.i4.cn/, and provides computer and mobile downloads, supporting device management, application installation, mode switching, screen projection and file management functions.

Huawei HarmonyOS 6 system cancels the 'NEXT' suffix: It will be native Hongmeng in the future Huawei HarmonyOS 6 system cancels the 'NEXT' suffix: It will be native Hongmeng in the future Sep 24, 2025 pm 04:12 PM

The latest news on September 18th, Huawei HarmonyOS6 has launched multiple rounds of preview version push for developers, and has recently opened the experience qualification to some users who have tried it out for the first time. According to user feedback, the current system name no longer displays the "NEXT" suffix, and it is officially renamed to HarmonyOS6.0. Huawei initially proposed the name HarmonyOSNEXT for the first time at the developer conference in August 2023, aiming to mark the Hongmeng system entering a new stage of development and realizing true native self-development. HarmonyOSNEXT's most core breakthrough is to completely adopt the underlying system architecture developed independently, completely remove the Linux kernel and Android AOSP code, and only run applications based on the HarmonyOS kernel.

How to run Windows programs on Linux How to run Windows programs on Linux Sep 18, 2025 am 03:25 AM

TorunWindowsprogramsonLinux,trythesemethods:1.UseWinetodirectlyrun.exefiles.2.InstallPlayOnLinuxforeasierWinemanagement.3.SetupaWindowsvirtualmachinewithVirtualBox.4.UseLutristoinstallandrunWindowsgamesseamlessly.

How to find the path of a program in Linux How to find the path of a program in Linux Sep 16, 2025 am 08:56 AM

Tolocateaprogram'sinstallationpathonLinux,use:1.whichprogram_nameforquickPATH-basedlookup.2.whereisprogram_nametofindbinaries,manpages,andsources.3.locatewithupdatedbandgrepforfastfilesearches.4.find/-typef-executable-name"program_name"fort

How to manage startup programs in Linux How to manage startup programs in Linux Sep 09, 2025 am 05:30 AM

UseGUItoolslikeStartupApplicationsinGNOME,AutostartinKDE,orSessionandStartupinXfcetomanageloginprograms.2.Manuallyaddstartupentriesvia.desktopfilesin~/.config/autostart/followingXDGstandards.3.Forsystem-levelservices,usesystemctlenable/disabletocontr

How to take a screenshot on Linux How to take a screenshot on Linux Sep 15, 2025 am 03:35 AM

TotakescreenshotsonLinux:1.UsePrtScnkeyforfullscreen,Alt PrtScnforactivewindow.2.UseGNOMEScreenshottoolformoreoptions.3.Usegnome-screenshotcommandinterminal.4.Installandusescrotforlightweightcommand-linecapturing.

How to install VS Code on Linux How to install VS Code on Linux Sep 16, 2025 am 09:04 AM

ToinstallVSCodeonLinux,usetheofficialAPTrepositoryforautomaticupdates,Snapforcross-distributioncompatibility,oramanualtarballforfullcontrol.Choosebasedonyoursystemandneeds.

How to check disk space in Linux command line How to check disk space in Linux command line Sep 21, 2025 am 04:46 AM

TocheckdiskspaceonLinux,usedf-hforanoverviewofstorage,du-shtofinddirectorysizes,lsblktolistblockdevices,orinstallncduforaninteractiveanalysis.Thesetoolshelpmonitorandmanagediskusageefficiently.

See all articles