Home > Software design >  No `ifconfig` or `ip` command on Git Bash on Windows distro
No `ifconfig` or `ip` command on Git Bash on Windows distro

Time:09-16

I am trying to learn how to script in bash using shell commands (using Git Bash installed on Windows). I noticed that the tutorial I am going through used ifconfig, which is a deprecated and thus I tried using the ip addr config as noted in the following:

https://unix.stackexchange.com/questions/145447/ifconfig-command-not-found

However, this command is also not available in Git Bash. I tried to sudo apt and install the commands, but this doesn't work in Git Bash. However, I also noticed that the Windows cmd ipconfig is inherited in Git Bash, and I am able to view some of the information (not all the information I want on different encryptions, as well as in a different format than ifconfig would give). However, I want to run the following command:

ifconfig wlp2s0

In order to get the appropriate output for wireless networks. Is there a way to install packages within Git Bash such that I may use the ip addr command, or is there a way to get equivalent information using the ipconfig command inherited from Windows command line into Git Bash?

CodePudding user response:

Git, including Git for Windows, has several commands that use various Unix commands, including a POSIX shell and a standard set of POSIX utilities. For these reasons, Git for Windows includes these utilities as part of its distribution and provides Git Bash so users can use a more-or-less POSIX-like environment on Windows.

However, Git Bash isn't and isn't intended to be a full Linux distro or Unix system. It contains a variety of limitations based on the fact that its programs are Windows programs, and it won't ship many of the utilities that one would expect on a normal Unix system. This is by design, since adding a lot of utilities would add a great deal of maintenance cost but very few people would use them. This is even true for programs which are very popular on Unix systems, such as the shell zsh.

If you want to run a Linux distro on your Windows system, there is the Windows Subsystem for Linux. WSL 1 emulates the Linux kernel in Windows, and WSL 2 actually uses a Linux kernel under a virtual machine. Since you seem to be using an environment that uses APT, you probably want either to use either Debian or Ubuntu as your distro in WSL. You could also use a virtual machine or install a distro on part or all of your hard drive. However, Git Bash isn't going to provide all of the commands you're looking for.

  • Related