提示
man 是个好东西,学会用man,阅读文档,使用工具更便利!
ChatGPT 更是个好东西!
SSH
1 2 3 4 5 6 7 8 9 10 11
| $ apt-get install openssh-server
$ ps -e | grep ssh $ systemctl status ssh
$ systemctl enable ssh
|
Docker
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| $ docker-compose --compatibility up -d
$ docker tag xxx ip/xxx $ docker push ip/xxx
$ docker system prune
$ docker ps -a -q
$ docker ps -a | grep Exited | awk '{print $1}' $ docker ps -qf status=exited
|
docker支持nvidia
Kubectl
1 2 3 4 5 6 7 8 9 10 11
| $ kubectl config get-contexts $ kubectl config use-context ${name}
$ export KUBECONFIG=$KUBECONFIG:$HOME/.kube/config:$HOME/.kube/config-exercise/config-refunc
$ kubectl config view
$ kubectl api-resources
$ kubectl api-versions
|
用户管理
1 2 3 4 5 6 7 8 9 10
|
$ useradd -s /sbin/nologin -d /home/dml_401 -m dml_401
$ usermod -s /sbin/nologin dml_401
$ groupadd docker
$ usermod -aG docker ${user_name}
|
进程管理
1 2 3 4
| $ ps -ef | grep "command" | grep -v grep | awk '{print $2}' | xargs kill -9
$ ps aux | grep 18142
|
IPV6路由配置
1 2 3 4 5
| $ ip -6 route show
$ IFACE=eth0 $ /sbin/dhclient -6 -v -pf /run/dhclient6.$IFACE.pid -lf /var/lib/dhcp/dhclient6.$IFACE.leases -I -df /var/lib/dhcp/dhclient.$IFACE.leases -nw $IFACE
|
jupyter
1 2 3 4 5 6 7
| (base)$ conda install -y jupyter nb_conda
(yout-venv)$ pip install jupyter (yout-venv)$ ipython kernel install --name "local-venv" --user
$ jupyter notebook password
|
virtualenv
1 2 3 4 5 6
| $ virtualenv -p /usr/bin/python3.6 venv3
$ env LDFLAGS="-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib" pip install MySQL-python
$ cat requirements.txt | xargs -n 1 pip install
|
conda
1 2
| $ conda create -y -n ${ENV_NAME} python=3.6
|
python
systemctl
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
$ touch /lib/systemd/system/frpc.service
cat <<EOT >> /lib/systemd/system/frpc.service [Unit] Description=fraps service After=network.target syslog.target Wants=network.target
[Service] Type=simple ExecStart=/your/path/frps -c /your/path/frps.ini
[Install] WantedBy=multi-user.target EOT
$ sudo systemctl start frpc.service
|
DNS
1 2 3 4 5 6 7 8 9 10 11 12
| $ vim /etc/resolv.conf
$ apt install resolvconf $ systemctl start/enable/status resolvconf.service
$ vim /etc/resolvconf/resolv.conf.d/base $ systemctl restart resolvconf.service
|
内网机器穿透到公网服务器
1 2 3 4
| $ autossh -M xxxx -fN -o "PubkeyAuthentication=yes" -o "StrictHostKeyChecking=false" -o "PasswordAuthentication=no" -o "ServerAliveInterval 60" -o "ServerAliveCountMax 3" -R server_ip:server_port:local_ip:local_port server_usrname@server_ip
|
本地机器穿透到内网环境
1 2 3 4 5 6
| $ ssh -NL <localport>:<host-ip>:<host-port> xxx &
$ ssh -ND <local-socks5-port> xxx
|
git 常用设置
1 2 3 4 5 6 7 8 9 10 11 12
| $ git remote add official ssh://git@git.jingtao.fun:6022/mirror/fission.git
$ git fetch official master $ git checkout -b ofi-master official/master
$ git push origin a:b
$ git config --global core.quotepath false
$ git checkout HEAD~
|
硬件信息
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| $ cat /proc/cpuinfo
$ cat /proc/cpuinfo | grep MHz | uniq
$ cat /proc/meminfo
$ sudo dmidecode -t memory
$ ethtool eno1
$ apt-get install nvme-cli $ nvme list $ nvme smart-log /dev/nvme0
|
磁盘管理
缩小磁盘分区
可以自动缩小分区的管理工具
查看 & 磁盘信息
1 2 3 4 5 6
| $ blkid
$ parted
$ fdisk /dev/xxx
|