advanced command freebsd

tar Command Through Network Over SSH Session :

# tar cvfz – /wwwdata | ssh root@ “cat > /backup/wwwdata.tar.gz”


restore tar backup over ssh session:

# cd /
# ssh root@ “cat /backup/wwwdata.tar.gz” | tar zxvf –


restart network service over ssh session :

# /etc/rc.d/netif restart && /etc/rc.d/routing restart


Find Information About The Process Including All Command Line Parameters

$ ps auxww


$ ps auxww | grep –color mysqld 


vi / vim perform search and replace operation

Simple format is as follows:

To replace all occurrences of word foo with bar on all lines, use the g option:

Find and Replace with Confirmation

Case Insensitive Find and Replace

Case sensitive Find and Replace


Rsync: Preserve / Copy Hard Links ( Backup Rsnapshot Directory Tree )

#rsync -az -H –delete –numeric-ids /path/to/source server2:/path/to/dest


  1. -a : Archive mode (i.e. recurse into directories, and preserve symlinks, file permissions, file modification times, file group, file owner, device files & special files)
  2. -z : Compress file data during the transfer
  3. -H : Preserve hard links (i.e. copy hard links as hard links)
  4. –delete : Delete extraneous files from the receiving side (ones that aren’t on the sending side), but only for the directories that are being synchronized i.e. keep exact replica of your /raid6/rsnapshot directory.
  5. –numeric-ids : Transfer numeric group and user IDs rather than using user and group names and mapping them at both ends.
Freebsd Mount a NAS via SMB / CIFS
#mount_smbfs -I //username@nasserver/share /path/to/local/mnt
Apache: Make Changes In a Config File Take Effect Without Restarting Server
# /etc/init.d/httpd reload
# apachectl -k graceful