Day 39: Cigwyn, Mintty, and Windows

In trying to better understand how to configure my shell I tried to understand what is the Git Bash shell made of. I googled a bunch of stuff and I’m still confused but I am started to understand how it works. The Git Prompt features are kind of like a tack on to a terminal emulator an GNU compiler for windows all running together on a Windows system. I could be wrong but it’s a step forward from being completely clueless lol.

TLDR;

Okay, so here are the highlights of what I did:

  • I looked into how to customize a mintty terminal window since it seemed like my git-prompt configurations were not taking effect. Once I turned off the theme my git-prompt config file changes started to apply. I’m still a little confused about why but I’m sure I’ll eventually understand the hierarchy and execution order for all these config files.
  • I learned a bit about how this nifty terminal I’m using on Windows works. Tbh, I couldn’t imagine my current work process without it. It feels great.

Notes on Git Bash and how it works.


I am currently working on a PC running Windows 10. That being said I found Git Bash and fell in love with the terminal that came with. After looking into how to configure my terminal I learned a bit about the Git Bash terminal since it is not the same as the bash shell or any other shell that are run on Linux operating system. My system is not as simple which is good and bad. I still don’t fully understand everything that is going on under the hood but I’m going to write down what I have learned so far and try to fill things in as I learn more.

Useful Config File Locations

  • bashrc file in the /etc directory
  • git-prompt config file is in the /etc/profile.d/git-prompt.sh directory
  • DIR_COLORS file is located in the /etc directory as well.

Terms

  • Cygwin is… think of it as an OS. It provides a POSIX C runtime built on top of Windows so you can compile most Unix software to run on top of it. It comes with GCC, and to some extent, you can call the Win32 API from within Cygwin, although I’m not sure that is meant to happen or work at all.
  • Mintty is a free and open source terminal emulator for Cygwin, the Unix-like environment for Windows. It features a native Windows user interface and does not require a display server; its terminal emulation is aimed to be compatible with xterm. Mintty is based on the terminal emulation and Windows frontend parts of PuTTY, but improves on them in a number of ways, particularly regarding xterm compatibility. It is written in C. The POSIX API provided by Cygwin is used to communicate with processes running within mintty, while its user interface is implemented using the Windows API. The program icon comes from KDE’s Konsole.
  • PuTTY is a free and open-source terminal emulator, serial console and network file transfer application. It supports several network protocols, including SCP, SSH, Telnet, rlogin, and raw socket connection. It can also connect to a serial port. The name “PuTTY” has no official meaning. PuTTY was originally written for Microsoft Windows, but it has been ported to various other operating systems. Official ports are available for some Unix-like platforms, with work-in-progress ports to Classic Mac OS and macOS, and unofficial ports have been contributed to platforms such as Symbian, Windows Mobile and Windows Phone.

PuTTY was written and is maintained primarily by Simon Tatham, a British programmer.

  • MinGW(-w64) is a native Windows port of the GCC compiler, including Win32 API headers and libs. It contains a tiny POSIX compatibility layer (through e.g. winpthreads, the unistd.h headers and some other bits), but you cannot compile POSIX software with this. This is best compared to MSVC, which also produces native code using the Win32 API.
  • MSYS(2) is a fork of Cygwin which has path translation magic to make native Windows programs work nicely with it. Its main goal is to provide a shell so you can run autotools configure scripts. You are not meant to build MSYS applications at all. Note that MSYS2 strives for much more and contains a full-blown package management system so you can easily install MinGW-w64 libraries and tools.

Conclusion

That’s all for today. If you are interested in the MIT course you can check out the video lecture I’m currently going through. The lecture is helpful but isn’t sufficient by itself. Anyways, until next time PEACE!