methodnanax.blogg.se

Check disk space mac command
Check disk space mac command







Together, they will help you better understand how disk space is used on your server.

check disk space mac command

What’s great, users can get a more specific result by combining du and df with other commands, such as sort, grep, and exclude. You are allowed to add certain options (like -h, -m, -k, etc.) to refine the output based on your needs. Conclusionĭf and du commands are file management tools that will check disk space in Linux and display all stored files on your machine. The –exclude=”.txt” argument makes sure the du command will display all file formats except for. For instance: du -h /home/user/Desktop/ -exclude="*.txt" The last combination is useful when you need to exclude a particular file format from the search results. If you want to single out 1 MB+ data, you can replace G with M. In this example, the script will return with any files bigger than 1 GB. The grep command allows us to search for files based on a specified pattern. The most effective way to do that is by using the command below: du -h /home/user/Desktop | grep '^\s*\+G' Let’s say you want to see all files that are above a certain size. If you’re not cautious, you might delete essential files that would break your project. Remember that you shouldn’t necessarily delete files just because they are large. The combination should look like this: du -h /home/user/Desktop | sort -rn The script will sort all the files and folders from largest to smallest to check the disk space use in Linux. Then, we pipe the result to the sort command together with the -rn option. Sorting Files By Sizeįirst, we gather files and folders on the Desktop in a readable format using the du command. After that, you can proceed with these combinations. Just remember to start with df command to see which file system needs a cleanup the most.

Check disk space mac command free#

By doing this, you will get a better idea of which files you can delete to free up disk space. You can get more information done by combining df and du command with other arguments.

check disk space mac command check disk space mac command

  • df –help - it displays a list of available options and what they can be used for.Ĭombining Commands and Cleaning Disk Space.
  • du -h - time /home/user/Desktop - this informs the last modification date of the displayed folders and files.
  • du -m /home/user/Desktop - the -m option provides us with folder and file sizes in Megabytes (we can use -k to see the information in Kilobytes).
  • du -sh /home/user/Desktop - the -s option will give us the total size of a specified folder (Desktop in this case).
  • du -h /home/user/Desktop - just like with df, the option -h displays information in a human-readable format.
  • du /home/user/Desktop - this command line allows users to see into the disk usage of their Desktop folders and files (subdirectories are included as well).
  • Let’s take a look at real-world use of the du command with the Desktop directory: With the du command, you need to specify which folder or file you want to check. It will show you details about the disk usage of files and directories on a Linux computer or server.
  • df - help - it lists down other useful options that you can use, complete with their descriptions.Ĭheck Disk Usage in Linux Using the du CommandĪnother important command is du, short for Disk Usage.
  • df -ht /home - it allows you to view information about a specific file system in a readable format (in this case /home file system).
  • df -T - this option will show the file system type (a new column will appear).
  • check disk space mac command

  • df -k - to display file system usage in KB.
  • df -m - this command line is used to display information of file system usage in MB.
  • df -h - it will display the result in a human-readable format.
  • Mounted On - tells us the mount point of a particular file system.īy adding a certain option to the df command, you can check the disk space in Linux more precisely.
  • Use% - displays the percentage of disk space that is used.
  • Available - shows how much space is left in the file system.
  • Used - shows how much disk space is used in the particular file system.
  • Size - gives us the total size of the specific file system.
  • FileSystem - provides the name of the file system.






  • Check disk space mac command