pavement

Commonly used commands

From FreeBSDwiki
Revision as of 16:03, 6 August 2012 by 173.88.199.104 (Talk)
Jump to: navigation, search

Commonly Used Commands

dmesg                   to display boot messages
dmesg -a                to display boot messages plus start tasks
ls -l                   to display long version of file names
ls cust*                to display only file names prefixed with cust* 
ps ax                   to display running tasks
ifconfig -a             to display assigned IP address of Nic cards 
cat b >> a              to append file b to end of file a
halt                    to stop system before manual power off
reboot                  to do clean shutdown and reboot the system
vipw                    to edit contents of system user password DB 
rm -rf /custom/         to delete directory and all its sub-directories
dig ipaddr              to find who owns that ip address
whois ipaddr            to find who owns that ip address
nslookup ipaddr         to find who owns that ip address
pkg_add -rv pkgname     to add a pkg
pkg_info                to list full names of all installed packages
pkg_info | grep php*    to list only matching names from packages list
pkg_delete mc-4.6.1_4   to delete pkg use full name from pkg_info list  
touch /var/log/ppp.log  to create empty file
/etc/rc.d/netif restart to restart network and get ISP IP address 
kill -HUP pid           to re-read changes made to conf files
ls -lh filename         to display sparse file allocation size
du -h  filename         to display sparse file used size
systat -ifstat          to display nic traffic amount
last | grep boot        to display list of dates system was booted
sysctl kern.boottime    to display date of last system boot
diskinfo -v /dev/da0    to display firmware head/cyl/sector sizes

dd if=/dev/zero of=/dev/da0 count=2  to zero out Master Boot Record
dd if=/dev/da0 count=1 | od -c       to display Master Boot Record

chmod 770 *.php      to give rwx permission to all files ending with php
chown www *.php      to change owner of all files ending with php to www
man xxxxx | col -b > xxxxx.txt  to create text file of manual page

sort -k 13.1,13.30 -k 8.1,8.15 filein > sorted.file.out
  -k = the key fields to be sorted. A field is defined as any data
  surounded by blanks. so 13.1,13.30 means sort on the 13 field in the
  record starting at pos 1 of that field through pos 30
 
Personal tools