Linux Crash Course - The df and du Commands

Поділитися
Вставка
  • Опубліковано 17 чер 2024
  • In the Linux Crash Course series, we'll go over one important foundational Linux topic each episode. This series includes tutorials, demonstrations, and more! In this episode, we'll take a look at how we can determine how much storage we have remaining, and we'll also tackle how to determine which directories are using up the most space.
    Thanks to Linode for sponsoring the Linux Crash Course series! Check out their Linux-focused cloud platform and spin up your own Linux server ➜ learnlinux.link/akamai
    Brand LPI Linux Essentials Course Available
    Check out the new course on Udemy! ➜ learnlinux.link/lpi-course
    ➜ learnlinux.link/lpi-course
    Check out the Linux Shop
    In the official shop, you'll find Shirts, hats, stickers, bags and more!
    ➜ merch.learnlinux.tv
    5% discount on LPI exam vouchers
    After you finish Jay's new course, get 5% off an LPI exam voucher here:
    ➜ learnlinux.link/lpi-voucher
    Become a Patron
    Show your support for Learn Linux TV on Patreon and get access to exclusive perks!
    ➜ learnlinux.link/patron
    Become a Channel Member
    Show your support for Learn Linux TV here on UA-cam and get access to exclusive perks!
    ➜ learnlinux.link/member
    Mastering Ubuntu Server: 4th Edition
    Jay's latest book covers everything you need to know in order to master Ubuntu Server. It's available here:
    ➜ ubuntuserverbook.com
    Linux Gear and Kits
    Check out Jay's choice of hardware products, audio/video equipment, and more.
    ➜ learnlinux.link/amazon
    Grab an awesome Pi-powered KVM
    Support Learn Linux TV and grab yourself a TinyPilot KVM here:
    ➜ learnlinux.link/tinypilot
    Note: Royalties and/or commission is earned from each of the above links
    Time Codes
    00:00 - Intro
    01:06 - Spin up your very own cloud Linux server with Linode
    02:14 - Basic usage of the df command
    02:52 - Viewing "human readable" output with df
    03:42 - Understanding the output of the df command
    05:41 - Viewing filesystem types with the df command
    06:39 - Excluding filesystem types from the output of the df command (such as tmpfs)
    10:31 - Basic usage of the df command
    11:45 - Viewing "human readable" output with the du command
    12:10 - Using the "max depth" option with the du command
    14:08 - Viewing "summary" information with the du command
    14:41 - Executing the du command against multiple directories
    15:49 - Viewing the total size of multiple directories with the du command
    16:47 - Jay's favorite usage of the du command
    17:48 - Quick mention of the ncdu command
    Full Courses from Learn Linux TV
    • Linux Essentials Certification Workshop ➜ learnlinux.link/lpi-course
    • Linux Crash Course series ➜ linux.video/cc
    • Learn how to use tmux ➜ linux.video/tmux
    • Learn how to use vim ➜ linux.video/vim
    • Bash Scripting Series ➜ linux.video/bash
    • Proxmox VE Cluster Full Course ➜ linux.video/pve
    • Learn Ansible ➜ linux.video/ansible
    Linux-related Podcasts
    • Enterprise Linux Security ➜ enterpriselinuxsecurity.show
    • The Homelab Show ➜ thehomelab.show
    Learn Linux TV on the Web
    • Main site ➜ www.learnlinux.tv
    • Community ➜ community.learnlinux.tv
    • Enterprise Linux Security Podcast ➜ enterpriselinuxsecurity.show
    • The Homelab Show Podcast ➜ thehomelab.show
    • Content Ethics ➜ www.learnlinux.tv/content-ethics
    • Request Assistance ➜ www.learnlinux.tv/request-ass...
    Disclaimer
    Learn Linux TV provides technical content that will hopefully be helpful to you and teach you something new. However, this content is provided without any warranty (expressed or implied). Learn Linux TV is not responsible for any damages that may arise from any use of this content. The person viewing Learn Linux TV's content is expected to follow their best judgement and to make their best decisions while working with any related technology. Always make sure you have written permission before working with any infrastructure. Also, be sure that you're compliant with all company rules, change control procedures, and local laws.
    #LearnLinux #Linux #CommandLine
  • Наука та технологія

КОМЕНТАРІ • 67

  • @davelamont
    @davelamont 2 роки тому +9

    Your videos are always teaching me more about Linux. Keep em coming and I will keep watching and learning. Thanks for all you do.

  • @soubinan
    @soubinan 2 роки тому +8

    Thank you for this video :)
    There is also the so useful du command with the threshold option to filter only bigger files
    `du -h -t 100M /tmp/*` for example to show only files greater than 100MB in /tmp

  • @mason8714
    @mason8714 2 роки тому +1

    love learning new things from this channel - you are doing a great job Jay

  • @JayantBB78
    @JayantBB78 2 роки тому +1

    Wow. Another right to point, no nonsense video.
    Love your videos. Keep posting.

  • @bw_merlin
    @bw_merlin Рік тому +1

    This was super awesome and super helpful. Please keep this kind of content up.

  • @HopliteSecurity
    @HopliteSecurity 2 роки тому

    This was a game changer! Thank you so much for this amazing video and keep up the fantastic work ❤

  • @anandus3174
    @anandus3174 2 роки тому +7

    I'm a linux admin who always use du -sch * inside /var/log to find disk consuming logs. I didn't know the meaning of s & c switches 😅😅

    • @d00dEEE
      @d00dEEE 2 роки тому +1

      Ha ha, I do the same thing. I've got a bunch of commands that I use with switches that I just type from habit, probably looked them up decades ago, but forgot since then. 'netstat -tunlp' and 'ps -ealf' come to mind right away. I think I'll go man them now.

    • @anandus3174
      @anandus3174 2 роки тому

      @@d00dEEE yup. I use
      netstat -ntpl
      ps aux
      😅😅

  • @Enes-ho2rb
    @Enes-ho2rb 2 роки тому

    This is really awesome tutorial. Great work man.

  • @DL-xf3ur
    @DL-xf3ur 2 роки тому

    Thanks as always Jay. Excellent.

  • @srb1855
    @srb1855 2 роки тому

    excellent and very informative video - particularly the exclude option for df ... and the max depth option for du. 👍

  • @chillnacho
    @chillnacho 2 роки тому

    I love this crash course series.

  • @TheInternetFan
    @TheInternetFan 3 місяці тому

    so grateful for this video. I had a '/' directory that was 93% full. Gave the :
    du -sm /
    and it was hanging.
    I guess --max-depth 1 could have helped navigate the filesys in order to pin point which subdirectory was too heavy. thank you for teaching me this switch.

  • @ArniesTech
    @ArniesTech 2 роки тому

    Thanks as always for the informative content 💪🙏

  • @gauravsrivastava17
    @gauravsrivastava17 2 роки тому

    Learning Linux will be so easy with these videos

  • @omaralhalboosi2713
    @omaralhalboosi2713 2 роки тому +2

    You are amazing sir, thank you from my heart for making it so clear and understandable.. all respect to you and the family from Chicago 🇺🇸

  • @lawrencedoliveiro9104
    @lawrencedoliveiro9104 2 роки тому +1

    5:00 actually gibibytes. You need “-H” for decimal multiples, “-h” for binary.

  • @JohnBortins
    @JohnBortins 2 роки тому +2

    Outstanding!

  • @anthonychaple3031
    @anthonychaple3031 2 роки тому +1

    Great video man 👍🏻. Hey would you consider making a video simulating the RHCSA exam? This series would compliment that perfectly and honestly all other videos i can find simulating the RHCSA exam are very low quality, i think one from you would help a lot of people. Thanks beforehand

  • @voodooyam
    @voodooyam 2 роки тому +1

    one useful flag in du is the --time It shows the time of the last modification to any file in the directory or subdirectory that you run it against.

  • @auto117666
    @auto117666 2 роки тому +9

    Good stuff. I always learn something new about these 40 year old command line utils from this channel. :)

    • @BDBD16
      @BDBD16 2 роки тому +1

      30 Years as Linux was released 1991, if we are talking true Unix, try more like 50 years.

    • @shallex5744
      @shallex5744 Рік тому

      @@BDBD16 possibly older than 30 if the commands were made for the GNU system before Linux came along

    • @BDBD16
      @BDBD16 Рік тому

      @@shallex5744 I see what you did there you little daemon.

    • @shallex5744
      @shallex5744 Рік тому

      @@BDBD16 i don't think i did anything

  • @sairak3514
    @sairak3514 Рік тому

    Thank you so much!

  • @NekoiNemo
    @NekoiNemo 2 роки тому

    Thank you for mentioning ncdu. For some reason it's not mentioned often, especially to new users, and it's so much better for interactive use than just plain du. I wish somebody has told me about it years ago when i just started using linux

  • @carlallison9530
    @carlallison9530 2 роки тому

    Great teaching as usual the way you have mastery of the command line and how you move and insert different commands is a teaching within its self. please consider and do a teaching on how you move letters and commands and insert different commands with ease because to a newbie it's difficult to understand how you do what you do.

  • @mihai6564
    @mihai6564 Місяць тому

    thanks for the video

  • @undergrounder
    @undergrounder 2 роки тому

    Thank you!

  • @ciobysv23
    @ciobysv23 2 роки тому +1

    Regarding the output of the df -hT command is worth to mention that when using ext4, as the filesystem by default, 5% of the blocks will be reserved for the super-user, to avoid fragmentation and if we sum the output of the columns Used + Avail the value will be different from what's displayed in the Size column. (445 GB in this case) and the remaining 23 GB up to the displayed size of 468 GB is in fact the 5% reserved space. This reservation can be adjusted with the help of the tune2fs command.

  • @d00dEEE
    @d00dEEE 2 роки тому

    Thanks for the reminder about ncdu! I was thinking "what's that tui-based du that sorts by size?" for most of the video, but couldn't remember what it was called.

  • @fordprefect7779
    @fordprefect7779 2 роки тому

    Thanks!

  • @SteveMacSticky
    @SteveMacSticky 2 роки тому

    thanks very much

  • @wanak5795
    @wanak5795 2 роки тому +1

    thank you you are great teacher

  • @asdf51501
    @asdf51501 2 роки тому

    Good commands to know.

  • @lawrencedoliveiro9104
    @lawrencedoliveiro9104 2 роки тому +1

    11:58 Actually mebibytes. And unlike the df command, you add “--si” to ask for decimal units. (Calling them “SI” units is misleading, since the binary multipliers are also defined by SI.)

  • @10lauset
    @10lauset 2 роки тому

    .. Cheers to you. ..

  • @lawrencedoliveiro9104
    @lawrencedoliveiro9104 2 роки тому +3

    8:07 You can specify the -x option multiple times, if you want to exclude more than one filesystem type from the listing. For example, on my Debian system, I have a filesystem of type “devtmpfs” mounted on /dev.

  • @janis.eglitis
    @janis.eglitis 2 роки тому

    There's also a "gdu" command which you can install `sudo apt install gdu`.

  • @fazzanimohsen320
    @fazzanimohsen320 2 роки тому +1

    gooooooooood

  • @benmcwhirter4566
    @benmcwhirter4566 Рік тому

    Thanks. I just yeeted 24G from my home directory that I didn't no was there.

  • @BobDoe_69
    @BobDoe_69 2 роки тому

    nice

  • @lawrencedoliveiro9104
    @lawrencedoliveiro9104 2 роки тому

    15:28 And here’s another feature of using du on multiple directories: what happens when one directory is contained within another?
    For example, my current directory contains source code for some programming project. It also has a .git subdirectory containing the Git commit history for that project. If I do
    du -ks .

    • @lawrencedoliveiro9104
      @lawrencedoliveiro9104 2 роки тому

      that will show me the total usage for the entire directory. But if I do
      du -ks .git .
      now something wonderful happens: it first reports the usage for the .git subdirectory, then it shows the usage for the source directory _minus that of the .git subdirectory_ . So I see just the size of the current source tree, not including the commit history.

  • @TheFartfish
    @TheFartfish 2 роки тому

    Food for algorithm ;-)

  • @user-ge3fv1qj4u
    @user-ge3fv1qj4u 3 місяці тому

    I always facing problem of getting / of getting 100% full. but unable to find exactly what directories or miunt point in / directories.

  • @KR1ML0N
    @KR1ML0N 2 роки тому

    Could you not just use ./ for current dir?

  • @cleightthejw2202
    @cleightthejw2202 2 роки тому

    about the 'root drive'- if there are multiple drives is there only 1 that is root over all of them or is it ''root' from each drive? What would make it the 'root'? The fact that is it the initial and 'over all' controlling point that allows access to pretty much (if not) everything else?
    Also, what is a 'bootable' usb? Are al usb's bootable or no? If not, why not? What are instances of the differences- especially the bootable usb??
    Maybe you have vids on these already. I'm not aware of them if they do exist (obviously).

    • @bellatrix625
      @bellatrix625 2 роки тому +1

      There is always one root directory in a linux system. If you have multiple drives with Linux installed then you will have multiple root directories in corresponding drives. And if you want to use it in one linux system then you need to mount it there as normal directory/file and this directory acts as root for that mounted drive.

  • @rursus8354
    @rursus8354 2 роки тому

    *Kernel panic!* (Perhaps once or twice a year)

  • @jasonthomas5647
    @jasonthomas5647 Рік тому

    I installed 22.04 with standard “use entire disk” on my 170G SSD and df-H command says half of it is 100% full and I can’t acces the rest! I lonly have xfcedesktop and a few small programs running and it says it’s taking up 77G! No way! Now I can’t upgrade my system because it says there’s no more room. Something’s not right. How do I access the rest of the 80G and how do I clear out the bloat? I’m tempted to scrap the whole thing and start over!

  • @cyberhifi2629
    @cyberhifi2629 2 роки тому +2

    I think I am the first viewer of this video🙂🙂

  • @khawarbaig2074
    @khawarbaig2074 Рік тому

    i really like it from pakistan

  • @BashirAhmed-uh9pp
    @BashirAhmed-uh9pp 2 роки тому

    The good Device

  • @homelemon2579
    @homelemon2579 2 роки тому

    平衡

  • @BMcC78
    @BMcC78 2 роки тому

    Jay, the boring linux guy... this is great to fall asleep to.

  • @kennyroostam290
    @kennyroostam290 Рік тому

    why du -h - -max-depth 1 /home/jay shows more folders than sudo du -hsc /home/jay*?

  • @simonsonjh
    @simonsonjh 2 роки тому

    The -x option isn't much use on ZFS systems showing filesystems such as "rpool/USERDATA/simonson_mn5ygm"

  • @ManojKumarVishwas
    @ManojKumarVishwas 10 місяців тому

    du -h -d1 /var/

  • @predragnikolic1259
    @predragnikolic1259 2 роки тому

    Thanks!