"Linux" Bird's Linux private cuisine basic study finishing (five)

Source: Internet
Author: User

1. Type [-TPA] name: see if the name command is a bash built-in command.
Parameters:
Type: Without any arguments, type shows the built-in commands for external commands or bash;
-T: When the-t parameter is added, the type shows its meaning by the following keywords:
File: Represented as an external command
Alias: represented as a named alias
Builtin: Built-in commands that are represented as bash
-P: The full file name is displayed if the next name is an external command;
-A: The path defined by the path variable is listed with the command containing the name, including the alias.

2. unset Name: Cancels the setting of the variable name name.

3. ENV: View environment variables.
Description of common environment variables:
HOME: Folder with head of household;
Shell: The shell path used by the current environment;
Histsize: Number of historical command bars;
Mail: When using the Mail command, the system will go to read the mailbox file;
Path: executable file path;
LANG: Language data;
Random: Stochastic number variable.

4. Set: View all variables (environment variables and custom variables).
Description of common variables:
PS1: command-line prompt, which has the following meanings:
\d: The date format of "Day of the Week" can be displayed;
\h: Full host name;
\h: Takes only the name of the hostname before the first decimal point;
\ t: Display time, 24-hour format "HH:MM:SS";
\ t: Display time, 12-hour format "HH:MM:SS";
\a: Display time for the 24-hour format "hh:mm";
\@: Display time for the 12-hour format "AM/PM";
\u: The current user's account name;
\v:bash version information;
\w: The full working directory name;
\w: Use the basename function to get the working directory name, listing only the last directory name;
\#: The first few orders executed;
\$: prompt, if root, displays #, other displays $.
$: Indicates the current shell thread pid;
?: Represents the callback code for the previous execution command.

5. Locale [-a]: query supported languages.
Parameters:
No parameters: View language-related variable settings;
-A: View all supported languages.

6. read [-PT] variable: read input from keyboard to variable.
Parameters:
-P: Can be followed by a prompt;
-T: The number of seconds that can be followed to wait.

7. Declare [-AIXR] variable: Declares the type of the variable.
Parameters:
-A: Declares the variable as an array type;
-I: Declare variables as integers;
-X: Declare the variable as an environment variable;
-r: Set Variable to read-only type

8. Ulimit [-SHACDFLTU] [quota]: Limit quota settings.
Parameters:
-h:hard limit, strictly set, must not exceed this setting value;
-s:soft limit, warning setting, can exceed this setting value when a warning message is generated;
-A: The following does not take any parameters, list all limit quotas;
-C: Limit the maximum capacity of each core file;
-F: Limits the maximum file size that the shell can create;
-D: Maximum fractured memory capacity that the process can use;
-L: Memory capacity that can be used for locking;
-T: Maximum CPU time that can be used;
-U: The maximum number of processes that a single user can use.

9. Deletion and substitution of variable contents.
How to set the variable:
${variable # keyword}: If the variable content from the beginning of the data according to the "keyword", the minimum data will be met to delete;
${variable # #关键字}: If the contents of the variable content from the beginning of the data conform to the "keyword", then the longest data will be met delete;
${Variable% keyword}: If the variable content from the tail forward data conforms to the "keyword", the minimum data will be met to delete;
${variable Zero keyword}: If the variable content from the tail forward data conforms to the "keyword", then the longest data will be met deleted;
${variable/old string/new string}: If the variable contents conform to the "old string", then the first old string will be replaced by the new string;
${variable//old string/new string}: If the variable contents conform to the "old string", then all old strings will be replaced by the new string.

History [N]/history [-c]/history [-raw] histfiles: Historical command.
Parameters:
N: number, which lists the nearest n commands;
-C: Clears all the history contents of the current shell;
-A: Add the current New History command to Histfiles, default write ~/.bash_history;
-r: Read the contents of Histfiles into the current shell history;
-W: Writes the current New History command to Histfiles.

!number/!command/!!. : Executes the command in the history.
Parameters:
Number: digit, the execution of the first order;
Command: Executes the most recent commands that begin with the order;
!! : Executes the previous command.

The cut-d ' delimited character '-F fields/cut-c character range: separates the information.
Parameters:
-D: followed by delimited characters, used with-F;
-F: Indicates the first segment after the split is listed;
-C: Lists fixed character ranges in units of characters.

grep [-ACINV] [--color=auto] ' Find string ' filename: Find information.
Parameters:
-A: Find the binary file in the form of a text file;
-C: Calculates the number of times to find the ' find string ';
-I: Case insensitive;
-N: Output line number at the same time;
-V: Reverse selection;
--color=auto: Adds the found keywords to the color display.

sort [-fbmnrtuk] [file or stdin]: sort.
Parameters:
-F: ignores case differences;
-B: Ignores the front-most whitespace;
-M: Sort by the name of the month;
-N: Sort by using pure numbers, by default, by dictionary order;
-R: Reverse sort;
-u:uniq, using the same data, displays only one row;
-T: Set delimiter, default is [Tab];
-K: Sets the specified sort interval.

Uniq [-ic]: Duplicate data shows only one.
Parameters
-I: Case insensitive;
-C: Count.

WC [-LWM]: Count.
Parameters:
-L: Only the travel is listed;
-W: Only How many words are listed;
-M: Lists only how many characters.

Tee [-A] file: Dual redirection (both screen and file redirection).
Parameters:
-A: Add file in an additive manner.

TR [-ds] SET1 ... : delete or replace text.
Parameters:
-D: Removes the SET1 string from the message;
-S: Replace duplicate strings
TR ' [A-z] ' [A-z] ': Replace all lowercase letters with uppercase letters.

Col [-XB]: Transfer character substitution.
Parameters:
-X: Replace the [Tab] key with the equivalent space bar;
-B: Only the last character of the backslash is retained when there is/when in the text.

Join [-ti12] file1 file2: Add rows with the same data in two files.
Parameters:
-T: The default is to divide the data with space characters, and compare the data of the first field, if the first field of two files is the same, then two data is consolidated into one row of data;
-I: Ignoring the difference in case;
-1: Which field is used to analyze the first file, followed by the number;
-2: Which field is used to parse the second file, followed by the number.

Paste [-d] file1 file2: Paste the two files directly together and split them with the [Tab] key.
Parameters:
-D: Can be followed by the split character, by default, the [Tab] key split;
-: If the file section is written-, represents the standard input.

Expand [-T] File: Converts the [Tab] key to the SPACEBAR.
Parameters:
-T: followed by a number that indicates how many spacebar the [Tab] key can be replaced with.

Split [-BL] file PREFIX: Cut command.
Parameters:
-B: After the file size to be divided, can be added units, such as B, K, M and so on;
-L: Cut by the number of rows;
PREFIX: Represents a leader character that can be used as a leading text for a cut file.

xargs [ -0EPN] command: parameter substitution.
Parameters:
-0: If the input stdin contains special characters, restore it to a normal character;
-E: Represents the specified terminator, Xargs analysis to the specified character after the stop to continue working;
-P: The user's meaning is queried when the parameters of each command are executed;
-N: The number of arguments to use after each command execution.
Using Xargs is because many commands do not actually support pipeline commands and can be xargs to provide the command reference stdin.

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.