Been poking around for a bit trying to find a straight answer but VScode keeps giving me grief when checking the syntax and the alias doesn’t seem to work.
I often switch between networks with devices that aren’t easily discoverable and their IP addresses often change. I’ve found myself using
nmap to quickly scan the network devices for the ports I’m looking for (e.g.
22 open ssh when working with a pi).
qmap11='nmap -sn 192.168.1.1/24' qmap21='nmap -sn 192.168.2.1/24' qmap31='nmap -sn 192.168.3.1/24'
As you can imagine this isn’t the cleanest way to do this, and I want to run something like the following
$ qmap 3 # to run nmap -sn 192.168.3.1/24
$ qmap ip # to run something like nmap -sn [whatever subnet I'm on] # so I don't have to first check what the network is
I’ve been tinkering with building a function… but want to figure this out first.
Alias with variable in bash
Linux bash script to extract IP address
Which terminal command to get just IP address and nothing else?
How to detect the OS from a Bash script?
Make a Bash alias that takes a parameter?
Theser other posts definitely hint at what I’m tryingn to figure out.