linux 系统常用命令总结

linux 常用目录全程以及缩写

bin(binary) :常见linux命令、系统所有用户命令目录文件
dev(device) : 设备驱动存储目录文件
media: 多媒体及挂载目录
proc (process):进程信息文件
sbin(superuser binary) : root用户命令文件
var (variable): 变量文件
boot: 引导程序文件
etc (etcetera): 所有程序所需要的配置文件
lib (library): 系统默认库路径文件
mnt (mount): 挂载目录
root : root根目录
tmp (temporary): 临时文件目录
home: 家目录(用户目录)
opt (option): 可选目录(可以选择安装应用程序的目录)
usr (user): 用户程序目录

查看nginx进程

ps -ef|grep nginx

查询文件中包含某个字段(127.0.0.1)

grep 127.0.0.1 xxx.json

查询文件中包含某个字段并高亮显示

grep --color 127.0.0.1 xxx.json

比较两个文件中的差异

diff a.txt b.txt

替换文件中的字段a为字段b

sed -i 's/a/b/g' 1.txt

view 查看文件的行号

:set nu

查看cpu配置

lscpu

输出结果
Architecture:        x86_64    #架构
CPU op-mode(s):      32-bit, 64-bit      #CPU运行模式
Byte Order:          Little Endian  #字节序
CPU(s):              2  #
On-line CPU(s) list: 0,1 #下线cpu列表
Thread(s) per core:  2  #每个核的线程数
Core(s) per socket:  1  #每个座的核数
Socket(s):           1  #座
NUMA node(s):        1  #NUMA节点
Vendor ID:           GenuineIntel  #厂商ID
BIOS Vendor ID:      QEMU  
CPU family:          6  #CPU系列
Model:               85  #型号
Model name:          General Purpose Processor  #型号名称
BIOS Model name:     pc-i440fx-4.1  
Stepping:            7  #步进
CPU MHz:             2600.004
BogoMIPS:            5200.00
Hypervisor vendor:   KVM
Virtualization type: full
L1d cache:           32K
L1i cache:           32K
L2 cache:            1024K
L3 cache:            36608K
NUMA node0 CPU(s):   0,1

服务器之间赋值多个tar文件 并解压缩

scp openresty-xxx.tar.gz openssl-xxx.tar.gz pcre-xxx.tar.gz zlib-xxx.tar.gz root@xxx.xxx.xxx.xxx:/home/xxx

循环解压多个tar文件

for f in *.tar.gz; do tar zxvf "$f"; done

配置nginx环境 在nginx文件下执行 xxx是自己文件版本号

./configure --prefix=/home/nginx --with-http_ssl_module --with-http_realip_module --with-http_gzip_static_module --with-http_gunzip_module --with-http_sub_module --with-http_v2_module --with-http_stub_status_module --with-stream --with-pcre=/home/nginxpkg/pcre-xxx --with-zlib=/home/nginxpkg/zlib-xxx --with-openssl=/home/nginxpkg/openssl-xxx --with-openssl-opt=-g --with-pcre-opt=-g --with-zlib-opt=-g --with-stream --with-stream_ssl_module --with-stream_ssl_preread_module

编译

make && make install

静态服务器生成 ssl证书 start

openssl genrsa -des3 -out cert.key 2048

mv cert.key cert.key.back
openssl rsa -in cert.key.back -out cert.key

openssl req -new -key cert.key -out cert.csr

openssl x509 -req -days 36500 -in cert.csr -signkey cert.key -out cert.crt

nginx.conf文件配置 写到server 下面 端口后加" ssl"

ssl_certificate cert.crt;
ssl_certificate_key cert.key;
ssl_protocols SSLv2 SSLv3 TLSv1.2; # 安全连接可选的加密协议

ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;

ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
posted @ 2024-11-14 14:26  暴躁牛马  阅读(6)  评论(0)    收藏  举报