If you want to know your IP address on bash on Windows, you can try ifconfig command, if you are using it for the first time you may get an error as below,
$ ifconfig
Command 'ifconfig' not found, but can be installed with:
apt install net-tools
You need to run the command apt install net-tools to install the net-tools before using the ifconfig command,
$ apt install net-tools
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
net-tools
0 upgraded, 1 newly installed, 0 to remove and 152 not upgraded.
Need to get 196 kB of archives.
After this operation, 864 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu focal/main amd64 net-tools
amd64 1.60+git20180626.aebd88e-1ubuntu1 [196 kB]
Fetched 196 kB in 0s (409 kB/s)
Selecting previously unselected package net-tools.
(Reading database ... 39269 files and directories currently installed.)
Preparing to unpack .../net-tools_1.60+git20180626.aebd88e-1ubuntu1_amd64.deb ...
Unpacking net-tools (1.60+git20180626.aebd88e-1ubuntu1) ...
Setting up net-tools (1.60+git20180626.aebd88e-1ubuntu1) ...
Processing triggers for man-db (2.9.1-1) ...
Now try running the command,
$ ifconfig
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 1500
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0xfe<compat,link,site,host>
loop (Local Loopback)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wifi0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.0.103 netmask 255.255.255.0 broadcast 192.168.0.255
inet6 feXX::5dXX:29XX:82XX:XXXX prefixlen 64 scopeid 0xXX<compat,link,site,host>
ether X8:Xa:fX:f3:X1:3X (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Try ifconfig -a to get more details,
Know your IP Address on Bash for Windows
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 1500
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0xfe<compat,link,site,host>
loop (Local Loopback)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wifi0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.0.103 netmask 255.255.255.0 broadcast 192.168.0.255
inet6 feXX::5dXX:29XX:82XX:XXXX prefixlen 64 scopeid 0xXX<compat,link,site,host>
ether X8:Xa:fX:f3:X1:3X (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wifi1: flags=64<RUNNING> mtu 1500
inet 169.254.241.198 netmask 255.255.0.0
inet6 feXX::5dXX:29XX:82XX:XXXX prefixlen 64 scopeid 0xXX<compat,link,site,host>
ether X8:Xa:fX:f3:X1:3X (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wifi2: flags=64<RUNNING> mtu 1500
inet 169.254.187.35 netmask 255.255.0.0
inet6 feXX::5dXX:29XX:82XX:XXXX prefixlen 64 scopeid 0xXX<compat,link,site,host>
ether X8:Xa:fX:f3:X1:3X (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
More Posts related to Bash,
- How to create new user account in Windows bash
- Command to Sort File In Reverse Order [Unix/Linux/macOS]
- 'pwd' is not recognized as an internal or external command, operable program or batch file. [Windows]
- How to Kill a port using bash terminal command?
- How to know the current shell you are logged in?
- Bash For Loop Example
- How to see Created Accessed Modified and Changed dates of a file using bash terminal command
- How to fix bash ping command not found error
- Know Bash shell version command
- Bash Hello World! Script Tutorial
- How to check your IP using bash for Windows?
- [Fix] bash: script.sh: /bin/bash^M: bad interpreter: No such file or directory
- Fix bash: script.sh: Permission denied Error
- Bash command to wait for seconds
- How to use Autocomplete and Autosuggestion in Shell Commands
- bash get year 2021 calendar
- bash: netstat: command not found
- How to Compare Strings in Bash
- How to start or open a new bourne-again shell (bash) session on Windows using Command Line CMD
More Posts:
- How to serialize-deserialize an object in java - Java
- Android Studio : Connection Error : Failed to download patch file - Android-Studio
- Java SE 8 Update 301 available with various bug fixes and security improvements - Java
- Java: Check Internet connection on Android Device (Wifi or Mobile) - Android
- How to enable line numbers in IntelliJ Android Studio for all files - Android-Studio
- Unhandled exception type InterruptedException : Java Threads - Java
- How to identify installed Java (JDK) Version on macOS - MacOS
- How to Generate Self-Signed OpenSSL certificate in three easy steps - HowTos