 I ran into an issue this morning with one of my web servers. I've got a NextCloud server that is actually sitting on an Ubuntu server that I installed NextCloud via the Snap package because on an Ubuntu server, it really makes sense to use snaps to install things like NextCloud, for example, because the Snap package, of course, has all the dependencies. It's got the entire LAMP stack, Apache, MySQL, and all of that PHP. It's got all of that bundled up in the Snap package. And that's one of the really beautiful things about Snap packages is actually snaps on the server are fantastic. So all I did was spun up in a Ubuntu server a couple of years ago, did a Snap installed NextCloud, and I've had this NextCloud server running for about two years, and I use it really as a file syncing service to sync all the files on my workstation here at the office with my home computer, as well as my laptops if I carry them out of town on a vacation or something or on a trip. It really makes things convenient because I can have some of my work documents like show notes or even video files, things like that. I can edit them on one machine and those changes are synced to all of my machines via the NextCloud server that I've been running for, again, the last couple of years, but today I got up, my NextCloud server was not working. It was down. So naturally, I had to spend a couple of hours this morning investigating the issue and it's one of those things, you know, troubleshooting Linux on the desktop and troubleshooting Linux on the server are very similar because typically all you do is you go to the command line and if you know some of the basic GNU core utils, you can quickly investigate the issue. You can find what the problem is on that system and correct it. Let me show you some of the steps I went through this morning to get my NextCloud server back up and running. So let me switch over here to my terminal here on my Linux desktop and the first thing I had to do was I needed to SSH into that remote web server, right? Because if I'm going to investigate the problem on that server, I need to switch over to that server via SSH. So, you know, you SSH like this, you run SSH space and then the name of the user, for example, Derek, if the user name is Derek that I want to log in as or root, if I can log in as root and then some IP address, something like I don't know, I'm just going to make up some IP address, but it'll look like this, right? I'll SSH and then name of user at IP address, hit enter, and then, of course, I've got to know the root password for that particular machine I'm SSHing into, but of course, I knew the password and then once you log in, you know, now your command prompt changes and you're now on that remote server, all the commands you enter at that point will take effect on the server, not your local machine. So the first command I entered was the DF command because I've encountered problems on web servers before, especially when you're hosting things that collect large amounts of data. In this case, this next cloud server, I host a rather large amount of files on this thing. I ran the DF command. DF tells you the disk space being used on your system, essentially. If I DF with no other arguments, it's going to list all of your block devices, all your loop devices and tell you how much space is being used. You can see use percentage. Now, of course, this is my local machine. This is not the remote server, but just imagine we were on my remote server, the next cloud server here, and imagine this is the main drive in that server. And you can see that's the root file system. And you can see I have used up 57% of the root file system here on my local machine. Well, when I ran the DF command on my next cloud server, the usage percentage was actually 100%. So that is not good. When you have 100% of the storage being used on your system, obviously that's a problem. That's going to cause a pretty much a denial of service. The server's no longer going to work, right? Whenever I went to the web page for my next cloud, you know, nothing happened. It's because essentially that machine is essentially frozen at that point. It was actually running, but it couldn't do anything because there just wasn't any free space available for it to do any kind of rights to the disk. So once I knew that the drive was full, I knew I needed to actually delete the directories, the files. I needed to create some space. And what I wanted to do is I wanted to find the problem directories on that system that were taking up so much space because my next cloud server has a 80 gig drive, SSD drive. And I knew I wasn't storing 80 gigs of stuff in my next cloud directory here on my workstation. I've only got about 15 or 16 gigabytes of actual data that I'm syncing to my next cloud server. And then the Ubuntu server operating system probably takes up another 10 or 15 gigs of space. So really this 80 gig drive shouldn't have been fine because I probably should only be using about 30 to 35 gigs of space on that 80 gig SSD. Why is the drive full? Something was not right. And what I did after that, now that I knew the drive was full, I ran the du command, du for disk usage. What this does, if I do it on my root file system, it's gonna take forever. I'm gonna cancel it, but what it does is it scans every directory in the root file system and tells you how large each directory is. Now that's really nice because what you can do with the magic of piping, you could do something like du and you could give du the dash a flag for all, meaning all of files and directories on the system because sometimes you could have some very large just single files on the system and you want those listed as well. And then you give it a path. If you don't wanna do the root file system, you would do something like slash home slash dt or on my next cloud server, I could do slash var slash snap. I think it's the pass slash next cloud or whatever it happens to be. But here on my system to show you this in action, I'll do slash home slash dt. And I'll pipe this du command into sort because I don't want just a random bunch of gibberish outputted because there could be hundreds of thousands of directories in this list, right? Now I want you to sort it and I want you to give me the biggest directories. I'm not interested in the small directories at all. I want the biggest. So what I'm gonna do is I'm gonna do a dash in. So this is a numeric sort. So give me essentially a numerically sorted list dash r. So give me the biggest directories first because by default it would do it the opposite, right? It would start with the smaller directories in the list but I actually want the biggest ones first. And then I'm also gonna pipe this into head because I don't want every single line of output in this. I really only want, I would say the 20 largest directories on the system. And if I run this, it's going to take a minute because it's going to scan my entire home directory depending on what directory you run this on. It could take a minute and I'm getting some permission denied errors here because I do have some root protected files in my home directory but I could have of course used sudo or simply logged in as root to run this. But here you have it, the output of the 20 largest directories in my home directory including the top level, right? Which is the home directory itself but you can see my music directory has 109 gigabytes of space taken within it. And within it, my music slash classical directory is 85 gigs of that. You can also see my virtual box virtual machines take up a ton of space in my home directory. The largest VM is my Windows 10 VM. You can see my trash directory has a bunch of stuff in it as well. The videos directory of course on my system is typically one of the largest ones because video files are very large. Those are the files that I'm recording like right now making this video. And of course the Steam directory is rather large. So this gives me an idea of some of the space that's being taken up here on my local machine. Now when I ran this on my NextCloud server, the directory that was the biggest one and it didn't make any sense was this directory named this slash var slash snap slash NextCloud yada yada yada slash user slash files underscore trash bin. So there is a trash bin in NextCloud. And I didn't realize this. What happens when you move files, delete files on a NextCloud server? Well, I guess it sends it to a trash bin. And this trash bin directory had about 48 gigs of stuff in it. So this 80 gig SSD drive on this Ubuntu server, well over half of it was stored as trash files in this trash bin. So that was actually what had essentially caused my NextCloud server to cease to exist, to cease to work. So after I SSH'd into my NextCloud server, obviously I did a RMRF to remove this directory. Actually I didn't remove the directory, I actually cd'd inside the directory and I did a RMRF of all the files in that directory. And then once I deleted those files, you know, I rebooted the machine just to be on the safe side. And then, you know, I've got my NextCloud back up and running. I've got the little SysTrade icon here for NextCloud. You can see my last sync was successful. So my files on this computer, my workstation here at the office and my home computer, everything is back in sync. Because honestly, without that NextCloud server, it would make my life a living hell, having to sync so many files from various computers that I use. And some of these files are rather large, especially once you start dealing with audio files and especially video files. You know, then if I didn't use something like a NextCloud server to sync these machines, I'd probably have to use like physical devices, like external USB hard drives and things like that to move some of these video files around and things like that. So I'm really happy that I was able to solve this problem. And it's one of those things I like showcasing some of this kind of real world troubleshooting on camera because I'm not the only one that runs into these problems. Sometimes, especially if you're kind of new to Linux, new to how some of these command line tools like DF, DU, SORT, all these GNU Core Utils that I sometimes show on camera, you know, this is the reason you need to know these things because they do come in handy. And if you're unsure on how to use some of these commands like DF, DU, SORT, and some of the other GNU Core Utils, check out my command line playlist. I've got a playlist that's got probably 50, 60, maybe even more videos than that in it where I have made videos on pretty much most of the really important command line utilities that everyone should learn if they're using Linux. Now, before I go, I need to thank a few special people. I need to thank the producers of this episode. Gabe James Matt, Paul Wess, Armor Dragon Commander, Angry George Lee, Methos Nate, Erion Paul, Peace, Archive of the Door, Realities for Less Red Profit, Roland, Soul-Ashtree Tools, Devler, Wardji, Nduon Abuntu, and Willie. These guys, they're my high-steered patrons over on Patreon. Without these guys, this quick episode about me having to figure out why my disc was full on my next cloud server, it wouldn't have been possible. The show's also brought to you by each and every one of these fine ladies and gentlemen. All these names you're seeing on the screen right now, these are all my supporters over on Patreon. If you like my work, wanna see more videos about Linux free and open source software, please help support my work through Patreon. Subscribe to DistroTube over on Patreon. Peace, guys.