Basic commands for Linux and win

Source: Internet
Author: User
Tags exit mkdir

1, Print working directory: PWD

(That is, your main work environment, such as in the Cygwin input pwd, the reality is/home/administrator)

Win is the same as Linux

2. Print Computer name: hostname

3, create a directory: mkdir

The difference between Linux and win is when you create a table of contents,

The operation of Linux is Mkdir-p Temp/stuff/things/john

The operation of Win is mkdir Temp/stuff/things/john

4, change the directory (personal feeling should be called Open Directory): CD

CD temp/stuff/things

Cd.. /.. /.. /(two points for one level)

5. List contents: ls

6, delete the path, directory: RmDir

7, pushd push into the path, such as in a directory can be directly pushd to other directories (belonging to temporary access, convenient exchange)

8, popd roll back to the push before the directory

Attention:

The pushd command will "push" your current directory to a list for later use, and then let you move to another directory. It

"Remember my present position and go to this place," said the general. ”

The popd command will "pop up" the list of your last push, and then let you return to the "pop-up" directory.

9. Create an empty file:

Under Linux is: Touch

Under Win is: New-item iamcool.txt-type file

10, copy the file:

Under Linux:

In a directory wash replication aaa.txt CP aaa.txt Bbb.txt

Copy a file area another folder content CP Aaa.txt bbb/

In the same directory, copied from one directory to another, cp-r BBB (directory name) newb (new directory name) "Copy the past is the BBB directory under the file name." 】

The last difference under win is to change R to Recurse

11, move the file or say rename: MV

Linux: Renaming files mv Aaa.txt BBB.TXT,MV Triple A BBB

Win under: Same

12, view the contents of the file:

linux:less filename, q exit

Win:more file name

13, flow-style content display, that is, open the file cat:

Linux:cat Baidu.log

WIN: Same

14, delete files: RM

LINUX:RM file name multiple files rm aaa.txt Bbb.txt

Win: Unlike Linux, it is necessary to delete multiple files by one by one.

The cycle of deletion should be careful, the circular deletion is rm-r something

15. Pipelines and redirects:

Linux:

| Directs the output of the left-hand command to the zip command;

< send the right file as input to the program on the left > write the output of the left command to the file on the right

>> append the output of the left command to the file on the right

Win:

"I don't know".

16, wildcard character matching: *

Linux: matches any character

Win: Same

17, looking for documents: find

Under Linux: Find. -name "*.txt"-print "find, filename, and print"

Win under: Dir-r such as: Dir-r-filter "*.txt"

18, File Find content: grep,select-string

Linux: Directly write content cat > Aaa.txt keyboard ctrl+d Close, find words, use grep name (feature), such as new *. txt

Win: Directly write the content echo > Aaa.txt keyboard ctrl+d off. Use select-string lookup, such as select-string new *.txt

"Note": Grep-i ignores case

19, the command line Help (MAN,HELP)

Linux:man such as: Mans grep

Win:help such as: Help Dir/help CP

20. Looking for help (apropos, helps)

Linux Apropos is not available

Win is based on help to add * such as, help *remove*

21. Environment variable (env,echo,env:)

Print out existing environment variables

Under Linux is env

Win under IS Get-childitem env

22. Modify Environment Variables:

Get-childitem ENV:

23, leave the command line

Linux Exit,win like

(reprint please indicate from: http://www.waibiduihuan8.com/, thank you!) Cherish the fruits of other people's work, is to respect their own!

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.