-
Common commands for ufw Firewall
-
View process port occupancy information
-
Exception handling
-
Common command
-
install a software
#1.Install ufw Firewall
sudo apt install ufw
#2.View the status of the ufw firewall
sudo ufw status
#3.Enable and activate the firewall
sudo ufw enable
#4.ufw Firewall allows a port to be open
sudo ufw allow 59019
#5.Allow an IP to access the local computer
sudo ufw allow from IP地址
#6.Disable a port
sudo ufw deny
#7.Prohibit external access to smtp
sudo ufw deny smtp
#8.Delete a rule that has been established.
sudo ufw delete allow smtp
#9.Turn off ufw Firewall
sudo ufw disable
#10.Restart the firewall
sudo ufw reload
View process port occupancy information
#1.View process information
ps -aux
#2.View the process according to PID
ps -aux | grep pid
#3.Process count, view specified process
ps -aux | wc -l
ps -aux | grep kworker
#4.View port occupancy information
netstat -an
#5.View specified port occupancy information
lsof -i :5353
#6.Find the process number to shut down
top
#7.Terminate the process with caution
Kill [signal code] process ID
#Sending a SIGKILL (9) forces the process to stop immediately and does not perform a cleanup operation.
kill -9 14354
#Terminate all processes you have.
kill -9 -1
#8.Kill all processes directly through the name of the program
killall Name of the running program
ps -ef | grep sendmail
killall -9 sendmail
Exception handling
#1.Image interface crashes
ps -t tty7
kill -9 Pid
#2.Assume that the current program `talker` takes up a lot of time. Check pid
ps -ef | grep talker
top -Hp pid
sudo gstack pid
Common command
#1.ps (process status)
#View all processes
ps -A
#View all processes that contain other users
ps -aux
#Keyword to find a process, which is convenient for ending a specified process
ps -ef | grep <keywords>
#2.The ip route command displays the routing table
ip route
install a software
#1. go install
- sudo wget https://golang.google.cn/dl/go.1.193.linux-amd64.tar.gz
- Remove any previous Go installation by deleting the /usr/local/go folder (if it exists), then extract the archive you just downloaded into /usr/local, creating a fresh Go tree in /usr/local/go:
rm -rf /usr/local/go && tar -C /usr/local -xzf go1.19.3.linux-amd64.tar.gz
(You may need to run the command as root or through
sudo
).Do not untar the archive into an existing /usr/local/go tree. This is known to produce broken Go installations.
- Add /usr/local/go/bin to the
PATH
environment variable.You can do this by adding the following line to your $HOME/.profile or /etc/profile (for a system-wide installation):
export PATH=$PATH:/usr/local/go/bin
Note: Changes made to a profile file may not apply until the next time you log into your computer. To apply the changes immediately, just run the shell commands directly or execute them from the profile using a command such as
source $HOME/.profile
. - Verify that you've installed Go by opening a command prompt and typing the following command:
go version
- Confirm that the command prints the installed version of Go.
#2.installing deb files with apt (typora)
sudo apt install ./typora_amd64.deb