Linux常用命令
·軟件操作命令 ->man xxx 命令介紹
|-yum remove xxx 卸載
|-yum serach xxx 搜索
|-yum clean packages 清理緩存
|-yum list 列出已安裝
|-yum info xxx 軟件包信息
·服務(wù)器硬件資源和磁盤操作
|-free -m 內(nèi)存
|-df -h 硬盤
|-w 和 top 負(fù)載 q退出
|-cat /proc/cpuinfo 查看CPU
|-fdisk 格式化磁盤
|-ps 查看進(jìn)程
·文件和文件夾操作命令
|-pwd 顯示路徑
|-rm 刪除文件,-rf目錄
|-mv 移動
|-touch 創(chuàng)建文件
|-mkdir 創(chuàng)建文件夾
《文件屬性》
|-chattr -i .user.ini
|-rm .user.ini
<文件搜索、查找、讀取>
|-tail 從文件尾部開始讀
|-head 頭部讀
|-cat 讀取整個文件
|-more 分頁讀取
|-less 可控分頁
|-grep 搜索關(guān)鍵字 grep -n "s" xxx (-n行)
|-find 查找文件 之后可以跟著操作
|-wc 統(tǒng)計個數(shù) cat xxx | wc -l
|-tar 解壓縮 man tar 命令介紹
<6.4 Linux文本編輯器 vim>
|-行:G行尾 gg行首,dd行刪除 u恢復(fù),yy復(fù)制p粘貼
|-set number 顯示行
<權(quán)限>r讀4 w寫2 x執(zhí)行1
·系統(tǒng)用戶操作命令
|-useradd 添加用戶
|-adduser 添加用戶
|-userdel 刪除用戶
|-passwd 設(shè)置密碼
·防火墻相關(guān)設(shè)置
|-yum install firewalld 安裝(默認(rèn)安裝)
|-service firewalld start 啟動
|-service firewalld status 檢查狀態(tài)
|-service firewalld stop/disable 關(guān)閉或禁用
|-firewall-cmd -h 幫助文檔–help
·提權(quán)操作sudo和文件傳輸操作
|-visudo 提權(quán):sudo 給用戶權(quán)限
|-wget、curl 文件下載
|-scp linux文件上傳和下載
|-yum install lrzsz Xshell文件上傳下載
|-rz 上傳 receive Zmodem rz -be
|-sz 下載 send Zmodem
《Nginx》
|-yum install nginx
|-service nginx start
|-service nginx stop
|-service nginx reload
|-/etc/nginx/conf.d 添加多域名
|-/etc/nginx/nginx.conf log_format配置日志
[plain] view plain copy
server {
listen 80;
server_name chen.test;
root /data/www;
index index.html index.php;
#access_log /var/log/nginx/chen.log chen; #日志
location / {
#rewrite ^(.*).htmp$ /index.html; #偽靜態(tài)
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=$1 last;
break;
}
#嘗試尋找目錄
try_files $uri $uri/ /index,php?$args;
}
location ~ .php$ {
include fastcgi_params; #引入
fastcgi_pass 127.0.0.1:9000; #轉(zhuǎn)發(fā)
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
try_files $uri =404;
}
}
《PHP》
|·配置源
|- rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
|- rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
|·安裝 和 基本操作
[plain] view plain copy
yum install php56w-fpm # 安裝php5.6
[plain] view plain copy
yum install php70w php70w-fpm #安裝php7
service php-fpm (start/restart/stop)
|·擴(kuò)展
yum install php56w.x86_64 php56w-cli.x86_64 php56w-common.x86_64 php56w-gd.x86_64 php56w-mbstring.x86_64 php56w-mcrypt.x86_64 php56w-mysql.x86_64 php56w-pdo.x86_64
yum install php70w.x86_64 php70w-cli.x86_64 php70w-common.x86_64 php70w-gd.x86_64 php70w-mbstring.x86_64 php70w-mcrypt.x86_64 php70w-mysql.x86_64 php70w-pdo.x86_64
(網(wǎng)上是這樣的?)《yum install gcc bison bison-devel zlib-devel libmcrypt-devel mcrypt mhash-devel openssl-devel libxml2-devel libcurl-devel bzip2-devel readline-devel libedit-devel sqlite-devel》