El Capitan - Built in file path copy function Yosemite users must now follow a complicated procedure of creating a Service to do this simple task or take the path directly from the command line. Yosemite users special noteĪpple removed the ability to easily copy the file path in OS X Yosemite. You can have it show a graphical path, but getting just the text based path to a directory (for use in the Terminal for example) requires a couple of extra steps. We are going to use a parameter for the directory argument of the du command to make this command a little more flexible.Mac OS X doesn’t have an obvious way to view the exact text based path to a folder (otherwise known as a directory) in the finder window. In this file, we are going to define a function which will contain a slightly changed version of the command that we previously ran. 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). 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. 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?
0 Comments
Leave a Reply. |