Find file size linux terminal12/26/2023 What if you only need the size of the current directory you are in ? Use the -s parameter and a single line showing the size is displayed. In the previous examples you would’ve noted that the entire list of files and directories in the current location are displayed. Look at the screenshot below for du -h in action The du -h command displays the file and directory sizes in units Display the size in one line A parameter -h will display sizes in KB, MB or GB according to the file size which makes it human readable. So earlier when the sizes of the directories were displayed it was difficult to interpret whether the displayed size was in KB or MB and several digits were displayed for files of huge sizes which would’ve left you confused. Not so useful isn’t it ? Lets move on to something more useful. Just entering the du command will show the entire list of files and directories in the current directory with their sizes in KB, the last line shows the size of the entire directory without any units. So the correct command for this purpose is “ du“ Display sizes of all files and directories The “ls” command in Linux shows a list of files and directories in the present directory but doesn’t show the sizes of directories and the file sizes are shown in bytes which makes it difficult to read and understand. A good example is showing the sizes of directories while listing the contents. But unlike the command line in windows, Linux command line works differently. Even though Linux has developed so much in terms of GUI which has become comparable to the latest Aero theme from Microsoft’s stables (especially in KDE environment) the command line becomes an inevitable tool for performing advanced administrative tasks like setting user quotas, compiling from the source to name it a few.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |