The basic features of the Linux Command Bash (1) (Command history, command completion, path completion, command line expansion). )

Source: Internet
Author: User
Tags parent directory

    1. Command history

History

Environment variables:

Histsize: Number of records in the command history

Histfile:~/.bash_history

Histfilesize: The number of history records in a command history file

history-d OFFSET: Delete a History

History + Numbers: Show the last n record commands

Call History Command:

! + numbers: for example! 3: Repeat the Third historical command

!! : Repeats the previous command

! String: The most recent command to start with the specified string

Call the last parameter of the previous command:

! $

ESC and then press.

Alt +.

Control how the Command history is recorded:

Environment variable: Histcontrol

Ignoredups: Ignore duplicate commands (commands must be sequential and duplicate)

Ignorespace: Ignore commands that begin with whitespace

Ignoreboth: All two are ignored.

Modify environment variable Value: Export variable name = "Value"

2. Command completion

Bash Execution Command:

Internal command:

External command: Bash searches for a file named after a given command name from the left and right, based on the path defined by the PATH environment variable, the command to be executed the first time it is found

Direct completion: Tab, the user given a string with only one single corresponding command

Indirect completion: The user given a string for the beginning of the corresponding command is not unique, double-click tab to give all the list of satisfied conditions

3. Path completion

Take the user-given string as the beginning of the path and search for the file name at the beginning of the specified string with the specified parent directory:

If only: the direct complement

If not unique: press TAB again to display the list of all conditions that meet

4. Command line expansion

~: Expand to the user's home directory

~username: Expand the home directory for the specified user

{}: Can host a comma-delimited list and expand to multiple paths

For example:/tmp/{a,b} =/tmp/a and/tmp/b

/TMP/{A,B}/C = tmp/a/c and/tmp/b/c

5. Directory Management class commands

mkdir [Options]/path/to/somewhere

-P: If the intermediate directory does not exist, do not error, step by step to create a directory

-V: Show more information

-M: Specify permissions when creating a directory

Tree

-D: Show only directories

-L: Specify the number of levels to display

-P: Displays only the path that is matched by the specified P

RmDir: Delete Empty directory

-V: Display procedure

The basic features of the Linux Command Bash (1) (Command history, command completion, path completion, command line expansion). )

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.