Commands
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 pen files and programs:
{linux}$ lsof
{freebsd}$ fstat
Real time disk usage (is there something which shows results for every disk in linux?):
{linux}$ vmstat 3
{freebsd}$ iostat 3
Swap info:
{linux}$ free
{freebsd}$ swapinfo
Show open ports and apps connected to them:
{linux}$ netstat -apne --inet
{freebsd}$ sockstat
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
Trace the system calls of a program:
{linux}$ strace
{freebsd}$ truss
(strace is also available in /usr/ports/devel/strace)
libraries - show all paths + libs:
{linux}$ ldconfig -p
{freebsd}$ ldconfig -r
Find which package this file belongs to?
{freebsd}$ pkg_info -W /path/to/checked_file
{linux}$ dpkg -S /path/to/checked_file
{linux}$ apt-cache search your_name
{freebsd}$ cd /usr/ports; make search key=your_name
make search name=pear display=name,path
you can also try simple locate (only in package names):
{freebsd}$ locate -i your_name | grep "/usr/ports/"
Install a binary package
{linux}$ apt-get install package_name
{freebsd}$ pkg_add -r package_name
In FreeBSD you have packages made in distribution release time - unfortunately there are no binary upgrades for released version)
Install a package from sources
{linux}$ apt-src
{freebsd}$ cd /usr/ports/path/package; make install clean