la/nmp 常见操作

linux

-> find ./ -name "*think*" -exec mv {} ./newDir \; // 可以用 . 代替  ./ 表示当前目录
-> find ./ -name "*think*" -exec rm -rf {} \;
-> useradd -s /sbin/nologin -M redis // 创建一个不能登陆系统(-s /sbin/nolog),没有用户主目录(-M)的用户 redis;
-> sudo -u redis /<redis-server-path>/redis-server /<configpath>/redis.conf // 用 redis 用户启动 redis-server
-> chmod 600 /<filepath>/redis.conf // 修改文件权限 读4,写2,执行1。
-> top // 显示cpu,内存 等信息;q:退出;P:cpu排序;M:内存;
-> du -sh [./*]|path // 计算当前/指定目录的大小;
-> tar -zvcf new_file.tar.gz file|directory // 压缩文件;
-> grep -rn "string" * // 当前目录内,递归查找字符串,并显示行数

vi / vim

ctrl + s 锁屏,ctrl + p 解锁;
u 撤销,ctrl+r 还原
ctrl+b,ctrl+f 上翻页下翻页
/string // 直接查找;n:下一个; 
:s/string1/string2/g 查找 string1 替换为 string2 当前行
:%s/string1/string2/g 当前文件内

Mysql

-> /etc/init.d/mysql start/stop/restart // 重启服务
-> service mysql start/stop/restart // 重启服务
-> mysqldump -uroot -proot db_name [wp_options --where="option_id=80"] > /var/mt.sql // 导出
mysql-> use dbname;source /var/mt.sql // 导入
-> update table set cloumn = replace(cloumn,'pattern','replacement') //替换

Apache

/etc/init.d/apache2 start/stop/restart
/usr/local/apache2/bin/apachectl start/stop/restart
如果 apache 是 linux 服务,
service httpd start/stop/restart

参考



任何长久舒适的关系,靠的是共性和吸引 ,而不是压迫、捆绑, 奉承和一味的付出, 以及道德式的自我感动。

—— 我说的

Posted

in

by

Tags: