Use Linux commands in Windows cmd

Source: Internet
Author: User
Tags decompress file

After using Linux for a long time, I still fold the powerful commands of Linux. Although the doc in Windows certainly has commands, I feel that I am not familiar with them, and I am not strong enough. So I want to use Linux commands in Windows to solve some problems.

I met a file format that I want to see in windows. Because it is a large file exported from a database by someone else, when I open several GB files, I will report that the memory is insufficient, otherwise, TXT does not respond for a long time.

I think of the more command in Linux and want to install a tool that supports Linux commands. (Of course, another solution is to install a Linux virtual machine, but you need to upload the tool again, is not a good solution)

 

First, download cygwin InstallationProgramClick to download

 

Installation:

1. Double-click setup.exe

2. Follow the installation prompt "Next"

3. Select "Install from Internet:


4. select the installation path, which is generally c: \ cygwin. Select the local temporary directory to store the downloaded software. Select the method for connecting to the Internet, and select "Direct Connection.

5. Select the download source. In the download list, select http: // www.Cygwin. Cn or, enter http: // www.Cygwin. CN/pub/

6. Select the software package to be installed according to the installation prompt.

Use

1. Double-click the cygwin icon on the desktop to start bash in cygwin.

2. Alternatively, you can add C:/cygwin/bind to your pathpattern, And you can directly use Linux commands in cmd.exe, such as less, Cat, WC, and wget.

3. If you have a bash script, you can directly call it in the form of C:/cygwin/bin/bash.exe X:/scripts/monitor. Sh.

 

//////////////////////////////////////// /////////////

(Gnuwin32 home: http://gnuwin32.sourceforge.net /)

1. Download wget first, my favorite download tool (the second 0.0 of Xunlei's no-advertisement Version)
Http://downloads.sourceforge.net/gnuwin32/wget-1.11.4-1-setup.exe haha
Run the following command in c: \ windows to directly use it in Linux.

2. Local Language Support library libintl (the following software package is better to download with wget, thunder and other Downloaders to deal with HTTP/FTP instability ):

Download Home Page: Http://gnuwin32.sourceforge.net/packages/libintl.htm
Software Download: 
Http://switch.dl.sourceforge.net/sourceforge/gnuwin32/libintl-0.14.4-bin.zip wget-C

3. character encoding switching Library

Download Home Page: Http://gnuwin32.sourceforge.net/packages/libiconv.htm
Software Download:
Wget-CHttp://switch.dl.sourceforge.net/sourceforge/gnuwin32/libiconv-1.9.2-1-bin.zip

4. Linux core command Library:
Download Home Page:Http://gnuwin32.sourceforge.net/packages/coreutils.htm
Software Download:
Wget-CHttp://switch.dl.sourceforge.net/sourceforge/gnuwin32/coreutils-5.3.0-bin.zip

5. Installation instructions:

1)decompress file coreutils-5.3.0-bin.zip to c: \ windows \ coreutils-5.3.0-bin

2. decompress the file libiconv-1.9.2-1-bin.zip and copy the file under the object bin to c: \ windows \ coreutils-5.3.0-bin \ bin.

3. decompress the file libintl-0.14.4-bin.zip, and copy the file under the object bin to c: \ windows \ coreutils-5.3.0-bin \ bin

4) Right-click my computer and choose Properties> advanced environment variables.
Add the last sentence "; C: \ WINDOWS \ coreutils-5.3.0-bin \ bin" in the environment variable path (do not delete the original quotation marks if they are not included)

After the installation, the following commands are available ("[" is a command that I have never seen before ..) :
[, Basename, Cat, chgrp, chmod, chown, chroot, cksum, comm, CP, csplit, cut, date, DD,
DF, Dir, dircolors, dirname, Du, Echo, ENV, expand, expr, factor, false, FMT, fold,
Gdate, gecho, ginstall, Gln, gmkdir, grmdir, groupsgsort, Head, hostid, hostname, ID,
Install, join, kill, Link, LN, LOGNAME, ls, md5sum, mkdir, mkfifo, mknod, MV, nice,
NL, nohup, OD, paste, pathchk, Pinky, PR, Printenv, printf, PTX, PWD, readlink, RM,
Rmdir, seq, setuidgid, sha1sum, shred, sleep, sort, split, stat, stty, Su, sum, sync,
Tac, tail, Tee, test, touch, TR, true, Tsort, tty, uname, unexpand, uniq, unlink,
Uptime, users, vdir, WC, WHO, whoami, yes

6. Missing commands:
1)
Grep
Http://downloads.sourceforge.net/gnuwin32/grep-2.5.4-bin.zip wget-C
Decompress the package and put the three files under the Bin into C: \ WINDOWS \ coreutils-5.3.0-bin \ bin, it can be seen that egrep, fgrep also has

Grep is not available now. Several DLL files are required.
Http://gnuwin32.sourceforge.net/downlinks/pcre-bin-zip.php wget-C
Decompress the package and put several files in the bin to c: \ windows \ coreutils-5.3.0-bin \ bin

2)
Tree (gnuwin32.sourceforge.net all use wget, and other download attempts are attempted)
Http://downloads.sourceforge.net/gnuwin32/tree-1.5.2.2-bin.zip wget-C
After decompression, put the BIND tree.exe under c: \ windows \ coreutils-5.3.0-bin \ bin

3)
File
Http://downloads.sourceforge.net/gnuwin32/file-5.03-bin.zip wget-C
Decompress and put the two files in BIN to C: \ WINDOWS \ coreutils-5.3.0-bin \ bin
Put the share \ MISC directory under C: \ WINDOWS \ coreutils-5.3.0-bin \ share

Http://gnuwin32.sourceforge.net/downlinks/filetype-bin-zip.php wget-C
Decompress and put the two files in BIN to C: \ WINDOWS \ coreutils-5.3.0-bin \ bin

Download the two DLL files on which the file depends.
Http://gnuwin32.sourceforge.net/downlinks/regex-bin-zip.php wget-C
Decompress, put the BIN file under c: \ windows \ coreutils-5.3.0-bin \ bin

Http://gnuwin32.sourceforge.net/downlinks/zlib-bin-zip.php wget-C
Decompress, put the BIN file under c: \ windows \ coreutils-5.3.0-bin \ bin

4)
Find, locate, and xargs
Http://gnuwin32.sourceforge.net/downlinks/findutils-bin-zip.php wget-C
Decompress, put the BIN file under c: \ windows \ coreutils-5.3.0-bin \ bin, their dependent DLL in front of the libint with libiconv fashion good

5) less
Http://ncu.dl.sourceforge.net/sourceforge/gnuwin32/less-394-bin.zip wget-C
Decompress, put the BIN file under c: \ windows \ coreutils-5.3.0-bin \ bin

6)
Gzip, Bzip2, tar
Http://gnuwin32.sourceforge.net/downlinks/gzip-bin-zip.php wget-C
Http://gnuwin32.sourceforge.net/downlinks/bzip2-bin-zip.php wget-C
Http://gnuwin32.sourceforge.net/downlinks/tar-bin-zip.php wget-C
Decompress, put the BIN file under c: \ windows \ coreutils-5.3.0-bin \ bin

7)
Which
Http://downloads.sourceforge.net/gnuwin32/which-2.20-bin.zip wget-C
Decompress, put the BIN file under c: \ windows \ coreutils-5.3.0-bin \ bin

8)
Make
Http://gnuwin32.sourceforge.net/downlinks/make-bin-zip.php wget-C

9)
I haven't found any more.

 

 

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.