mac os x
配置环境变量和别名 /Users/username/.zshrc
export PATH=${PATH}:$GOPATH/bin;alias yingxiao='cd /Users/username/godev/src/yingxiao'
文件编码转换
iconv -f GBK -t utf-8 weifang.csv > haha.csv
golang交叉编译
#编译为win32位GOOS=windows GOARCH=386 go build -ldflags="-s -w -H windowsgui"
查看服务是否启动
ps -le |grep mysql
启动一个服务
service mysqld start
查看软件安装在哪个盘
whereis httpd
查看运行文件在哪里
which go
查看命令的位置
locate ifconfig
chmod修改文件和文件夹读写执行属性
chmod 777 hh.c
chown修改文件和文件夹的用户和用户组属性
要修改文件hh.c的所有者.修改为sakia的这个用户所有
chown sakia hh.c
将目录 /tmp/sco 这个目录的所有者和组改为sakia和组net
chown -R sakia:net /tmp/sco
增加path路径
vi /etc/profile
最后一行加上export PATH=$PATH:/sbin 保存关闭
安装编译环境需要的软件
yum install gcc gcc-c++ make flex bison autoconf automake bzip2-devel zlib-devel ncurses-devel libjpeg-devel libpng-devel libtiff-devel freetype-devel pam-devel openssl-devel libxml2-devel gettext-devel pcre-devel
查看系统信息
uname -a
查看系统是多少位的
getconf LONG_BIT
查看版本
cat /proc/version
登陆ssh
ssh
拷贝远程服务器的文件到本地
scp :/home/wwwroot/web/sites.zip ~/test
配置iptables
iptables -I INPUT 1 -p tcp --dport 1234 -j ACCEPT
-I INPUT 1 输入包里序号为1的 -p 指定要匹配数据包协议类型 --dport 端口 -j <目标>指定要跳转的目标 ACCEPT 接受数据包
保存iptables配置
iptables-save | tee /etc/sysconfig/iptables
设置开机启动
vi /etc/rc.local增加一些开机启动处理程序iptables -I INPUT 1 -p tcp --dport 1234 -j ACCEPTsupervisord -c /home/supervisord/supervisord.conf......
安装pip
- 首先检查Linux有没有安装Python-pip包,直接执行 yum install python-pip
- 没有python-pip包就执行命令 yum -y install epel-release
- 执行成功之后,再次执行yum install python-pip
- 对安装好的pip进行升级 pip install --upgrade pip
安装supervisor
pip install supervisor
安装 setuptools (python2)
yum install python-setuptools
编译安装supervisor
wget http://pypi.python.org/packages/source/s/supervisor/supervisor-3.0b1.tar.gztar -zxvf supervisor-3.0b1.tar.gz cd supervisor-3.0b1python setup.py install
启动supervisord
supervisord -c /etc/supervisord.conf
生成supervisor配置文件
echo_supervisord_conf > /etc/supervisord.conf
supervisor进程配置文件
[program:test]directory = /sites/websites/htdocs/testcommand = /sites/websites/htdocs/test/testautostart = truestartsecs = 5redirect_stderr = truestdout_logfile = /var/log/supervisor/test.log
supervisor修改配置文件后重新加载配置
supervisorctl update
supervisor启动
supervisord -c /etc/supervisord.conf
supervisor启动程序
supervisorctl start huifang
supervisor停止监听程序
supervisorctl stop huifang
配置nginx
vi /usr/local/nginx/conf/nginx.conf
server{ listen 8888; server_name 123.129.242.82; index index.html index.htm index.php; root /sites/websites/htdocs/index; fastcgi_buffer_size 4k; fastcgi_buffers 8 4k; fastcgi_busy_buffers_size 4k; gzip off; location ~ .*\.php$ { fastcgi_pass unix:/tmp/php-cgi.sock; fastcgi_index index.php; include fcgi.conf; } access_log /home/wwwroot/index/log/access.log combined; error_log /home/wwwroot/index/log/error.log crit;}
重启nginx
/usr/local/nginx/sbin/nginx -s reload
安装brew
/usr/bin/ruby -e "$(curl -fsSL )"
安装git
brew install git
卸载git
brew uninstall git
更新brew
brew update
brew查询软件
brew search nginx
安装mysql
brew install mysql
卸载mysql
sudo rm /usr/local/mysqlsudo rm -rf /usr/local/mysql*sudo rm -rf /Library/StartupItems/MySQLCOMsudo rm -rf /Library/PreferencePanes/My*vim /etc/hostconfig (and removed the line MYSQLCOM=-YES-)rm -rf ~/Library/PreferencePanes/My*sudo rm -rf /Library/Receipts/mysql*sudo rm -rf /Library/Receipts/MySQL*sudo rm -rf /var/db/receipts/com.mysql.*