Disk, filesystem
Disk usage
{linux}$ du -sh
{freebsd}$ du -sh
Count subdirectories in current directory:
{linux}$ du –max-depth=1
{freebsd}$ du -d1
Typical approach to find biggest directories/files on disk:
{linux}$ du –max-depth=1 -kx|sort -n
{freebsd}$ du -d1 -kx|sort -n
Find some kinds of files (regex is a mask for full path, no need for begin/end marks)
{linux}$ find . -regextype posix-extended -type f -regex “.*\.(java|class)”
{freebsd}$ find -E . -type f -regex “.*\.(java|class)”
Show open files and programs:
{linux}$ lsof
{freebsd}$ fstat
Some networking
Show open ports and apps connected to them:
{linux}$ netstat -apne –inet
{freebsd}$ sockstat
Kernel issues
Show loaded modules:
{linux}$ lsmod
{freebsd}$ kldstat
Load kernel module:
{linux}$ modprobe SomeModule
{freebsd}$ kldload SomeModule
Remove loaded module:
{linux}$ rmmod SomeModule
{freebsd}$ kldunload SomeModule
Popularity: 10% [?]





