Close Menu
    Facebook X (Twitter) Instagram Pinterest YouTube
    Trending
    • Disable SSH Password Login on Raspberry Pi
    • Elecrow Meteor IPS Touchscreen with RGB LEDs
    • Pi Pico Pinout Display on the Command Line
    • How to Add a Raspberry Pi Pico Reset Button
    • Pi Pico Onboard LED
    • Pi Pico W Pinout and Power Pins
    • CrowPi L Raspberry Pi Laptop and Learning Platform
    • Pi Pico W Launched
    Mastodon YouTube Facebook Instagram Pinterest RSS
    Raspberry Pi SpyRaspberry Pi Spy
    • Home
    • Categories
      • General
      • Hardware
      • Programming
      • Python
      • Software
      • Tutorials & Help
    • BerryClip
      • BerryClip Instructions
      • BerryClip Plus Instructions
      • Videos & Reviews
    • Buy
      • Buy Pi
      • Buy Pi Accessories
      • Buy Books
    • Tools
      • Ultimate Raspberry Pi Alexa Skill
      • Pi Power Estimator App
      • Pi-Lite 14×9 LED Matrix Sprite Editor
      • RPiREF Pin-out Reference App
      • Simple Ohm’s Law Calculator
      • Web Sites & Links
    • Tutorials & Help
        Featured
        November 9, 20200

        Raspberry Pi Temperature Monitoring

        Recent
        February 16, 2024

        Disable SSH Password Login on Raspberry Pi

        December 23, 2022

        How to Add a Raspberry Pi Pico Reset Button

        November 20, 2022

        Pi Pico Onboard LED

      1. Contact Us
      2. Site Map
      Raspberry Pi SpyRaspberry Pi Spy
      You are at:Home»Software»Raspbian»Analysing Storage Usage on a Raspberry Pi with Ncdu
      Analysing Data

      Analysing Storage Usage on a Raspberry Pi with Ncdu

      0
      By Matt on October 28, 2017 Raspbian, Tutorials & Help

      Sometimes you need to find out what is using the space on your SD card. Raspbian includes a useful tool called Ncdu which can provide a breakdown of the space used by folders from the command line.

      Ncdu Disk Analyser

      The official Ncdu site states :

      Ncdu is a disk usage analyzer with an ncurses interface. It is designed to find space hogs on a remote server where you don’t have an entire graphical setup available, but it is a useful tool even on regular desktop systems. Ncdu aims to be fast, simple and easy to use, and should be able to run in any minimal POSIX-like environment with ncurses installed.

      Ncdu is installed by default on Raspbian but can be installed using the following commands if required :

      sudo apt-get update
      sudo apt-get install -y ncdu

      Running Ncdu

      Running the utility is as easy as typing ncdu in on the command line or in a terminal window :

      ncdu

      This will provide a breakdown of all the folders in the current working directory.

      Ncdu storage analysis So you can either browse to the directory you are interested in and then run ncdu or you can specify the path at the same time :

      For example :

      ncdu /home/pi

      or :

      ncdu /

      It will take longer to analyse more directories so you should target a specific path to limit the amount of file structure it needs to process.

      You can use the arrow keys to move through the list of directories and ENTER to drop down into the next level.

      Ncdu Keyboard Shortcuts

      Pressing ? should bring up some help but when I tested I needed to do SHIFT-? :

      Ncdu storage analysisNcdu storage analysis

      The keys include :

      • ? – Show help + keys + about screen
      • up, down j, k – Cycle through the items
      • right, enter, l – Open selected directory
      • left, <, h – Go to parent directory
      • n – Order by filename (press again for descending order)
      • s – Order by filesize (press again for descending order)
      • C – Order by number of items (press again for descending order)
      • a – Toggle between showing disk usage and showing apparent size.
      • d – Delete the selected file or directory.
      • t – Toggle dirs before files when sorting.
      • g – Toggle between showing percentage, graph, both, or none. Percentage is relative to the size of the current directory, graph is relative to the largest item in the current directory.
      • c – Toggle display of child item counts.e – Show/hide ‘hidden’ or ‘excluded’ files and directories. Please note that even though you can’t see the hidden files and directories, they are still there and they are still included in the directory sizes. If you suspect that the totals shown at the bottom of the screen are not correct, make sure you haven’t enabled this option.
      • i – Show information about the current selected item.
      • r – Refresh/recalculate the current directory.
      • b – Spawn shell in current directory.

      The symbols that may be seen next to items are explained on the “Format” tab :

      Ncdu storage analysis

      In conclusion this is a really useful command line tool to be aware of and I’m sure it will be useful to Pi users whatever projects they are working on.

      Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
      Previous ArticleKano Motion Sensor Kit for the Raspberry Pi
      Next Article Halloween Pumpkin with Servo Controlled Eyes

      Related Posts

      Disable SSH Password Login on Raspberry Pi

      How to Add a Raspberry Pi Pico Reset Button

      Pi Pico Onboard LED

      Leave A Reply Cancel Reply

      This site uses Akismet to reduce spam. Learn how your comment data is processed.

      Recent Posts
      February 16, 2024

      Disable SSH Password Login on Raspberry Pi

      March 13, 2023

      Elecrow Meteor IPS Touchscreen with RGB LEDs

      December 26, 2022

      Pi Pico Pinout Display on the Command Line

      December 23, 2022

      How to Add a Raspberry Pi Pico Reset Button

      November 20, 2022

      Pi Pico Onboard LED

      Categories
      • 1-wire
      • 3D Printing
      • Add-ons
      • BBC Micro:bit
      • BerryClip
      • Books
      • Camera Module
      • Cases
      • Events
      • General
      • Hardware
      • I2C
      • Infographics
      • Interfaces
      • Minecraft
      • Model A+
      • Model B+
      • News
      • Pi Models
      • Pi Pico
      • Pi Zero
      • Power
      • Programming
      • Python
      • Raspberry Pi OS
      • Raspbian
      • RetroGaming
      • Robotics
      • Sensors
      • Software
      • SPI
      • Tutorials & Help
      Tags
      Arduino audio battery berryclip Birthday bluetooth cambridge camera CamJam DigiMakers display games GPIO I2C interface Kickstarter Kodi LCD LED Linux media Minecraft Model A motionEyeOS PCB photography photos Pi-Lite Pi Pico power python Raspberry Jam Raspberry Pi Bootcamp raspbian Retrogaming retroPie screen SD card security sensor SPI SSH temperature ultrasonic video
      Raspberry PI Related
      • Adafruit Blog
      • Average Maker
      • Official RaspBerry Pi Site
      • Raspberry Pi Pod
      • RasPi.tv
      • RaspTut
      • Stuff About Code
      Tech Resources
      • MattsBits – Pi Resources
      • Microbit Spy
      • Technology Spy
      Archives

      Entries RSS | Comments RSS

      This site is not associated with the official Raspberrypi.org site or the Raspberry Pi Foundation. Raspberry Pi is a trademark of the Raspberry Pi Foundation.

      Copyright © 2025 - All Rights Reserved - Matt Hawkins

      About

      Unofficial site devoted to the Raspberry Pi credit card sized computer offering tutorials, guides, resources,scripts and downloads. We hope to help everyone get the most out of their Pi by providing clear, simple articles on configuring, programming and operating it.

      Popular Posts
      September 19, 2014

      Top 5 Reasons The Raspberry Pi Sucks

      July 27, 2012

      16×2 LCD Module Control Using Python

      October 20, 2013

      Analogue Sensors On The Raspberry Pi Using An MCP3008

      Latest Posts
      February 16, 2024

      Disable SSH Password Login on Raspberry Pi

      March 13, 2023

      Elecrow Meteor IPS Touchscreen with RGB LEDs

      December 26, 2022

      Pi Pico Pinout Display on the Command Line

      Mastodon YouTube Instagram Facebook Pinterest RSS

      Entries RSS | Comments RSS

      This site is not associated with the official Raspberrypi.org site or the Raspberry Pi Foundation. Raspberry Pi is a trademark of the Raspberry Pi Foundation.

      Copyright © 2025 - All Rights Reserved - Matt Hawkins

      mastodon.social@RPiSpy

      Type above and press Enter to search. Press Esc to cancel.