Basics of Shell

1.Bash properties

View linux shell script type support

# cat /etc/shells

/bin/sh

/bin/bash

/sbin/nologin

/usr/bin/sh

/usr/bin/bash

/usr/sbin/nologin

/bin/tcsh

/bin/csh

       The earliest is called sh sh, also called bsh, from the development of language and B, after the emergence of Csh, which is similar to c language, it emerged on the basis of ksh csh on top, but ksh for the commercial version, Linux systems appear after all, on the development of a bash, a collection of the advantages of sh, csh and ksh's;

        Now the latest shell compiler also zsh, but use less;

                1. Because Linux is a multi-user, multi-process; so each user application program is the same, but the process is not the same; the same cloning process can be understood as a program; it supports each user their own bash process carried out modified, but the program actually uses bash is the same; how a Linux system to distinguish each user can bash process, which is to be distinguished by the pid;

                 2 bash features: command line processing: ctrl + a ctrl + e ctrl + u ctrl + l ctrl + w ctrl + k

                    Ctrl + u Delete the character before the cursor

                    Ctrl + k Delete the cursor after the character

                    Ctrl + w a space as a separator, to delete files

                    Ctrl + r to enter an interactive interface, a command searches recently used (to be input string)

                    Command History: history

                                       -c

                                       -d 500

                                       -d 500 10

                                       -w // save the file in the home directory .bash_history go, so, even if the restart, clear or -c, the command will be retained history records

                     Command aliases

                                        alias

                                        unalias

                     Replace command

                                        $ (Command)  

                                        # Echo the same "today is $ (date)" and `` achieve the function

                                        # echo "today is `date`"

                                        ``: Forced turn back

                     Tab key applications

                                           1 fill all orders

                                           2 Completion path

                            When the need to complement the command or path is not only enter, all options will be displayed;

                            When too many options to be displayed, it will prompt;

                           

Wildcard file

                                                        *

                                                        ?

                                                        []

                                                        ^

 

2. Regular Expressions

                      \ // turn and character

                      ^ // at the beginning of what

                      $ // what end

                     [] // match a character, specified range [] inside, [^ 0-9] represents the negation

                     [-] // input [-] marked character range

                     // one arbitrary character

                     * // 0 or more arbitrary characters

                    {N, m} // former matches a character or expression to n times m times

                    {N,} // least n times

                    {N} // only n times

                    {, M} // m times at most

                    Grep "^ \\ $" // filename begins with $

3. extended regular expressions

              + // a character or more than once before the match

              ? // before a match one character or expression 0 times

              | // or

           () // Packet

Guess you like

Origin www.cnblogs.com/shandong123/p/11319581.html