*NIX下常用实用操作总结

find命令
find . -type d -name ‘www’
find . -name ‘.svn’ -exec rm -rf {} \;
find . -name ‘index.php’ -exec vim {} \;
find . -name ‘index.php’

防火墙
=========================================
开放端口:
/sbin/iptables -I INPUT -p tcp –dport 80 -j ACCEPT
/sbin/iptables -I INPUT -p tcp –dport 3306 -j ACCEPT
/sbin/iptables -I INPUT -p tcp –dport 22 -j ACCEPT
然后保存:
/etc/rc.d/init.d/iptables save

查看开启的端口:
/etc/init.d/iptables status

关闭和重启防火墙:
/etc/init.d/iptables stop
/etc/init.d/iptables restart

scp-P 2280 [email protected]:/root/back.sql ./

 
查看本机的对外IP是什么: curlifconfig.me
 
检查从本机到服务器所经过的路由情况:
mtr www.baidu.com
traceroutewww.baidu.com
 
列出头10个总耗内存的进程:psaux |sort-nk +4 |tail
 
列出本机监听的端口号:
netstat-tlnp
netstat-anop
 
gearman
===========
查看状态:/usr/local/gearman/sbin/gearmandstatus
 
时间
===========
把时间转换成时间戳:date-d"2012-09-09 12:12:12"+%s
当前日期的时间戳:date+%s
把UNIX时间戳转化为标准时间:date-d @1352560872 +%Y%m%d
 
vim
===========
全选快捷键:ggVG
插入当前时间::r !date
 
Mysql
============
from_unixtime(Unix timestamp)
SELECT unix_timestamp(now())
show processlist;
添加用户并加权限:
CREATE USER Jacky IDENTIFIED BY'pwd';
grant insert,delete,update,select,drop,create on *.* to Jacky@"%"identified by"pwd"; 
 
/usr/local/mysql/bin/mysqldump-uroot -p testtable >backup.sql
/usr/local/mysql/bin/mysql-uroot -p testtable < backup.sql
 
mac相关
==========
UltraEdit快捷键:
shift+ option + d 复制当前行到下一行。
command+ l 跳转至行、列
option + enter 显示选中文字的各种进制表示
option +command+ w 自动折行
command+ , 首选项设置
 
svn
=========
svndiff-r 987 da.php 查看当前

你可能感兴趣的:(*NIX下常用实用操作总结)