linux 常用命令

linux

查看公网连接ip

curl ifconfig.me

停止进程

ps -ef |grep php
kill -9 4394

设置软连接

ln -sf /usr/local/nginx/sbin/nginx /usr/sbin 
ln -s /usr/local/python3.5.4/bin/gunicorn /bin/gunicorn

检测是否启动

# 另外该命令也可以让我们知道fpm的配置文件在哪。
ps aux |grep php-fpm 
netstat -ant |grep 9000
kill -STOP [pid]

查找并杀死一个程序

kill -9 $(ps -ef | grep java | grep -v grep | awk '{print $2}')

开发端口号

或直接编辑/etc/sysconfig/iptables
-A INPUT -p tcp -m tcp --dport 4000 -j ACCEPT
保存在前面部分
再重启:
service iptables restart

开机执行脚本

vim /etc/rc.local

查看磁盘空间

df -hl

后台运行

nohup php yii queue/listen &

终止后台

kill pid

查看后台任务

ps aux|grep php-fpm

linux shell 不能运行

vim 下运行
set f

linux 查看内存

free -m

linux 按指定时间运行

# 输入以下命令。查看已有的定时任务
crontab -l
# 输入 以下命令,进入定时任务文件
crontab -e
# *  *  *  *  *  command
#分  时  日  月  周  命令
#第1列表示分钟1~59 每分钟用*或者 */1表示
#第2列表示小时1~23(0表示0点)
#第3列表示日期1~31
#第4列表示月份1~12
#第5列标识号星期0~6(0表示星期天)
01 01 * * * /usr/local/php/bin/php /home/www/tongji/protected/yiic.php bank today >/dev/null 2>&1

查看当前http链接数量

netstat -pnt | grep :80 | wc -l

你可能感兴趣的:(linux 常用命令)