Linux Learning Notes (7)

Source: Internet
Author: User

One, PATH environment variable

PATH environment variable

With which, you can see the path to a command, including its alias, which is actually located in the directory of the current environment.

echo $PATH View current command RM =/usr/bin/rm

Example: CP/USR/BIN/LS/TMP/BIN/LS2

If you want to use LS2 directly, there are two ways to do this:

(1): path= $PATH:/directory/temporarily change environment variable, new open terminal will disappear

650) this.width=650; "Src=" Https://s2.51cto.com/oss/201710/23/e06707df82d4d1ea346b4fd65caeade0.png-wh_500x0-wm_3 -wmp_4-s_557322991.png "title=" 1508741817 (1). png "alt=" E06707df82d4d1ea346b4fd65caeade0.png-wh_ "/>

(2):/etc/profile last line joins path= $PATH:/directory/methods for permanently modifying environment variables

650) this.width=650; "Src=" Https://s5.51cto.com/oss/201710/23/5e954f140828200aabe549133dc271ac.png-wh_500x0-wm_3 -wmp_4-s_537384374.png "title=" 2.png "alt=" 5e954f140828200aabe549133dc271ac.png-wh_ "/>

650) this.width=650; "Src=" Https://s5.51cto.com/oss/201710/23/7dc7035e1b9ac48bbbf324085a26b944.png-wh_500x0-wm_3 -wmp_4-s_619847577.png "title=" 3.png "alt=" 7dc7035e1b9ac48bbbf324085a26b944.png-wh_ "/>

Second, CP command

CP Copy copy copies the source file to the destination file

-R Copy a directory (should be taken when copying to the target directory)

The alias of CP = Cp-i is a security parameter when the target file is present.

650) this.width=650; "Src=" Https://s4.51cto.com/oss/201710/23/982490a4b66bc13aec4826138854c207.png-wh_500x0-wm_3 -wmp_4-s_3970598249.png "title=" 1.png "alt=" 982490a4b66bc13aec4826138854c207.png-wh_ "/>

When the target directory already exists, the copy directory is not overwritten, and the directory is placed directly into the target directory. When the directory is already in the target directory, the copy will ask if it is overwritten.

650) this.width=650; "Src=" Https://s4.51cto.com/oss/201710/23/2ce2a0e20b8f16a32c1d0aa2f7941411.png-wh_500x0-wm_3 -wmp_4-s_3475880867.png "title=" 3.png "alt=" 2ce2a0e20b8f16a32c1d0aa2f7941411.png-wh_ "/>

Three, MV command

MV Move File

-I security tips, whether to overwrite

Moving in the same directory is equivalent to changing the file name, the destination directory does not exist

650) this.width=650; "Src=" Https://s1.51cto.com/oss/201710/23/9fee2258b80ca2796e7970b869432ee6.png-wh_500x0-wm_3 -wmp_4-s_1299522813.png "title=" 1508744812 (1). png "alt=" 9fee2258b80ca2796e7970b869432ee6.png-wh_ "/>

You can also move to a different directory to change the name, and when the target directory is sometimes asked whether to overwrite

650) this.width=650; "Src=" Https://s3.51cto.com/oss/201710/23/ae456da3ca2794f8c02de35d0b4555c9.png-wh_500x0-wm_3 -wmp_4-s_3963933903.png "title=" 1.png "alt=" Ae456da3ca2794f8c02de35d0b4555c9.png-wh_ "/>

650) this.width=650; "Src=" Https://s1.51cto.com/oss/201710/23/c389bda7f3877cf9dafcbbd0a588b6a7.png-wh_500x0-wm_3 -wmp_4-s_3170510079.png "title=" 3.png "alt=" C389bda7f3877cf9dafcbbd0a588b6a7.png-wh_ "/>

Iv. Document View Cat/more/less/head/tail

1.cat viewing file Contents Tac Flashback view File contents

-a displays all characters (for example, the end of each line will appear ¥)

-N Display Line number


2.more display file with one screen and one screen


3.less more similar but support up and down key page to see last press Q key to exit

/Looking back from the past? Find from the back forward

Ctrl+b look up crtl+f look down

N Next target Shift+n previous target

G navigates to the first line shift+g to the tail line

Wc-l View the number of rows in a file


4.head viewing files at the beginning of 10 lines tail viewing the last 10 lines of a file

-n Specifies the number of rows to view

-F Dynamic View file


Linux Learning Notes (7)

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.