Suggestioncd to a directory you have access to. I had already a situation where an application was (wrongly) creating thousands of small files, and it was hard to find out the disk space's offender. Luizfnpinho said:I was wondering what would be the best way to list the most dense folder, in terms of disk occupation. Once complete it will return the top ten largest files / directories, their sizes and locations. It will take a little time to run as it needs to check every directory of the filesystem. sudo du -aBm / 2>/dev/null | sort -nr | head -n 10ģ. | head -n 10 will list the top ten files/directories returned from the search. | sort -nr is a pipe that sends the output of du command to be the input of sort which is then listed in reverse order. is the root directory, the starting point for the search.Ģ>/dev/null will send any errors to /dev/null ensuring that no errors are printed to the screen. Use the du command to search all files and then use two pipes to format the returned data.ĭu -aBM will search all files and directories, returning their sizes in megabytes. What are the top ten files or directories on our machine? How large are they and where are they located? Using a little Linux command line magic we can target these files with only one line of commands.Ģ. sudo find / -type f -size 100M Finding the 10 Largest Linux Files on Your Drive You should be able to scroll through the returned results and see that the larger files on the pen drive have been included in the results. For this example connect a USB drive with a collection of files on it including some that are over 100MB in size. Search all filesystems for files larger than 100MB. Note that we are using / to set the command to search the entire filesystem from the root of the filesystem. As we are invoking root privileges using sudo we will need to input our password. Search the current filesystem for files larger than 100MB. We might also want to either limit the search to the current filesystem which can be achieved via the -xdev argument, for example when we suspect the files we seek are in our current main filesystem or we can choose not to add the -xdev argument which will then include results from other mounted filesystems, for example an attached USB drive.Ģ. To search the entire filesystem, we will need to use the command with sudo. We may have some files hidden away in our home directory that need removing. It’s sometimes useful to search the whole Linux filesystem for large files. test -type f -size 100M Searching the Whole Linux Filesystem For Large Files This means we can search the test directory from the home directory. We can run the same command as in the previous section but replace the “.” with a specified path. Use the same command, but this time specify a path to search. We only have one file in our test folder Baby_Yoda.obj that is larger than 100MB. Finally the 100M argument specifies that the command will only return files larger than 100MB in size. The -type f argument specifies returning files as results. We are working inside our test directory and the “.” indicates to search the current directory. Use find to search for any file larger than 100MB in the current directory. We can also use the find command in combination with the -size argument specifying a size threshold where any file larger than specified will be returned.\ġ. internal WiFi adapter failed, so use wired ethernet.In another article, we explained how to find files in Linux using the find command to search based on a filename or part of a filename. Screen hinges show fatigue cracks on the clamshell screen damaged when dropped hence ext monitor battery dead, touchpad barely usable, and keyboard pretty knackered, hence ext kb and mouse. Other Info: Originally XP home x86 U/G to Pro, U/G Windows7 Pro, U/G Windows 10 Pro Monitor(s) Displays: Advent (Mirage driver) dfmirage.sys 2.0.105.0 Graphics Card: Mobile Intel® 915GM/GMS, 910GML Express Chipset Family System Manufacturer/Model Number: Acer Travelmate 2423 It lives in a case with 8 drive bays, and runs several multibooting systems - from Windows XP to 10, and some Linux distributions without problems, and generally with good speed. Almost all of it was thrown out as trash at some time! The keyboard and mouse, and the Graphics Card cost about £20 altogether. Other Info: This is seriously old kit - dating back to early 2005. Hard Drives: 2 Seagate 500 GBs, Maxtor 300GB, WD160 all rescued from old Sky and NTL STB throwouts. Monitor(s) Displays: Hewlett Packard HP vs17 Sound Card: on-board Realtek High Definition Audio Graphics Card: GeForce 9500GT 512MB driver version 341.92 Motherboard: Fujitsu Siemens ASUS P5GD1-FM/S AMI BIOS 1005.1001 System Manufacturer/Model Number: Fujitsu Siemens Scaleo P AMI BIOS 1005.1001 ĬPU: Intel socket 775 Pentium 4 540 HT 3200 Prescott
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |