hitsqert.blogg.se

Mac os x command line find file
Mac os x command line find file





mac os x command line find file mac os x command line find file
  1. MAC OS X COMMAND LINE FIND FILE HOW TO
  2. MAC OS X COMMAND LINE FIND FILE PRO
  3. MAC OS X COMMAND LINE FIND FILE FREE
  4. MAC OS X COMMAND LINE FIND FILE MAC

MAC OS X COMMAND LINE FIND FILE MAC

We are going to use a parameter for the directory argument of the du command to make this command a little more flexible.The Terminal in OS X is a relatively powerful environment, where you have access to a number of scriptable tools that can help you configure, gather information, and otherwise use your Mac in ways that you cannot otherwise do with a mouse and graphical elements. In this file, we are going to define a function which will contain a slightly changed version of the command that we previously ran.

MAC OS X COMMAND LINE FIND FILE FREE

I chose dirinfo as a name, but feel free to change it if you would like to. Therefore, we can create an alias to this command.īased on your Terminal setup, head to the ~/.bashrc or ~/.zshrc file. Let’s be honest, remembering this command and the options can be quite hard. If you try to run it, you will get a list of the twenty biggest files on your current directory. We are also going to use the -n option to limit the output on a specific number of lines.įinally our command will look like this du -ah. For this reason, we are going to use the head command, which will help us get only the first lines of the input. Some times, directories may contain multiple quite small files that will only add noise and make the output much harder to read. | sort -rh and voilà the output is the list of files in descending order based on their disk usage.Ī further nice addition to this command would be some kind of limit on the results of the output. sort command also comes with some options that we are going to use like -r for reverse order and -h which will take into account the unit suffixes from the du command output. In order to do so, we are going to use the sort command. It would make it much easier if we could sort the output in reverse order, from the biggest file to the smallest. Such information is pretty helpful, but it’s quite hard to figure out which files are bigger. , you will get a list of your files and folder inside the ~/Downloads folder alongside with the info about their disk usage. Long story short, if you navigate to a folder using the Terminal, let’s say for example your ~/Downloads folder, and execute the command du -ah. The option -a can be used to display an entry for each file in the directory and -h outputs “human-readable” unit suffixes like, for example, K and M for Kilobytes and Megabytes respectively. For our scenario, we are going to use two of them -a and -h. This command comes with a few useful options which you can find by reading the man page (run man du on your Terminal).

MAC OS X COMMAND LINE FIND FILE HOW TO

Let’s start with how to find this files! How to find files and directories sizeĪ command that we can use to find the disk usage of a file or a directory is du.

MAC OS X COMMAND LINE FIND FILE PRO

Recently I faced this issue on my Mac Book Pro and as result I get a notification like the following:īut instead of just following the easy solution and moving my Desktop and Download folder to an external disk, I took this opportunity to delve deeper and find out what actually consume most of the storage disk.Īnd this is going to be the topic of this post I will try to elaborate my process of using a set of commands to find the resources that consume the storage of my Mac Book Pro.ĭisclaimer: This post is meant for Unix System users. Have you ever ran into issues with your storage disk being full?







Mac os x command line find file