Learning Linux

Time:2020-9-14
Current server: CentOS 7

Shell command box: xshell

File preview and upload: xftp (interface software, very easy to use)

Database connection: Navicat

 

This article is in the study of Linux to do a set of instructions, to facilitate their own reference

In folder: CD XXX
Return to top level folder: CD/
View all files in the current folder: LS visit Linux local website port: curl http://localhost : [port number] preliminary preparation: install NETCORE environment (click to jump directly), refer to https://www.cnblogs.com/v587yy/p/12148087.htmlnetcore After the website is published, it can be uploaded to the Linux server using xftp. After entering the folder of the website, the NETCORE website can use dotnet xxx.dll Run, after running, you need to set up nginx (click to jump directly)
1. View all processes: PS - ef


2. View the specific process: PS - EF | grep redis

PS: show a process
-A shows all programs. 
-E this parameter has the same effect as specifying the "a" parameter.
-F displays uid, PPIP, C and stime fields. 
The grep command is to find
The | in the middle is the pipeline command, which means that the PS command and grep are executed at the same time

This command means to display the processes related to redis. 3. View ports: netstat - ntulp ා to see which ports are opened: netstat - ANP
4. View specific port: netstat - ntulp | grep 805. Close port number: iptables - a input - P TCP -- drop [port number] - J drop 6. Open port number: open port number: iptables - I input - PTCP -- dport [port number] - J accept 7. Kill [parameter] [process number] kill - 9 4394 kill is to send a signal to a process ID. The signal sent by default is SIGTERM, while the signal sent by kill-9 is sigkill, that is, exit. The exit signal is not blocked by the system, so kill-9 can kill the process smoothly. Of course, you can also use kill to send other signals to the process.
Excerpt from https://www.cnblogs.com/yiyangl/p/11130577.htmlhttps // baijiahao.baidu.com/s?id=1610751947194251627&wfr=spider&for=pc
To create a service definition file:

sudo nano /etc/systemd/system/kestrel-hellomvc.service
The following is a sample service file for the application:
[Unit]
Description=Example .NET Web API App running on Ubuntu
 
[Service]
WorkingDirectory=/var/aspnetcore/hellomvc
ExecStart=/usr/bin/dotnet /var/aspnetcore/hellomvc/hellomvc.dll
Restart=always
# Restart service after 10 seconds if the dotnet service crashes:
RestartSec=10
SyslogIdentifier=dotnet-example
User=xxx
Environment=ASPNETCORE_ENVIRONMENT=Development
 
[Install]
WantedBy=multi-user.target
Save the file and enable the service.

systemctl enable kestrel-hellomvc.service
Start the service and verify that it is running.

systemctl start kestrel-hellomvc.service
systemctl status kestrel-hellomvc.service
You need to use the path of the application DLL to set the working directory (path to your app and exec start) as a folder. By default, this is enough. Excerpt from https://blog.csdn.net/wojiaosha123/article/details/98784936

 

CentOS install. Net core environment
sudo yum update
Register the Microsoft signature key once for each machine
sudo rpm -Uvh https://packages.microsoft.com/config/rhel/7/packages-microsoft-prod.rpm

Install the. Net core SDK. According to the project environment, you need to install version 2.2. Different development environments choose the corresponding runtime version
sudo yum install dotnet-sdk-2.2

After completion, you can see the version of. Net core through the command

dotnet --version

Excerpt from https://www.cnblogs.com/v587yy/p/12148087.html