Some of the basics of using Linux and bash

Source: Internet
Author: User
Tags aliases clear screen

Basic principles of Linux:
1. A small program consisting of a single purpose, combining small procedures to complete complex tasks;
2. All documents;
3. Avoid capturing user interfaces as much as possible: minimizing interaction with users;
4. The configuration file is saved in plain text format;


Bash and its features:
Shell: Shell Program
Gui:gnome,kde,xfce
Cli:sh,csh,ksn,bash,tcsh,zsh
Command prompt, Orimpt,bash (shell)
#: Root
$: Normal User

Command type:
Built-in commands (shell built-in)
External command: There is an executable file corresponding to the command name in a path on the file system
Type: Shows which type the specified command belongs to

Command format: commands [option] [Paremeter]
Option
Short Options:-
Long options:--

Query for command:
which [-A] command
-a lists all found commands

Use of Bash shell:
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 + <-: jumping between words
Ctrl+l: Clear Screen

Command history:
History :
- C: empty command history
-D: Delete the specified command history, offset [n]
-W: Saves the command history of the buffer to the history file/home/username/.bash_history

!n: Executes the nth command in the command history
!-n: Executes the last 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
!$: Referencing the last parameter of the previous command
ESC.

Command aliases:
Alias--View the current command alias
alias command= ' command [option] ... '--Create a command alias
unalias Command--Revoke alias
--aliases defined in the shell are valid only in the current shell life cycle: The valid range of aliases is only the current shell process;

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

Command substitution:
$ (command)
' Command '
--the process of replacing a subcommand in a command with the result of its execution
Touch./file-$ (Date +%f-%h-%m-%s)
Touch./file-' Date +%f-%h-%m-%s '


File wildcard characters:
Mans 7 Glob

*: Any character of any length
?: any single character
[]: matches any single character in any range
[^]: Exclude a single character from a specified range
[[: Space:]]: white space characters
[[:p UNCT:]]: punctuation
[[: Lower:]]: lowercase letters
[[: Upper:]]: Uppercase
[[: Alpha:]]: Uppercase and lowercase letters
[[:d Igit:]]: Number
[[: Alnum:]]: Numbers and uppercase and lowercase letters

Some of the basics of using Linux and bash

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.