Linux (11) Recognize and learn bash

Source: Internet
Author: User
Tags clear screen

Bash and its features:
Shell: Shell
Gui:gnome, KDE, XFCE
Cli:sh, CSH, ksh, bash, tcsh, zsh

Process: In each process it appears that only the kernel and the current process exist on the current host
A process is a copy of a program, and a process is a program execution instance

User working environment:
Bash:
#
$

Bash:
1. Command history, Command completion
2, Pipeline, redirect
3. Command aliases
4. Command line editing
5. Command line expansion
6. File name Wildcard
7. Variables
8. Programming

command-line editing:
Cursor Jump:
CTRL + A: Skip to the beginning of the command
Ctrl+e: Jump to the end of the command line
Ctrl+u: Delete the cursor to the beginning of the command line
CTRL+K: Delete the cursor to the end of the command line
Ctrl+l: Clear Screen

Command history:
View command history: Historical
-C: Empty command history
-D OFFSET [n]: Delete command at specified position
-W: Save the Command history to the history file

The use of command history tips:
!n: Executes the nth command in the command history;
!-n: Executes the reciprocal nth command in the command history;
!: Executes the previous command;
!string: The most recent command in the command history that starts with a specified string
!$: References the last parameter of the previous command;
Esc.
ALT +.

Command completion, PATH completion

Command completion: Search the PATH environment variable specified by each of the paths with the string we give the beginning of the executable file, if the extra one, two times tab, you can give a list; otherwise it will be directly complete;
Path completion: Search for each filename under the starting path we give, and try to complement it;
Command aliases
Alias cmdalias= ' COMMAND [options] [arguments] '
Aliases defined in the shell are valid only for the current shell life cycle, and the valid range of aliases is only the current shell process;

Ualias Cmdalias

\cmd


Command substitution: $ (command), anti-quote: ' command '
To replace a subcommand in a command with the process of executing the result
File-2013-02-28-14-53-31.txt


Quotes supported by bash:
": Command substitution
"": weak reference, can implement variable substitution
': Strong reference, do not complete variable substitution


File name wildcard, globbing
*: Any character of any length
?: any single character
[]: matches any single character within the specified range
[ABC], [A-m], [A-z], [A-z], [0-9], [a-za-z], [0-9a-za-z]
[: Space:]: white space character
[:p UNCT:]: Punctuation
[: Lower:]: lowercase letters
[: Upper:]: Uppercase
[: Alpha:]: Uppercase and lowercase letters
[:d igit:]: Number
[: Alnum:]: Numbers and uppercase and lowercase letters

# Man 7 Glob
[^]: matches any single character outside the specified range

[[: Alpha:]]*[[:space:]]*[^[:alpha:]]

Linux (11) Recognize and learn bash

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.