Here are some ports of common GNU utilities to native Win32. In this context, native means the executables do only depend on the Microsoft C-runtime (msvcrt.dll) and not an emulation layer like that provided by Cygwin tools. 这是部分 移植到原生 Win32 的通用GNU实用程序。在这里,原生意味着可执行文件仅依赖于 Microsoft C 运行时 (msvcrt.dll),而不是像Cygwin 工具提供的模拟层。
Download:
by http: UnxUtils.zip
by ftp: no FTP mirror at the moment
latest updates (after 14-04-03): UnxUpdates.zip
| Program | Notes | ||
|---|---|---|---|
| agrep.exe | got it from here: http://www.tgries.de/agrep/ | ||
| ansi2knr.exe | |||
| basename.exe | |||
| bison.exe | |||
| bzip2.exe | Julian Seward's alternative compressor | ||
| bunzip2.exe | |||
| bzip2recover.exe | |||
| cat.exe | |||
| chgrp.exe | dummy | ||
| chmod.exe | |||
| chown.exe | dummy | ||
| cksum.exe | |||
| cmp.exe | |||
| comm.exe | |||
| compress.exe | for (de)compressing .Z files; this is actually a program called ncompress and was found on one of the Linux mirrors | ||
| cp.exe | works only on NT, does real hardlinks on NTFS | ||
| csplit.exe | |||
| cut.exe | |||
| date.exe | |||
| dd.exe | |||
| df.exe | dummy | ||
| diff.exe | |||
| diff3.exe | |||
| dirname.exe | |||
| du.exe | |||
| echo.exe | |||
| egrep.exe | |||
| env.exe | dummy | ||
| expand.exe | |||
| expr.exe | |||
| factor.exe | |||
| fgrep.exe | |||
| find.exe | Example of command line under Cmd/Command shell: find -name *.txt -exec cat {} ; | ||
| flex.exe | |||
| fmt.exe | |||
| fold.exe | |||
| gawk.exe | input files are opened in text mode | ||
| make.exe | From v3.77 upwards, make searches for a sh.exe on the path. If it does not find one, it switches to win32 make mode that is it uses intermediate batch files for command processing. This is fine until your makefile tries to execute something like mkdir, which will invoke the internal mkdir from cmd.exe or command.com. As the results may not be to your liking, you may prefer to use the sh.exe provide here. | ||
| grep.exe | |||
| gsar.exe | |||
| gunzip.exe | |||
| gzip.exe | |||
| head.exe | |||
| id.exe | dummy | ||
| install.exe | |||
| join.exe | |||
| less.exe | |||
| ln.exe | works only on NT, does real hardlinks on NTFS | ||
| logname.exe | |||
| ls.exe | |||
| m4.exe | |||
| md5sum.exe | |||
| mkdir.exe | |||
| mkfifo.exe | dummy | ||
| mknod.exe | dummy | ||
| mv.exe | |||
| mvdir.exe | |||
| nl.exe | |||
| od.exe | |||
| paste.exe | |||
| patch.exe | |||
| pathchk.exe | |||
| pr.exe | |||
| printenv.exe | |||
| printf.exe | |||
| ptx.exe | |||
| recode.exe | |||
| rm.exe | |||
| rman.exe | PolyglotMan by Thomas A. Phelps ( source) | ||
| rmdir.exe | |||
| sdiff.exe | |||
| sed.exe | |||
| seq.exe | |||
| sleep.exe | |||
| sort.exe | |||
| sh.exe | renamed zsh - this is no replacement for the Cygwin bash | ||
| shar.exe | only works with -T (text) option | ||
| split.exe | |||
| stego.exe | *stego -E encode.me -T words.txt *Encodes file encode.me as gibberish text using words from the words.txt file to stdout. If the -T option is omitted, stego looks for a file called "words" in the current directory. Of course, the -D option will decode the input file; remember to redistribute words.txt together with the encoded file. The purpose of this program is to disguise binary files as a kind of text file or to drive your coworkers mad. | ||
| su.exe | dummy | ||
| sum.exe | |||
| sync.exe | |||
| tac.exe | |||
| tail.exe | |||
| tar.exe | only forward slashes are acceptedthe -z option (compression) does not workno remote archivesworks only on NT, does real hardlinks on NTFS | ||
| tee.exe | |||
| test.exe | |||
| touch.exe | |||
| tr.exe | |||
| uname.exe | |||
| unexpand.exe | |||
| uniq.exe | |||
| unrar.exe | This is unrar 3.00 beta 7, which seems to have been "free". Works good enough. | ||
| unshar.exe | |||
| uudecode.exe | |||
| uuencode.exe | |||
| wc.exe | |||
| wget.exe | wget 1.8.2 builds out of the box with MS Visual C | ||
| which.exe | does not search the current directory | ||
| whoami.exe | |||
| xargs.exe | |||
| yes.exe | |||
| zcat.exe | |||
| Additional programs | |||
| pclip.exe | put the Windows clipboard text to stdout | ||
| gclip.exe | get the Windows clipboard text from stdin Example: run the text from the clipboard through sed and put the result back pclip | sed "s/string1/string2/g" | gclip | ||
| gplay.exe | My minimalist console multimedia player using DirectShow. With gplay filename | URL you should be able to play just everything, as long as Microsoft supports it. |
CoreUtils: collection of basic file, shell and text manipulation utilities
Version: 5.3.0
The GNU Core Utilities are the basic file, shell and text manipulation utilities of the GNU operating system. These are the core utilities which are expected to exist on every operating system. The GNU Core Utilities 是 GNU 操作系统的基本文件、shell 和文本操作实用程序。这些是预期存在于每个操作系统上的核心实用程序。
File utilities:
Text utilities:
Shell utilities:
If you download the Setup program of the package, any requirements for running applications, such as dynamic link libraries (DLL's) from the dependencies as listed below under Requirements, are already included. If you download the package as Zip files, then you must download and install the dependencies zip file yourself. Developer files (header files and libraries) from other packages are however not included; so if you wish to develop your own applications, you must separately install the required packages.
| Description | Download | Size | Last change | Md5sum | ||||
|---|---|---|---|---|---|---|---|---|
| • Complete package, except sources | Setup | 6439882 | 21 April 2005 | 5a3e9d30b906dadf54de0635522fd62c | ||||
| • Sources | Setup | 3527755 | 21 April 2005 | 64b8f7c03895de29c6ee669c9092fe1b | ||||
| • Binaries | Zip | 5176996 | 21 April 2005 | aa7ce7f1f2befb930fb156bddea41bc4 | ||||
| • Dependencies | Zip | 706641 | 21 April 2005 | 6cf05855b6902dffa2cf4ba8b90e82e6 | ||||
| • Documentation | Zip | 4540924 | 21 April 2005 | ee0b456daf011d6e348cc64adafe968a | ||||
| • Sources | Zip | 9371720 | 21 April 2005 | 5cbd86c56e6eb29b6af2810849d08c8c |
You can also download the files from the GnuWin32 files page.
You can monitor new releases of the port of this package.
The MS-Windows version of ln implements soft links as MS-Windows shortcuts. If necessary, it adds the extension .lnk Hard links are implemented as copies on MS-Windows-95 / 98 / ME, and as hard linls on MS-Windows-NT / 2000 / XP.
Requirements for running applications, excluding external ones such as msvcrt.dll, perl, etc, are included in the Setup program and the dependencies zip file.
WHICH, TEE & CUT
很久以前(恐龙才刚刚灭绝)我管理了一个 1Mbps 30 用户 10Net 网络,该网络连接到 SUN 型号 3/60 工作站(或者只是 360?)用于 Internet 电子邮件。
因为我有时不得不进行备份,所以我想我也可以研究一些 Unix 的命令行实用程序。 那时我根本不喜欢这些实用程序的复杂语法,所以我很快就停止学习了。 不过,有 3 个实用程序我确实喜欢,并且发现它们确实非常有用:CUT、TEE 和 WHICH。 这就是为什么我首先将它们“移植”到 (OS/2) Rexx,然后移植到 NT 和 DOS batch 和 Perl,最近又移植到 KiXtart、PowerShell 和 VBScript(仅 WHICH)。
The Rexx and batch sources of these ports can be found here:
💾 Download sources for all UNIX ports
Git 是一个免费的开源的分布式版本控制系统,旨在快速高效地处理从小型项目到大型项目的所有内容。 Git易于学习, 体积小,性能快如闪电。它超越了 Subversion、CVS、Perforce 和 ClearCase 等 SCM 工具,具有廉价的本地分支、方便的临时区域和 多个工作流等特性。
https://www.git-scm.com/downloads https://www.git-scm.com/download/win https://github.com/git-for-windows/git/releases/download/v2.21.0.windows.1/Git-2.21.0-32-bit.exe https://github.com/git-for-windows/git/releases/download/v2.21.0.windows.1/Git-2.21.0-64-bit.exe https://github.com/git-for-windows/git/releases/download/v2.21.0.windows.1/PortableGit-2.21.0-32-bit.7z.exe https://github.com/git-for-windows/git/releases/download/v2.21.0.windows.1/PortableGit-2.21.0-64-bit.7z.exe
Cmder 是出于对 Windows 上缺少可用的控制台模拟器的纯粹失望而创建的软件包。它基于ConEmu并进行了重大配置修改,带有 Monokai 配色方案、惊人的clink (由clink-completions进一步增强)和自定义提示布局。
https://github.com/cmderdev/cmder/releases/download/v1.3.11/cmder_mini.zip https://github.com/cmderdev/cmder/releases/download/v1.3.11/cmder.zip
xcmder下进入Bash使用vim时方向键失灵问题解决Setting... -> Startup -> Command Line:%windir%\system32\bash.exe ~ -cur_console:p:ncmder设置默认打开目录Setting... -> Startup -> Tasks -> 2 {cmd::Cmder} :cmd /k "%ConEmuDir%\..\init.bat" -new_console:d:%USERPROFILE%\Desktop禁止自动更新127.0.0.1 conemu.github.io
https://eternallybored.org/misc/wget/releases/wget-1.20-win32.zip https://eternallybored.org/misc/wget/releases/old/wget-1.13-win32-static.zip
https://curl.haxx.se/download.html
https://curl.haxx.se/windows/ https://curl.haxx.se/windows/dl-7.64.0_1/curl-7.64.0_1-win32-mingw.zip https://curl.haxx.se/windows/dl-7.64.0_1/curl-7.64.0_1-win64-mingw.zip
https://curl.haxx.se/download/archeology/ https://curl.haxx.se/download/archeology/curl-7.33.0-win64-nossl.zip https://curl.haxx.se/download/archeology/curl-7.33.0-win64-ssl-sspi.zip
https://winampplugins.co.uk/curl/ https://winampplugins.co.uk/curl/curl_7_53_1_openssl_nghttp2_x86.7z https://winampplugins.co.uk/curl/curl_7_53_1_openssl_nghttp2_x64.7z
dos2unix / unix2dos - Text file format converters Convert text files with DOS or Mac line breaks to Unix line breaks and vice versa.
This is an update of Benjamin Lin's implementations of dos2unix and unix2dos. Benjamin Lin's implementations of dos2unix and unix2dos were distributed via SunSITE.unc.edu (later MetaLab.unc.edu, now ibiblio) and became part of several Linux distributions such as RedHat, Suse, Gentoo, and others. This update includes all RedHat patches and fixes several other problems. Internationalization has been added and ports to DOS, Windows, Cygwin and OS/2 Warp have been made.
These implementations of dos2unix and unix2dos have been modelled after dos2unix/unix2dos under SunOS/Solaris. The first versions were made by John Birchfield in 1989, and in 1995 rewritten from scratch by Benjamin Lin. Mac to Unix conversion was added by Bernd Johannes Wuebben in 1998, Unix to Mac conversion by Erwin Waterlander in 2010.
In 2010 the two separate dos2unix and unix2dos packages have been bundled into a single dos2unix package (version 5.0). Support for Unicode UTF-16 was added in 2012 (version 6.0). Version 7.0, in 2014, was a major code cleanup and added a test suite.
Latest version: 7.4.4-beta1 (2022-08-13)
Stable version: 7.4.3 (2022-06-05)
News: 2017-10-10: Version 7.4.0 New option --allow-chown to allow file ownership change in old file mode.
text file format converters
includes: dos2unix - DOS/Mac to Unix text file format converter (dos2unix/mac2unix) unix2dos - Unix to DOS/Mac text file format converter (unix2dos/unix2mac)
Source code dos2unix-7.4.3.tar.gz Source code, Unix text. dos2unix-7.4.3.tar.gz.asc PGP key. d2u743.zip Source code, DOS text.
Ready-to-run binaries
DOS
Windows
To recursively convert text files in a directory tree, use dos2unix in combination with the 'find' and 'xargs' commands. For instance to convert all .txt files under the current directory type:
find . -name '*.txt' |xargs dos2unix
Windows users can use the following command in a Windows Command Prompt:
for /R %G in (*.txt) do dos2unix "%G"
See also here for more information about the "for /R" command.
PowerShell users can use the following command in a Windows PowerShell:
get-childitem -path . -filter '*.txt' -recurse | foreach-object {dos2unix $_.Fullname}
Drag & drop file info
This batch script d2uinfo.bat can be copied to the Desktop. You can drag & drop files into it to get file information about number of line breaks, byte order mark, and text/binary. (Thanks to Alan S. Jones)
xxxxxxxxxx@ECHO OFFECHO.call dos2unix -ihp %*ECHO.pause
Unix to DOS text file format converter
Since version 5.0 (2010-02-16) is unix2dos included in the dos2unix package. The separate unix2dos package is now obsolete.
Here's netcat 1.11 compiled for both 32 and 64-bit Windows (but note that 64-bit version hasn't been tested much - use at your own risk).
I'm providing it here because I never seem to be able to find a working netcat download when I need it.
Small update: netcat 1.12 - adds -c command-line option to send CRLF line endings instead of just CR (eg. to talk to Exchange SMTP)
Warning: a bunch of antiviruses think that netcat (nc.exe) is harmful for some reason, and may block or delete the file when you try to download it. I could get around this by recompiling the binary every now and then (without doing any other changes at all, which should give you an idea about the level of protection these products offer), but I really can't be bothered.
Gawk: pattern scanning and processing language Version: 3.1.6 Several kinds of tasks occur repeatedly when working with text files. You might want to extract certain lines and discard the rest. Or you may need to make changes wherever certain patterns appear, but leave the rest of the file alone. Writing single-use programs for these tasks in languages such as C, C++ or Pascal is time-consuming and inconvenient. Such jobs are often easier with awk. The awk utility interprets a special-purpose programming language that makes it easy to handle simple data-reformatting jobs. The GNU implementation of awk is called gawk; it is fully compatible with the System V Release 4 version of awk. gawk is also compatible with the POSIX specification of the awk language. This means that all properly written awk programs should work with gawk. Thus, we usually don’t distinguish between gawk and other awk implementations. Using awk allows you to:
In addition, gawk provides facilities that make it easy to:
The Win32 port has some limitations, In particular the ‘|&’ operator and TCP/IP networking are not supported.
| Description | Download | Size | Last change | Md5sum | ||||
|---|---|---|---|---|---|---|---|---|
| • Complete package, except sources | Setup | 5219803 | 10 February 2008 | 1fdd86c1d73496817588f12a2a2e3a43 | ||||
| • Sources | Setup | 1835124 | 10 February 2008 | af227dfd10480e843d5232d131029c1f | ||||
| • Binaries | Zip | 1448542 | 10 February 2008 | f875bfac137f5d24b38dd9fdc9408b5a | ||||
| • Documentation | Zip | 4908800 | 29 December 2007 | 110365c9193c8e99033d50abde55aa02 | ||||
| • Sources | Zip | 3126204 | 10 February 2008 | 299f9fd976aded253a5a4610ca0f2b11 | ||||
| • Original source | http://ftp.gnu.org/gnu/gawk/gawk-3.1.6.tar.gz |
You can also download the files from the GnuWin32 files page. New releases of the port of this package can be monitored.
在windows下用法不太一样: echo 5060708 | awk -F "0" "{print $2,$3}" Linux: echo 5060708 | awk -F "0" '{print $2,$3}'
convert and copy a file
This version does not actually do any conversion but it allows the flexible copying of data under in a win32 environment. At the moment block devices under Win9x are not supported but that will be added soon.
Read more in the Wikipedia entry for dd
dd [bs=SIZE[SUFFIX]] [count=BLOCKS[SUFFIX]] if=FILE of=FILE [seek=BLOCKS[SUFFIX]] [skip=BLOCKS[SUFFIX]] [--size] [--list] [--progress]
bs is the block size. The block size can be specified in bytes or with one of the following suffix
| Description | Suffix | Size |
|---|---|---|
| Characters | c | 1 |
| Words | w | 2 |
| Double Words | d | 4 |
| Quad Words | q | 8 |
| Kilobytes | k | 1,024 |
| Megabytes | M | 1,048,576 |
| Gigabytes | G | 1,073,741,824 |
The default block size is 512 which will work for most files and devices but the copy will be a lot faster if you use a larger block size. For example a floppy disk read with bs=1k count=1440 takes almost twice as long than if you use bs=1440k count=1. Don't make the block size too large because windows will run out of memory. 1M is probably a good size and upper limit. Most CD/DVDs have a 2k sector size and probably will not work with a block size which is not a multiple of that.
skip is the distance to skip over the input file before reading is commenced. It is in blocks so the distance will be skip * blocksize. You can also use a suffix here so skip=1k will skip 1024 blocks. You can remember that skip relates to the input file by thinking of a 'skipping rope'.
seek is the distance to seek over in the output file before writing is commenced. It is also in blocks do the distance will be seek * blocksize. You can also use a suffix here so seek=1k will seek 1024 blocks. You just have to remember that if skip is for in then seek is for out.
count is the number of blocks to copy. If it is not specified then the dd will continue until the end of the file/device is reached. On many usb devices this is not reliable so you should use --size to guess the size of the device, see below. You can also use a suffix here so count=1k will copy 1024 blocks.
Traditionally when using dd, if you wanted to copy an entire device, you did not specify a block count and dd would read until it reached the end of the device. If you tried to read past the end of the device, the data up to the end of the device would be returned and if you kept reading you would get an error message. Windows however does not always do this so --size will tell dd to figure out the size of the device and make sure it does not read past that point. This is important for USB sticks which stop working if you read past the end of them. This is not on by default because getting the correct size of the device is not always possible. Some devices also keep returning bogus data past the end of the device without returning a suitable error code
Windows provides a number of ways to name a device. The --list will output the preferred names. Under NT4, only the \\?\Device\Harddisk<n>\Partition<n> method is available. Partition0 is the entire disk. Under Windows XP, some partitions may not have a Volume device. In this case you can still use the Harddisk<n>\Partition<n> name.
Windows 2000 and later have Volume devices which are unique GUIDs which identify a disk or partition (what MS call a Volume). These are listed along with any mount point that they may be mounted on. Most of the time this is a drive letter but it may be a path on another filesystem. If you want to read the underlying device, do not include the trailing \ character. If the volume is not mounted there is no easy way to identify it so be careful. Under XP SP2, many partitions can not be read directly, even if they are not in use. There is a work around which I call reading partitions via the back door.
Sample output
dd --list
xxxxxxxxxxrawwrite dd for windows version 0.4beta1.Written by John Newbigin <jn@it.swin.edu.au>This program is covered by the GPL. See copying.txt for detailsWin32 Available Volume Information\\.\Volume{5cd94d2c-3251-11d9-9444-806d6172696f}\link to \\?\Device\HarddiskVolume1fixed mediaMounted on \\.\c:\\.\Volume{129b1243-3252-11d9-b167-806d6172696f}\link to \\?\Device\CdRom0CD-ROMMounted on \\.\r:\\.\Volume{129b1242-3252-11d9-b167-806d6172696f}\link to \\?\Device\Floppy0removable mediaMounted on \\.\a:\\.\Volume{e3429891-0eb9-11da-b18f-000d60dc98cd}\link to \\?\Device\Harddisk1\DP(1)0-0+3removable mediaMounted on \\.\d:NT Block Device Objects\\?\Device\CdRom0\\?\Device\Floppy0\\?\Device\Harddisk0\Partition0link to \\?\Device\Harddisk0\DR0Fixed hard disk media. Block size = 512\\?\Device\Harddisk0\Partition1link to \\?\Device\HarddiskVolume1\\?\Device\Harddisk1\Partition0link to \\?\Device\Harddisk1\DR2Removable media other than floppy. Block size = 512\\?\Device\Harddisk1\Partition1link to \\?\Device\Harddisk1\DP(1)0-0+3Removable media other than floppy. Block size = 512Virtual devices/dev/zero/dev/random
--progress is an non-standard enhancement to dd which will show you progress as each block is copied.
Virtual devices are a new feature in version 0.4beta1.
Because windows does not have devices like the unix /dev/zero or /dev/random these have been implemented inside dd. You can use these as input files to supply an infinite amount of zeros or pseudo random data.
Standard Input (stdin) is now the default input file if you do not specify a value for if. You can also explictly use stdin with if=-. Standard Out (stdout) is now the default output file if you do not specify a value for of. You can also explictly use stdout with of=-. Progress and error messages are written to Standard Error (stderr). This allows the use of dd with pipe commands.
To prevent accidental overwriting of the wrong disk, a safety filter can be enforced. Available filters are:
| fixed | Only write to a fixed disk |
|---|---|
| removable | Only write to a removable disk |
| disk | Only write to any kind disk |
| partition | Only write to a partition |
You can enforce a filter by renaming dd.exe to dd-<filter>.exe. For example, dd-removable.exe can only write to removable disks like USB and CF, making sure that you don't accidently write to a fixed hard disk.
Make an image of a floppy disk:
dd if=\.\a: of=c:\temp\disk1.img bs=1440k
Write the image back to a floppy disk:
dd if=c:\temp\disk1.img of=\.\a: bs=1440k
Rip an .iso from a CD
dd if=\?\Device\CdRom0 of=c:\temp\disc1.iso bs=1M
Read a partition from a USB memory device
dd if=\.\Volume{c18588c0-02e9-11d8-853f-00902758442b} of=c:\temp\usb1.img bs=1M
Read the entire USB memory device
dd if=\?\Device\Harddisk1\Partition0 of=c:\temp\usb2.img bs=1M --size --progress
You can write to any file or block device which windows will allow you to write to. You can use the standard \\.\ notation for win32 exported devices or the dd specific \\?\ notation to access windows native devices.
Note: You can not write to a CD with this program. Get microsoft cdburn from the windows XP resource kit.
Note: Floppy disks are extremely unreliable. If you get errors, please try another floppy disk or reformatting the disk.
| Program | Version | Content | Format | Platform | Download |
|---|---|---|---|---|---|
| dd | 0.6beta3 | Binary | .zip | Windows | dd-0.6beta3.zip |
| dd | 0.6beta3 | Source | .zip | Delphi | dd-0.6beta3.src.zip |
| dd | 0.6beta1 | Source | .zip | Delphi | dd-0.6beta1.src.zip |
| dd | 0.5 | Binary | .zip | Windows | dd-0.5.zip |
| dd | 0.4beta4 | Binary | .zip | Windows | dd-0.4beta4.zip |
| dd | 0.4beta4 | Source | .zip | Delphi | dd-0.4beta4.src.zip |