Commonly used commands
From FreeBSDwiki
(Difference between revisions)
(Commonly Used Commands) |
|||
(One intermediate revision by one user not shown) | |||
Line 1: | Line 1: | ||
== Commonly Used Commands == | == Commonly Used Commands == | ||
− | + | <pre> | |
− | + | dmesg to display boot messages | |
− | + | dmesg -a to display boot messages plus started tasks | |
− | ls -l to display long version of file names | + | ls -l to display long version of file names |
ls cust* to display only file names prefixed with cust* | ls cust* to display only file names prefixed with cust* | ||
ps ax to display running tasks | ps ax to display running tasks | ||
Line 10: | Line 10: | ||
cat b >> a to append file b to end of file a | cat b >> a to append file b to end of file a | ||
halt to stop system before manual power off | halt to stop system before manual power off | ||
− | reboot to do clean shutdown and reboot the system | + | 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 | rm -rf /custom/ to delete directory and all its sub-directories | ||
dig ipaddr to find who owns that ip address | dig ipaddr to find who owns that ip address | ||
whois 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 | nslookup ipaddr to find who owns that ip address | ||
− | + | pkg_add -rv pkgname to add a package | |
− | + | ||
− | pkg_add -rv | + | |
pkg_info to list full names of all installed packages | pkg_info to list full names of all installed packages | ||
pkg_info | grep php* to list only matching names from packages list | 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 | 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 | touch /var/log/ppp.log to create empty file | ||
− | /etc/rc.d/netif restart to restart | + | /etc/rc.d/netif restart to restart network and get ISP IP address |
− | kill -HUP pid to re-read changes made to conf files | + | kill -HUP pid to re-read changes made to conf files |
ls -lh filename to display sparse file allocation size | ls -lh filename to display sparse file allocation size | ||
du -h filename to display sparse file used size | du -h filename to display sparse file used size | ||
systat -ifstat to display nic traffic amount | systat -ifstat to display nic traffic amount | ||
− | |||
last | grep boot to display list of dates system was booted | last | grep boot to display list of dates system was booted | ||
sysctl kern.boottime to display date of last system boot | 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 | sort -k 13.1,13.30 -k 8.1,8.15 filein > sorted.file.out | ||
Line 35: | Line 41: | ||
surounded by blanks. so 13.1,13.30 means sort on the 13 field in the | 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 | record starting at pos 1 of that field through pos 30 | ||
− | + | ||
− | + | </pre> | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
[[Category:FreeBSD for Servers]] | [[Category:FreeBSD for Servers]] | ||
[[Category:System Commands]] | [[Category:System Commands]] |
Latest revision as of 16:06, 6 August 2012
[edit] Commonly Used Commands
dmesg to display boot messages dmesg -a to display boot messages plus started 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 package 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