Linux Learning essay-shell basic knowledge

Source: Internet
Author: User

1: User's shell History command saved in Home/username/.bash_history

#!! execute the user's previous command #! PW executes the last command in the command history that begins with PW 2: ' * ' to match 0 or more characters '? ' Match one character #ls-D day* lists the directories that start with day and match all characters later #ls-D day? Lists the directory at the start of day, followed by a character 3:>> Append redirect in file > Redirect in Files 4:| Pipe character #cat/etc/passwd|wc-l the output of the CAT/ETC/PASSWD directive is used as input to the WC command. The number of rows that count passwd 5 Ctrl + Z command to pause a task #jobs can view the paused tasks as follows: (my-env) [[email protected] linux_learn]$ jobs [1]+ Stopped vim Test1.txt #fg +id can resume operation #bg +id can put this task in the background run #ps aux |grep test1 can view the PID of the running process in the background #kill-9 PID can end this process 6 $PATHPath When you enter a command, Linux looks for the path that is recorded in path. For example, in the root directory/below you can enter the command LS, you can also enter LS in the/usr directory, but in fact ls This command is not at all in this two directory. in fact, when you enter the command, Linux will go to the/bin,/usr/bin,/sbin and other directories to find the command you entered at this time, and the value of path is exactly the/bin:/sbin:/usr/bin: the colon separates the directory from the directory. 7 SET command can display the system preset variables such as path home, you can also display the user's own defined variables #myname =aming Setting custom variables #set |grep myname myname=aming You can view the variables that you define #bash into another shell. #set |grep myname cannot see the variables we define, the defined variables exist only in the defined shell . 7.1 allow defined variables to be used by all users #sudo Vim/etc/profile Add Export myname=aming #source/etc/profile Effective 7.2 Let the defined variables take effect in all child shells #abc =123 #export ABC 7.3 Canceling a variable unset #unset ABC #unset myname 8 WC Command # wc/etc/passwd-l Count rows # wc/etc/passwd-m Count characters # wc/etc/passwd-w Number of statistical words 9 ~ Indicates the user's home directory Root under the/root Normal user under/home/username 2> indicates error redirection 2>> indicates error append redirect #ls aaaa 2>/tmp/error #ls aaaa 2>>/tmp/error You can view errors in error            

Linux Learning essay-shell basic knowledge

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.