This is good enough, you can just see which files you can delete and free some space, but the problem is that you will not find any file which is larger than 1GB, hence I always use this command with some hypothetical large number like 10GB, etc, but, those are just workaround, not the proper fix. Here is %s is for size and %p is for the path.Īlternatively, You can also use -exec option to run ls on each file the find command return to print its size as shown below: Here is the modified UNIX command to find large files with size : You can further tweak the command to find files up to a certain size like the below command will find all files. Finding big files using the find command in Linux The problem was solved by using the -printf option, which allows you to specify a format String much like Java's printf() method.ġ. The only problem with this one is that it doesn't print the exact size. This command will print all the files which are greater than 1GB from the current directory and any subdirectory. I wasn't able to locate that because it wasn't in the log directory, then I come to know about the find command which let you search sub-directories for large files as shown below: They worked well until one day our server died due to a huge cache file. When I was new to Linux, I don't have any other choice but to go to the log directory and look for old files that are larger than the rest and delete them. If you are running Java applications like core Java-based programs or web applications running on Tomcat then you can remove those heap dump files and free some space, but the big question is how do you find those? How do you know the size of the biggest file in your file system, especially if you don't know which directory it is? We'll try to find answers to some of those questions in this article. Usually, old files, large Java heap dumps are good candidates for removal and freeing up some space. Suppose, your file system is full and you are receiving an alert to remove spaces or if your host is run out of space and your server is not starting up, the first thing you do is f ind the top 10 largest files and see if you can delete them. One of the common problems while working in Linux is finding large files to free some space.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |