-- View a Port:
Netstat-LNP | grep 80
View the occupied Port:
Netstat-LNP or netstat-tnlup
-- Set firewall: enable access to port 80
#/Sbin/iptables-I input-P TCP -- dport 80-J accept
#/Etc/rc. d/init. d/iptables save
#/Etc/init. d/iptables restart
-- View Firewall
#/Etc/init. d/iptables status
-- Tomcat is set to port 80, which can be enabled by other users except root.
Step 1: Change the Tomcat port (server. XML) from 80 to 8080.
Step 2: Use the iptables port to forward data between port 80 and port 8080. The command is as follows:
/Sbin/iptables-T Nat-A prerouting-p tcp -- dport 80-J redirect -- to-port 8080
In this way, the user accesses port 80 and port 8080 to port 8080.
-- View a service and status in centos
/Sbin/chkconfig -- list mysqld
-- Set the service to self-start
/Sbin/chkconfig mysqld on
-- Check whether the system is 32-bit or 64-bit.
-- View the default system language
Echo $ Lang
-- Centos remote debugging of Tomcat applications
Export jpda_address = 8787
./Catalina. Sh JPDA start
-- The/etc/profile File Modified by centos takes effect immediately
-- Modify Network Configuration
The ifcfg-eth0 configuration file saves the previous MAC address, the line is deleted in the restart Nic
2. delete/etc/udev/rules. d/70-persistent-net.rules and restart the machine.
-- Change the account password
-- View the system version
-- View CPU Information
Use the following command to view the CPU details. Generally, a multi-core CPU, a CPU supporting hyper-threading, or multiple physical CPUs will display the corresponding number of items. For example, a dual-core CPU will display two CPU information items, and a dual-core hyper-threading CPU will display four CPU information items. Although the number of items is large, the basic information is the same.
-- View memory information
The command used to view the memory information corresponds to the CPU information:
-- View hard disk partition information
Run the following command to view the partition information of the current hard disk, as well as the capacity, used space, and remaining space. You can also view the mount points of each partition:
-- View the hard disk model information
You can use the following command to display the number of physical hard disks and corresponding interfaces, as well as the specific hard disk model information:
-- Modify the default ssh port number
Port 8284 // In the past, there was a number # in front of it, and the default value is 22. It will be OK after modification.
#/Etc/init. d/sshd restart
-- Modify the Default Gateway
VI/etc/rc. d/rc. Local
Route add-net 0.0.0.0 GW 192.168.1.1
-- Clear files
CAT/dev/null> file to be cleared
Echo ""> file to be cleared
> Files to be cleared
-- Add DNS
# Generatedby NetworkManager
Device = "Em1"
Hwaddr = "C8: 1f: 66: C3: B5: 59"
Nm_controlled = "yes"
Onboot = "yes"
Type = Ethernet
Netmask = 255.255.255.0
Ipaddr = 192.168.1.211
Gateway = 192.168.1.1
-- Cross-system file copy command SCP
Yum install OpenSSH-clients
SCP-P port [email protected]:/home/user/filename
* Copy a file:
* Command format:
SCP local_file [email protected] _ IP: remote_folder
SCP local_file [email protected] _ IP: remote_file
SCP local_file remote_ip: remote_folder
SCP local_file remote_ip: remote_file
SCP/home/SPACE/music/1.mp3 [email protected]:/home/root/Others/music
SCP/home/SPACE/music/1.mp3 [email protected]:/home/root/Others/music/002.mp3
* Copy directory:
* Command format:
SCP-r local_folder [email protected] _ IP: remote_folder
SCP-r local_folder remote_ip: remote_folder
SCP [email protected]:/home/root/Others/music/home/SPACE/music/ithers
This article is from the "when everything is free" blog. For more information, contact the author!
Common commands in centos