linux命令和工具
2016-06-12 23:46
441 查看
环境搭建
lnmp环境搭建命令
uname -a 查看linux版本 lsof -i:80 查看端口被那个程序占用 lsof -p pid号 查看引用的文件 netstat -apn|grep 80 查看端口占用 kill -9 $pid 这个$pid就是端口 du -sh * 查看文件夹和文件的大小 du -d 2 -h 查看文件大小,2表示文件夹层级
通信
监听10001端口 nc -l 10001 localhost:home wyc$ telnet 127.0.0.1 10001 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. wuyachao wwww localhost:home wyc$ nc -l 10001 wuyachao wwww
压测
// 100连接 4个线程 测试10秒 wrk -c 100 -d 10 -t 4 --latency "http://ccc.wyc.com:8888/5e9564282f61b0e925a41bd1ac688a48?p=2&w=480&h=480" // 1000次请求,100并发 ab -n 1000 -c 100 "http://ccc.wyc.com:8888/5e9564282f61b0e925a41bd1ac688a48?p=2&w=480&h=480"
软链接
经常重启nginx需要/usr/local/openresty/nginx/sbin/nginx -t和
/usr/local/openresty/nginx/sbin/nginx -s reload,想要快速的
nginx -t和
nginx -s reload可以将nginx加入到环境变量,
查看环境变量:
env:查看所有的环境变量
echo $PATH:查看单个环境变量
如果需要增加新的环境变量可以添加下属行
临时的:
export path=$path:/path1:/path2:/pahtN
使用
export命令声明即可,变量在关闭shell时失效。
2.永久的:
需要修改配置文件,变量永久生效。或者软链接。
1.编辑/etc/profile文件最后增加一行
export PATH=$PATH:/usr/local/openresty/nginx/sbin/nginx
2.软链接:
ln -s /usr/local/openresty/nginx/sbin/nginx /usr/local/sbin/nginx
mac下的环境变量
OS X系统的环境变量,加载顺序为:/etc/profile /etc/paths ~/.bash_profile ~/.bash_login ~/.profile ~/.bashrc
/etc/profile和/etc/paths是系统级别的,系统启动就会加载,
后面几个是当前用户级的环境变量。
~/.bash_profile,~/.bash_login,~/.profile按照从前往后的顺序读取,
如果~/.bash_profile文件存在,则后面的几个文件就会被忽略不读了,
如果~/.bash_profile文件不存在,才会以此类推读取后面的文件。
~/.bashrc没有上述规则,它是bash shell打开的时候载入的。
设置PATH的语法为:
export PATH="$PATH::::...:"
注:
(1)一般环境变量更改后,重启后才可生效。如果想立刻生效,则可执行下面的语句:source /path/to/filename
(2)如果默认shell是bash,那么shell启动时会触发.bashrc,如果默认shell是zsh,那么shell启动时会触发.zshrc
(3)环境变量既可以加到$PATH头部,也可以加到$PATH尾部。
mac gopath设置
echo $SHELL如果是bash,在~/.bash_profile下面添加export GOPATH="/usr/wyc/go"
如果是zsh,在 ~/.zshrc添加export GOPATH="/usr/wyc/go"就好
保存退出,source ~/.zshrc即可生效
ssh登录
将生成的id_rsa.pub放在服务器~/.ssh/authorized_keys里面就可以ssh登录了scp 远程传输
scp -P 22305 /home/* root@192.168.3.2:/home/*
将本地的home目录下的文件全部复制到远程服务器192.168.3.2上面的/home目录下。
-P:为远程服务器的端口号
root:登录远程服务器的用户名
supervisord
将/etc/supervisord.d/目录下的所有ini文件加载。[include] files = supervisord.d/*.ini
konga.ini
[program:konga] ;command=cnpm run production command=node --harmony app.js --prod directory=/root/konga redirect_stderr=true stdout_logfile=/root/logs/konga.log autostart=true autorestart=true startsecs=10 stopwaitsecs = 600
查看状态:
supervisorctl status
重启某个程序:
supervisorctl restart konga
新添加的需要update:
supervisorctl update
相关文章推荐
- linux 内核编译
- cobbler部署centos7
- Linux设备驱动开发环境搭建
- 【Linux】tar指令用法
- linux vdso与vsyscall相关内容总结
- linux命令 - ln - 创建和删除软、硬链接
- Linux常用命令
- linux下C编程详解
- 通过EasyBCD将Linux的启动菜单加入到Windows 的启动菜单
- Linux grep总结(转)
- Windows 7下硬盘安装Ubuntu 13.04图文教程
- linux下的IO模型
- Linux文件系统基础(4)
- Linux常用命令(转)
- Linux运维(数据库专题)面试题
- Linux应用编程之时间编程
- linux配置hosts
- Linux之查看CPU信息
- linux笔记二-----目录及文件命令
- 如何配置内核,以支持USB设备。