space snippets

How to list and sort directories by size in Linux/Unix

Tagged list, directories, size, du, sort, disk, harddisk, space  Languages bash

For human-readable output use the following command:

du -sh /* | sort -h

Use this command to find the directories taking up the most space:

du -k | sort -nr | more

The du command along with the -k switch lists all directories and their respective size in kilobytes. The sort command sorts the output so that the largest directory is shown first in the list. The -nr switch reverses the list and uses only numbers when sorting.

Here’s an example of the output:

12939451  .
1814892  ./abcdef
1219582  ./abcde
839586  ./abcd
718330  ./abc
695610  ./ab
690380  ./a

How to fix "command not found:  grep" on OSX

Tagged key bindings, alt, space, whitespace, ruby, grep  Languages bash

This issue will bite everyone who touches a keyboard. This fixes, e.g., the following issues: * command not found:  grep (Shell) * undefined local variable or method (Ruby) *

First, do this:

mkdir -p ~/Library/KeyBindings/
vim ~/Library/KeyBindings/DefaultKeyBinding.dict

Then paste this:

{
  "~ " = ("insertText:", " ");
}

Save the file.

Quit and reopen applications to apply the new key bindings in DefaultKeyBinding.dict.

References

http://osxnotes.net/keybindings.html http://linuxtoosx.blogspot.fi/2010/10/disabling-option-space-and-altgr-space.html

MacVim

For MacVim i have yet to find a solution for insert mode, so just use vim in the terminal...