Using Windows as Linux

I have always used Windows as if it were Linux. After installing Windows 10, I first install the Windows version of Git. The Windows version of Git comes with a MinGW environment, which pre-installs some commonly used Linux tools.Using Windows as LinuxThe MinGW in the Windows version of Git is a trimmed version, lacking a package management tool, making it impossible to update software.Fortunately, most commonly used Linux tools have Windows versions. After collecting some commonly used tools, I place them in the /c/bin directory and add them to the PATH variable, effectively creating a personalized Linux “distribution”.Using Windows as LinuxSome tools are extracted from MinGW, while others are rewritten in Python and packaged as EXE files. There are also some whose origins I can’t remember, downloaded from various GitHub projects.For example, the tool duu.exe adds some file count statistics and can display directory sizes in various units, providing more information than the native du command:Using Windows as Linux

bash$ duu -husage: duu.exe [-h] [-b] [-e] [-q] [-s STATUS] [-n] [-N] [-f] [-S]               [-H]               [-T THREADS] [-x EXCLUDE] [-X REGEXPR] [-o OUTPUT]               [dname]
Display directory disk usage in kilobytes, plus totals
Directory Usage Utility (duu), version: 2.22

From the help documentation, it can be seen that it also supports multithreading, which should speed up file counting. Unfortunately, I don’t know where I found it; I will trace it back on GitHub later.ip_notes is a tool I wrote myself, used to manage IP notes.Using Windows as LinuxIt stores the IP information of some servers and terminals locally for easy querying.Using Windows as Linuxip_notes project address:

https://github.com/hyang0/ip_notes

rustscan is a port scanning tool known for its speed, commonly used for security checks.

https://github.com/RustScan/RustScan

Using Windows as LinuxThe remaining tools, tree, wget, and rsync, were collected from the MinGW project and are not available in the native Git Bash.On Windows, character encoding issues often arise. For example, commands like ipconfig, ping, and tasklist output garbled text in Git Bash.Using Windows as LinuxMy approach is to use iconv for encoding conversion:

bash$ type iiconviiconv is aliased to `iconv -f GBK -t UTF-8'bash$ type ipconfigipconfig is aliased to `ipconfig|iiconv'

By using command aliases, the actual execution of ipconfig is:

ipconfig | iconv -f GBK -t UTF-8

Using Windows as LinuxWhen encountering garbled text, using iconv for encoding conversion resolves the issue.To open Windows directories in Git Bash, you can use the Windows command explorer. For example, to open the D:\2025 directory, you can do the following:Using Windows as LinuxFirst, navigate to the corresponding directory using cd, then use explorer . to open it.That’s all for today. Later, I will package the tools I have collected and upload them to the cloud drive.The end.

Leave a Comment