13
2009
Freebsd usefull commands
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
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
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
Program development
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
Packages management
Different linux distros make it own way. I’ll focus on debian-based distributions like Debian, Ubuntu, Kubuntu etc.
Find which package this file belongs to?
{freebsd}$ pkg_info -W /path/to/checked_file
{linux}$ dpkg -S /path/to/checked_file
Have we got a package like… (in (k)ubuntu you can use more friendly tools like synaptic, apt-get)
{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
Leave a comment
Kategorije
- Ostalo (161)
- Računalništvo (266)
- Centos (34)
- CSS (2)
- FreeBSD (37)
- jQuery (1)
- MySQL (8)
- Na spletu dogaja … (124)
- Netbeans (4)
- PHP (20)
- Symbian (3)
- Ubuntu (32)
- Windows (5)
- Zend Framework (6)
- Zend Studio (1)
Blogroll
Arhiv
- February 2011 (5)
- December 2010 (4)
- November 2010 (2)
- October 2010 (5)
- September 2010 (6)
- August 2010 (5)
- July 2010 (10)
- June 2010 (9)
- May 2010 (10)
- April 2010 (8)
- March 2010 (12)
- February 2010 (19)
- January 2010 (20)
- December 2009 (10)
- November 2009 (1)
- October 2009 (3)
- September 2009 (2)
- August 2009 (9)
- June 2009 (11)
- May 2009 (5)
- April 2009 (6)
- March 2009 (9)
- February 2009 (15)
- January 2009 (10)
- December 2008 (17)
- November 2008 (20)
- October 2008 (16)
- September 2008 (48)
- August 2008 (56)
- July 2008 (35)
- June 2008 (35)
An article by




