Notes
Work with ports:
check dependence of not installed port:
make pretty-print-build-depends-list
check dependence of installed port:
pkg_info -r mysql-server-5.1.51_1
Hdd:
gstat
- display file or file system status
top -m io
– god way to see which application works with hard disk
tunefs -p /dev/ad2s1a
– show enabled\disabled features
smartctl -a /dev/ad1
– S.M.A.R.T information (more)
Files Operations
How to find text in the files of directory:
grep -rl 'howtobsd' ./
– Will find files which contain word “howtobsd”.
How to delete all .svn files:
find ./ -name ".svn" | xargs rm -Rf
How to find files which was changed recently (1 minute ago):
find ./ -mmin -1
How to find files with bigger\lesser size:
find -size +10M
How to calculate files recursively in directory:
ls -l -R ./ | grep ^- | wc -l
change permission only for directories (777) :
find ./ -type d -exec chmod 777 {} \;
change permission only for files (755) :
find ./ -type f -exec chmod 755 {} \;
copy file from remote server by ssh (into current dir):
scp user@10.3.151.11:/home/user/filename.txt ./
How to remove files which has some string:
grep -rl 'searchstring' ./ |xargs -i rm ./{}
Network Settings
Change default router:
#route delete default
#route add default 192.168.1.1
Change IP adress:
#ifconfig rl0 inet 192.168.1.23 netmask 255.255.255.0
Get IP using DHCP-client:
#dhclient re0
MYSQL notes
Replace matches symbols or strings in database by SQL query:
UPDATE table_name SET column_name= replace (column_name, 'string from', 'string to');
Leave a Reply