Linux-shell basics-shell

Source: Internet
Author: User

Linux-shell basics-shell

1: The user's shell History commands are saved in home/username/. bash_history

#!! Execute the user's previous command #! Pw The last command starting with pw in the execution history 2: '*' to match zero or multiple characters '? 'Match one character # Ls-d Day * lists directories with names starting with Day and matching all characters # Ls-d Day? List directories that start with Day and match with one character 3:> append redirection to a file > Retargeting in files 4: | MPs queue Operator # Cat/etc/passwd | wc-l The output of cat/etc/passwd command is used as the wc command input. Count the number of passwd rows 5 ctrl + z command to pause a task # Jobs: (My-env) [flex @ localhost linux_learn] $ jobs [1] + Stopped vim test1.txt # Fg + id can resume operation # Bg + id: This task can be run in the background # Ps aux | grep test1 can view the pid of the process running in the background # Kill-9 pid can end this process 6 $ PATH PATH when you enter the command, LINUX will find the PATH recorded in the PATH. For example, you can enter the ls command in the root directory, You can also enter ls in the/usr directory, But in fact, the ls command is not in these two directories at all. In fact, when you enter the command, LINUX will go to/bin,/usr/bin,/sbin and other directories to find the command you entered at this time, The value of PATH is/bin:/sbin:/usr/bin: The colon separates directories from directories. 7. The set command can display system preset variables, such as path home, and User-Defined variables. # Myname = Aming set custom Variables # Set | grep myname Myname = Aming You can view your own Defined variables. # Bash enters another shell # Set | grep myname: The Defined variables cannot be viewed. The Defined variables only exist in the defined shell. 7.1 make the Defined variables available to all users # Sudo vim/etc/profile Add export myname = Aming # Source/etc/profile takes effect 7.2 make the Defined variables take effect in all sub-shells # Abc= 123 # Export abc 7.3 unset the variable # Unset abc # Unset myname 8 wc command # Wc/etc/passwd-l count the number of rows # Wc/etc/passwd-m count # Wc/etc/passwd-w count 9 ~ Indicates the user's home directory. Root under/root Common users are in/home/username 10 2> indicates redirection of errors 2> indicates an error append redirection. # Ls aaaa 2>/tmp/error # Ls aaaa 2>/tmp/error You can view errors in error             

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.