Common commands for Linux ""

Source: Internet
Author: User

Cat: View or merge file contents

Example: View 1.txt and 2.txt file content and merge 1.txt and 2.txt file content into 3.txt

grep: Text Search {format: gerp [-options] ' search content string ' filename }
The grep command is a powerful text Search tool that grep allows for pattern lookups on text files . If a matching pattern is found, grep prints all rows that contain the pattern.

1. grep Common options:

Options Meaning
-V

Display all lines that do not contain matching text (equivalent negation)

-N

Display matching lines and line numbers

-I.

Ignore case

2. grep Common Regular Expressions:

Find : File Lookup {format: find directory-name file name }
Typically used to search for a qualifying file in a specific  directory  , or to search for a specific user's owner's file

Common usage:

Command

Meaning

Find./-name test.sh

Find all files named test.sh in the current directory

Find./-name ' *.sh '

Find all files with the suffix. Sh in the current directory

Find./-name "[a-z]*"

Find all files in the current directory that begin with uppercase letters

Find/tmp-size 2M

Find files that are equal to 2M in the/tmp directory

Find/tmp-size +2m

Find files larger than 2M in the/tmp directory

Find/tmp-size-2m

Find files less than 2M in the/tmp directory

Find./-size +4k-size-5m

Find files larger than 4k and less than 5M in the current directory

Find./-perm 0777

Find a file or directory with permission 777 under the current directory

WC: Calculates the number of lines or words of a file

Common commands for Linux ""

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.