Commands used by the shell

Source: Internet
Author: User
Tags sorts

A Shift

Parameter shift Left

Until [$#-eq 0]
Do
echo "The first parameter is: The number of arguments is: $#"
Shift
Done

Two Wc

This command is used to count the number of bytes, words, and lines in the specified file. The command options have the following meanings:

-L count rows

-W Count Count

-C Statistics byte number

These options can be used in combination. The order and number of output columns are not affected by the order and number of options. Always appear in the following order and at most one column per item.

Number of rows, words, bytes, filenames

Three Piping and Xargs

Pipeline:

The input of the pipeline left command is the input to the right side of the pipe (the input of the command is certain), not the parameter, and not all of the commands support the pipeline

Xargs

The command output on the left side of the pipeline as a parameter to the right command

Four. Df

View disk space remaining

Usage: DF [options] ... [File] ... Displays the information for each < file > file system that is located, by default showing all file systems.

The parameters that must be used for the long option are also required when using the short option.

-A,--all includes a file system of size 0 blocks

-B,--block-size= size block with specified < size > bytes

-H,--human-readable file system size in an easy-to-understand format (e.g. 1K 234M 2G)

-H,--si similar to-H, but takes 1000 of the time instead of 1024

-I,--inodes displays inode information instead of block usage

-K is--block-size=1k

-L,--local only displays the native file system

--no-sync do not synchronize before obtaining usage data (default)

-P,--portability using POSIX-compatible output formats

--sync synchronous action before obtaining usage data

-T, the--type= type prints only the specified file system for the specified < type > information

-T,--print-type print file system type

-X, the--exclude-type= type only prints out the file system is not specified < type > info

-V (Ignore)

--HELP Display this help message and leave

--version display version information and leave

Five Awk

http://www.cnblogs.com/ggjucheng/archive/2013/01/13/2858470.htmlawk is a powerful text analysis tool, compared to grep lookup, sed editing, Awk is especially powerful when it comes to analyzing data and generating reports. To put it simply, awk reads the file line-by-row, using spaces as the default delimiter to slice each row, and then perform various analytical processing of the cut.

Six Sed

Http://www.cnblogs.com/dong008259/archive/2011/12/07/2279897.html

Sed is a good file processing tool, itself is a pipe command, mainly in the behavior of the unit processing, you can replace the data rows, delete, add, select and other specific work, the following first understand the use of SED
The SED command line format is:
sed [-nefri] ' command ' input text

Common options:
- N: Use Quiet (silent) mode. In the usage of general sed, all data from stdin is generally listed on the screen. However, if you add the-n parameter, only the line (or action) that is specially processed by SED is listed.
-E: The Action of SED is edited directly on the instruction list mode;
-F: The action of SED is written directly in a file, and-f filename can perform the SED action within filename;
-r:sed's actions support the syntax of extended formal notation. (Presupposition is the basic formal notation of French law)
-I: Directly modify the contents of the read file instead of the screen output.

Common commands:
A: New, a can be followed by a string, and these strings will appear in a new line (the current next line) ~
C: Replace, C can be followed by strings, these strings can replace the line between N1,N2!
D: Delete, because it is deleted ah, so d usually do not pick up any boom;
I: Insert, I can be followed by the string, and these strings will appear on a new line (the current line);
P: Print, that is, print out a selected material. Normally p will work with parameter Sed-n ~
S: Replace, can be directly replaced by work! Usually this s action can be paired with formal notation! For example 1,20s/old/new/g is!

Seven Sort

Http://www.cnblogs.com/dong008259/archive/2011/12/08/2281214.html

The sort command is to help us sort by different data types, its syntax and common parameter formats:
  Sort [-bcfmnrtk][source file][-o output file]
Additional notes: Sort can be sorted for the content of the text file, in the unit of behavior.

Parameters
-B ignores whitespace characters that begin before each line.
-C checks whether the files are sorted in order.
-f sort, ignores uppercase and lowercase letters.
-M sorts the first 3 letters according to the abbreviation of the month.
-N Sorts by the size of the numbers.
-o< the output file > The sorted result into the specified file.
-R is sorted in reverse order.
-t< Delimited character > specifies the field separator character to use when sorting.
-K selects which interval to sort.

Eight Cut

Http://www.cnblogs.com/dong008259/archive/2011/12/09/2282679.html

Cut is a selection command that analyzes a piece of data and takes out what we want. In general, the selection of information is usually for "line" to analyze, not the entire information analysis.

(1) The syntax format is:
Cut [-bn] [file] or cut [-c] [file] or cut [-DF] [file]

Instructions for use
The cut command cuts bytes, characters, and fields from each line of the file and writes those bytes, characters, and fields to standard output.
If you do not specify a File parameter, the Cut command reads standard input. One of the-B,-C, or-f flags must be specified.

Main parameters
-B: Split in bytes. These byte locations will ignore multibyte character boundaries unless the-n flag is also specified.
-C: Split in characters.
-D: Custom delimiter, default is tab.
-F: Used with-D to specify which area to display.
-N: Cancels splitting multibyte characters. Used only with the-B flag. If the last byte of the character falls within the range of <br/> indicated by the List parameter of the-B flag, the character will be written out; otherwise, the character will be excluded.

Commands used by the shell

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.