Common commands in centos

Source: Internet
Author: User
Tags nameserver ssh port


-- 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.
Solution:
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.
Getconf long_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
Source/etc/profile

-- Modify Network Configuration
1. VI/etc/sysconfig/network-scripts/ifcfg-eth0
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
Passwd Root

-- View the system version
Uname-
CAT/etc/RedHat-release

-- 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.

# Cat/proc/cpuinfo

-- View memory information

The command used to view the memory information corresponds to the CPU information:

# Cat/proc/meminfo

-- 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:

# DF-lH

-- 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:

# Cat/proc/SCSI

-- Modify the default ssh port number
# Vi/etc/ssh/sshd_config
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
VI/etc/resolv. conf

# Generatedby NetworkManager
Nameserver 192.168.1.1
Nameserver 114.114.114.114

VI/etc/sysconfig/network-scripts/ifcfg-eth0
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
Or
SCP local_file [email protected] _ IP: remote_file
Or
SCP local_file remote_ip: remote_folder
Or
SCP local_file remote_ip: remote_file

* Routine:
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
Or
SCP-r local_folder remote_ip: remote_folder

For example:
SCP [email protected]:/home/root/Others/music/home/SPACE/music/ithers
SCP-r www.cumt.edu.cn:/home/root/Others/home/SPACE/music/

This article is from the "when everything is free" blog. For more information, contact the author!

Common commands in centos

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.