Linux environment variables, CP commands, MV commands, and document viewing

Source: Internet
Author: User

Linux Environment Variables PATH:

Configure the command file to PATH , you can run it directly. the echo $PATH command allows you to view path paths:

650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M00/08/5C/wKiom1ngVkmyIel0AAJA4brsveU184.png "style=" float : none; "title=" Linux environment variable, CP command, MV Command, document view 107.png "alt=" Wkiom1ngvkmyiel0aaja4brsveu184.png "/>


For example , if we copy the LS command file to a different directory, and then add the directory to the PATH , the copied command file can also be run directly:

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M02/08/5C/wKiom1ngVkrTcQBXAAOMcTwtDMI882.png "style=" float : none; "title=" Linux environment variable, CP command, MV Command, document view 169.png "alt=" Wkiom1ngvkrtcqbxaaomctwtdmi882.png "/>

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M00/A7/13/wKioL1ngU5bCejV2AANJoABhHJQ519.png "style=" float : none; "title=" Linux environment variable, CP command, MV Command, document view 171.png "alt=" Wkiol1ngu5bcejv2aanjoabhhjq519.png "/>

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M00/A7/13/wKioL1ngU5jCQIIYAAWRQ6fUQP0786.png "style=" float : none; "title=" Linux environment variable, CP command, MV Command, document view 173.png "alt=" Wkiol1ngu5jcqiiyaawrq6fuqp0786.png "/>

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M01/08/5C/wKiom1ngVlDAnE13AAUKFJ8exdk269.png "style=" float : none; "title=" Linux environment variable, CP command, MV Command, document view 175.png "alt=" Wkiom1ngvldane13aaukfj8exdk269.png "/>

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M00/08/5C/wKiom1ngVlGQ5HAXAAJINSamHHk072.png "style=" float : none; "title=" Linux environment variable, CP command, MV Command, document view 177.png "alt=" Wkiom1ngvlgq5haxaajinsamhhk072.png "/>


But this way only the current terminal can be effective, after opening a new terminal, it expires:

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M01/A7/13/wKioL1ngU5yjeDMfAAO1QmyaPtA241.png "style=" float : none; "title=" Linux environment variable, CP command, MV Command, document view 212.png "alt=" Wkiol1ngu5yjedmfaao1qmyapta241.png "/>


If you want to take effect at all terminals, change the added environment variable to permanent, and we can use the vi/etc/profile command to edit the profile. This file is used for each boot load initialization variable:

650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M02/08/5C/wKiom1ngVlaTd8wRAAn_Pd93vB4785.png "style=" float : none; "title=" Linux environment variable, CP command, MV Command, document view 306.png "alt=" Wkiom1ngvlatd8wraan_pd93vb4785.png "/>


The source/etc/profile command allows the content in the profile to take effect immediately:

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M01/A7/13/wKioL1ngU6DjmSItAADcum7cheg521.png "style=" float : none; "title=" Linux environment variable, CP command, MV Command, document view 351.png "alt=" Wkiol1ngu6djmsitaadcum7cheg521.png "/>


This is the time to open a new terminal and run the command you just added:

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M01/08/5C/wKiom1ngVlfQmQpsAAOANg1mryw870.png "style=" float : none; "title=" Linux environment variable, CP command, MV Command, document view 382.png "alt=" Wkiom1ngvlfqmqpsaaoang1mryw870.png "/>


To Delete This command, simply re-assign the environment variable, then delete the command file, or you can use the way to edit the profile:

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M02/A7/13/wKioL1ngU6KCvXz9AAN1I1HR0k4383.png "style=" float : none; "title=" Linux environment variable, CP command, MV Command, document view 443.png "alt=" Wkiol1ngu6kcvxz9aan1i1hr0k4383.png "/>

650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M02/A7/13/wKioL1ngU6iyW803AAuFnb9hSyE122.png "style=" float : none; "title=" Linux environment variable, CP command, MV Command, document view 445.png "alt=" Wkiol1ngu6iyw803aaufnb9hsye122.png "/>

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M02/08/5C/wKiom1ngVmCie9itAANDybxZ0Iw684.png "style=" float : none; "title=" Linux environment variable, CP command, MV Command, document view 447.png "alt=" Wkiom1ngvmcie9itaandybxz0iw684.png "/>

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M00/08/5C/wKiom1ngVmCwb4J_AAGUXBJt3Uk509.png "style=" float : none; "title=" Linux environment variable, CP command, MV Command, document view 449.png "alt=" Wkiom1ngvmcwb4j_aaguxbjt3uk509.png "/>



CP Command :

CP is the copy of the abbreviation, is used to copy files and directories, the copy directory will need to add- r option:

650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M00/A7/13/wKioL1ngU6uR07BvAAK35aOr7F4653.png "style=" float : none; "title=" Linux environment variable, CP command, MV Command, document view 500.png "alt=" Wkiol1ngu6ur07bvaak35aor7f4653.png "/>

650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M00/A7/13/wKioL1ngU6vTlVHMAAEq3oo7zeU846.png "style=" float : none; "title=" Linux environment variable, CP command, MV Command, document view 502.png "alt=" Wkiol1ngu6vtlvhmaaeq3oo7zeu846.png "/>

650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M01/08/5C/wKiom1ngVmLgTHi8AAH6M6MD7gc012.png "style=" float : none; "title=" Linux environment variable, CP command, MV Command, document view 505.png "alt=" Wkiom1ngvmlgthi8aah6m6md7gc012.png "/>

650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M01/A7/13/wKioL1ngU6_CuelMAAaOW0-sQaE459.png "style=" float : none; "title=" Linux environment variable, CP command, MV Command, document view 508.png "alt=" Wkiol1ngu6_cuelmaaaow0-sqae459.png "/>

650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M02/08/5C/wKiom1ngVmaTw2VAAANtaFkreTc586.png "style=" float : none; "title=" Linux environment variable, CP command, MV Command, document view 510.png "alt=" Wkiom1ngvmatw2vaaantafkretc586.png "/>


When the directory is copied, it will be copied to the target directory if it is already present, the target a directory that does not exist will copy the original directory and change its name:

650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M02/A7/13/wKioL1ngU7OCEhBZAAfuJGcxbiM323.png "style=" float : none; "title=" Linux environment variable, CP command, MV Command, document view 570.png "alt=" Wkiol1ngu7ocehbzaafujgcxbim323.png "/>


MV Command :

The MV is the abbreviation for move, which moves the file or directory to another directory and can be renamed in the current directory using the rename:

650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M00/08/5C/wKiom1ngVmrwWVCNAAKMQjt5IRw379.png "style=" float : none; "title=" Linux environment variable, CP command, MV Command, document view 632.png "alt=" Wkiom1ngvmrwwvcnaakmqjt5irw379.png "/>

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M00/08/5D/wKiom1ngVufB3BpYAALRnjSWJPc040.png "style=" float : none; "title=" Linux environment variable, CP command, MV Command, document view 634.png "alt=" Wkiom1ngvufb3bpyaalrnjswjpc040.png "/>


When moving a file to the target directory, there is already this file exists will ask whether to overwrite, if you do not want to have this hint, you need to use absolute path to run this command:

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M01/A7/13/wKioL1ngVDPAHr9pAAVqQH7xWcs265.png "style=" float : none; "title=" Linux environment variable, CP command, MV Command, document view 698.png "alt=" Wkiol1ngvdpahr9paavqqh7xwcs265.png "/>


When moving a file to the target directory, the target directory does not exist and the original directory is changed to the name of the target directory:

650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M02/A7/13/wKioL1ngVDmR7fCTAAHDdmb_m4k622.png "style=" float : none; "title=" Linux environment variable, CP command, MV Command, document view 740.png "alt=" Wkiol1ngvdmr7fctaahddmb_m4k622.png "/>

when moving files to the target directory, the target directory will be placed in the target directory, which is the same as the CP command.




some commands for document viewing :

the cat command can view the contents of the file, plus -A option to view all content, plus - n to view the number of rows:

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M01/08/5D/wKiom1ngVvqjfYSXAAXUVg3yLKU386.png "style=" float : none; "title=" Linux environment variable, CP command, MV Command, document view 837.png "alt=" Wkiom1ngvvqjfysxaaxuvg3ylku386.png "/>

650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M01/A7/13/wKioL1ngVFDSuKNqAAi1pQnUkkQ318.png "style=" float : none; "title=" Linux environment variable, CP command, MV Command, document view 839.png "alt=" Wkiol1ngvfdsuknqaai1pqnukkq318.png "/>

650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M00/08/5D/wKiom1ngVwvDIXhVAAh9puXAn-k891.png "style=" float : none; "title=" Linux environment variable, CP command, MV Command, document view 842.png "alt=" Wkiom1ngvwvdixhvaah9puxan-k891.png "/>


The TAC command can view the contents of the file in reverse order:

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M01/08/5D/wKiom1ngVw-AZR7GAAjyXDhjolI500.png "style=" float : none; "title=" Linux environment variable, CP command, MV Command, document view 863.png "alt=" Wkiom1ngvw-azr7gaajyxdhjoli500.png "/>


The more command is also used to view the text content, this command is not displayed all, is a page by page display, you need to press the space bar to page down,ctrl+b is to page up:

650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M00/A7/13/wKioL1ngVF6DdGXtAAncjYMUH2A063.png "style=" float : none; "title=" Linux environment variable, CP command, MV Command, document view 934.png "alt=" Wkiol1ngvf6ddgxtaancjymuh2a063.png "/>

LessCommands and MoreThe command is the same as the page display, but Lesssupport the Direction key scrolling view, also supports the way of page flipping, and one point is not like Morethe command will exit automatically after it is finished, but you need to pressQkey to exit. Lessalso supports querying the location of a character, first entering/Then enter the characters you want to query, then go to query, pressNKey can also continue to query,Shift+nYou can query forward. Input?is the/the opposite of the function is to query from the back forward. InputgNavigate to the beginning of the lineshift+gnavigates to the end of the line. Because Lesshave MoreThere are features and features that are not, so basically all are used LessInstead of using More.


The Head command can view the first ten lines of a file, plus the- n option to specify the number of rows viewed:

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M01/08/5D/wKiom1ngVxbBOE6dAAYHYT-NVdU119.png "style=" float : none; "title=" Linux environment variable, CP command, MV Command, document view 1224.png "alt=" Wkiom1ngvxbboe6daayhyt-nvdu119.png "/>

650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M02/A7/13/wKioL1ngVGDCq43_AAIbMR2Vt70284.png "style=" float : none; "title=" Linux environment variable, CP command, MV Command, document view 1226.png "alt=" Wkiol1ngvgdcq43_aaibmr2vt70284.png "/>


The tail command can view the 10 lines at the end of a file, plus the- n option to specify the number of rows to view, plus the- f option to view the dynamic file because the plus - F option does not exit the file, so it is generally used when looking at the log:

650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M02/08/5D/wKiom1ngVxmC_bROAAQrUhNius0175.png "style=" float : none; "title=" Linux environment variable, CP command, MV Command, document view 1311.png "alt=" Wkiom1ngvxmc_broaaqruhnius0175.png "/>

650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M00/A7/13/wKioL1ngVGOzq6EWAAJfjQK9lE4636.png "style=" float : none; "title=" Linux environment variable, CP command, MV Command, document view 1313.png "alt=" Wkiol1ngvgozq6ewaajfjqk9le4636.png "/>

650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M01/A7/13/wKioL1ngVGXyVbzIAAS-wOi_62o455.png "style=" float : none; "title=" Linux environment variable, CP command, MV Command, document view 1315.png "alt=" Wkiol1ngvgxyvbziaas-woi_62o455.png "/>


This article is from the "12831981" blog, please be sure to keep this source http://12841981.blog.51cto.com/12831981/1972047

Linux environment variables, CP commands, MV commands, and document viewing

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.