Linux common commands and configuration--simple

Source: Internet
Author: User

1, File Search:

Find JDK path: which jdk; query Java_home variable value: Echo $JAVA _home

From the root directory, look for all text files with a. log extension and find the line that contains "ERROR"
Find/-type f-name "*.log" | Xargs grep "ERROR"

The system immediately displays httpd.conf file information on the screen after finding the httpd.conf file.
Find/-name "httpd.conf"-ls

Find a file under the root directory
Find. -name "Test"

Find a file in a directory that contains a string in the content

Grep-r "ZH_CN".

2, Process

View Java's process information: Ps-ef|grep java

Kill process: kill-9 process number

3, network configuration

File path:/etc/sysconfig/network-scripts/ifcfg-eth0

Reference: http://blog.csdn.net/clevercode/article/details/46376985

NIC configuration static IP
1) Edit the configuration file, add the following content to modify
# Vi/etc/sysconfig/network-scripts/ifcfg-eth0

Bootproto=static #启用静态IP地址
Onboot=yes #开启自动启用网络连接
ipaddr=192.168.21.129 #设置IP地址
netmask=255.255.255.0 #设置子网掩码
gateway=192.168.21.2 #设置网关
dns1=8.8.8.8 #设置主DNS
dns2=8.8.4.4 #设置备DNS
Ipv6init=no #禁止IPV6
: wq! #保存退出

2) After the modification, execute the following command
# Service Ip6tables Stop #停止IPV6服务
# chkconfig Ip6tables off #禁止IPV6开机启动
# Service Network Restart #重启网络连接

# ifconfig #查看IP地址

4, Firewall

File path:/etc/sysconfig/iptables

Reference Configuration Examples:

*filter:input Accept [0:0]:forward Accept [0:0]:output Accept [0:0]-a input-m State--state established,related-j ACCEPT  -A INPUT -p icmp -j ACCEPT-A INPUT -i lo -j ACCEPT-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT-A INPUT -P tcp-m State--state new-m TCP--dport 1180:19090-j accept-a input-p udp-m State--state new-m UDP--dport 1180:1 9090-j accept-a input-j REJECT--reject-with icmp-host-prohibited-a forward-j REJECT--reject-with icmp-host-prohibited COMMIT

Note: 1180:19,090 indicates that ports between 1180 and 19090 are all open

Firewall settings take effect (restart before save)

Service Iptables Restart/etc/init.d/iptables Save

Set Iptables auto-start

Chkconfig iptables on

also view and delete iptables rule methods : http://blog.51yip.com/linux/1404.html

5, Environment variables
Vi/etc/profile

Linux common commands and configuration--simple

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.