sh Bash - cheatsheet

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh Bash - cheatsheet相关的知识,希望对你有一定的参考价值。

# Create User
sudo adduser new_user
## Get default pass
sudo grep test /etc/shadow
test:!!:123456:0:99999:7:::
## Remove Pass
$ sudo adduser test
$ sudo passwd -d test
Removing password for user test.
passwd: Success
$ su test
$ whoami
test

## set sudo
usermod -aG wheel username
# Get IP of Mac
ifconfig |grep inet

## IP Wireless
ipconfig getifaddr en1
## IP Ethernet
ipconfig getifaddr en0
#copy sha local machine into server
ssh-copy-id -i ~/.ssh/id_rsa.pub git@192.168.100.130
ssh-keygen -t rsa
#location rule
# /etc/firewalld/zones/public.xml

# reload
firewall-cmd --reload

# check port running
ss -plnt

# check all port
firewall-cmd --zone=public --list-ports
# check specific port
firewall-cmd --zone=<zone> --query-port=80/tcp
# add port open
firewall-cmd --zone=public --add-port=27017/tcp --permanent

# check all services
firewall-cmd --zone=public --list-services
# add http & https services
firewall-cmd --zone=public --add-service=http
firewall-cmd --zone=public --add-service=https

tree
 
#Level of Depth
tree -L 3
 
#Excluding Directory
tree -I "node_modules|www"
/usr/sbin/setsebool httpd_can_network_connect true 
# Install semanage
yum install policycoreutils-python
which semanage
yum provides semanage

#check port
semanage port -l | grep http_port_t

# add port
semanage port -a -t http_port_t  -p tcp 8090

# modify port
semanage port -m -t http_port_t  -p tcp 8090
ln -s /home/tableau/ tableau
# /etc/ssh/sshd_config

PermitRootLogin No

AllowUsers admin1 admin2
//Check port
nc -zv 127.0.0.1 80

//lookup
nslookup 199.88.777.66
#START
sudo systemctl start firewalld
sudo systemctl enable firewalld


#STOP
sudo systemctl stop firewalld
sudo systemctl disable firewalld
sudo systemctl mask --now firewalld
du -h --max-depth=1 |sort -hr
journalctl -xe
journalctl -f

#cleanup
journalctl --vacuum-size=500M
journalctl --vacuum-time=2d

以上是关于sh Bash - cheatsheet的主要内容,如果未能解决你的问题,请参考以下文章

sh Bash Cheatsheet

sh Bash Cheatsheet

sh #unix #bash #cheatsheet

sh Bash特定的功能和语法cheatsheet

sh 适用于UNIX系统的Bash CheatSheet

sh 适用于UNIX系统的Bash CheatSheet