Common linux commands

Source: Internet
Author: User

Common linux commands

Grep

Grep-5 "content to be searched" club. log # the file name is club. log.

Tail

Tail-100f club. log # search for the latest 100 lines of Files

Tail-100f club. log | grep 'info' # check the latest 100 rows with the keyword "INFO"

Free

Free-m # view memory, in MB

Free-g # View content, in GB

Df-h# View disk usage

Fdisk-l# View memory partitions

Find

Find/etc/name '* redis *' # search for a file named similar to redis in the/etc/directory

Whereis# View the software installation address

Whereis java # view the java installation path

Whereis python # view the python installation path

Mv# Rename a file name

Mv json.txt json. text

Rm

Rm-rf # delete a folder

Rm-f # delete an object

Cp

Cp/usr/redis/redis-2.8.3/src/redis */App/redis/bin/# copy files

Mv

Mv/usr/redis/redis-2.8.3/src/redis */App/redis/bin/# Move the file to a directory

Top# Common performance analysis tools in linux can display the resource usage of various processes in the system in real time.

Ps-ef| Grep redis

The following describes the Command Options:
-E: displays all processes.
-F full format.
When listing programs, ps e displays the environment variables used by each program.
Ps f uses ASCII characters to display the tree structure and express the relationship between programs

 

Netstat-Nltp | grep 6379

Netstat is used to display statistics related to IP, TCP, UDP, and ICMP protocols. It is generally used to check the network connection of each port on the local machine.

Netstat-ntlp

Netstat-anp | grep 3306

Netstat-

Netstat-AE | grep mysql

Netstat-I-e displays the configuration and status of each network interface on the host.

Netstat-lp identifies the network service being monitored

Netstat-rn Check Route table

Netstat-s
Netstat-tln is used to view linux port usage.
Netstat -- ip-

 

Ln

Create a different link for a file in another location. The most common parameter of this command is-s. The specific usage is the target file of the ln-s source file.
When we need to use the same file in different directories, we do not need to put a file that must be the same under each required directory. We only need to put it in a fixed directory, put the file, and then use the ln command link in other directories to link it, without occupying disk space repeatedly.

Example: ln-s/bin/less/usr/local/bin/less

Uname-a # view system version information

Svn sw# Switch Branch

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.