0%

linux-log

瞎几把记一点Linux小知识

目录树

gio tree

查看挂载

df

pip install lxml 报错

# debian
apt-get install libxml2-dev libxslt1-dev

pip install python-ldap 报错

#debian
apt-get install libldap2-dev libsasl2-dev

生成10位密文

openssl rand 10 -out .secret

postgresql 修改密码

alter user some with password 'some';

python 发布

python setup.py sdist
python setup.py bdist_wheel

nginx 安装

记一下官网配置

http://nginx.org/en/linux_packages.html#stable
vim /etc/yum.repos.d/nginx.repo

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/7/$basearch/
gpgcheck=0
enabled=1

yum install nginx
systemctl status nginx
systemctl start nginx
systemctl enable nginx
systemctl reload nginx
yum install certbot-nginx
记一下 https://certbot.eff.org/
crontab -e
0 23 * * * /root/certbot-auto renew

iptables

iptables -t nat -F #清理
sysctl -w net.ipv4.ip_forward=0 # 1 转
iptables -t nat -A PREROUTING -i eth0 -p tcp -m multiport --dports 80,443 -j REDIRECT --to-port 8080
iptables -t nat -A OUTPUT -p tcp -m owner ! --uid-owner root --dport 443 -j REDIRECT --to-port 8080
iptables -t nat -A OUTPUT -p tcp -m owner ! --uid-owner root -m multiport --dports 80,443 -j REDIRECT --to-port 8080

感觉要记记的

sysctl -w vm.nr_hugepages=128
vim /etc/security/limits.conf
* soft memlock 262144
* hard memlock 262144


yum install centos-release-scl -y
yum install devtoolset-3-toolchain -y
scl enable devtoolset-3 bash

过滤

awk '{print $5}' access.log |awk -F ":" '{print $2}'|grep -v -E 'google|baidu|youtube|netease|qq\.com|bdstatic|cnzz|alicdn|sinaimg|steamcontent|bdimg|gstatic|static\.|[0-9]{1,3}\.[0-9]{1,3}\.' |sort -u

查ip的网址

curl ipconfig.co
curl ip.cn

字符串与ascii

$ echo helloworld |xxd 
00000000: 6865 6c6c 6f77 6f72 6c64 0a helloworld.
$ echo 6865 6c6c 6f77 6f72 6c64 0a |xxd -r -ps
helloworld

base64编码与解码

echo -n "admin" | base64
# YWRtaW4=
echo "YWRtaW4=" | base64 --decode
# admin

欢迎关注我的其它发布渠道