Use nl to add line numbers to every output of your commands. Useful for to explain a configuration file. Examples:
$ nl httpd.conf
or
$ nl httpd.con | less
Next time you’re on linux and don’t have nmap available, use this simple trick to scan ports:
$ /dev/tmp/[IP]/[Port]
A Connection refused message means the port is closed. No output means the port is open.
Create a script that runs this from 1 to 65535 and have all the ports scanned on a specific IP.
Remember the $ at the beginning is the shell prompt, no need to type it.
This is a really simplified guide about calculating gateway and subnet mask from an IP and subnet, these are usually represented like this: 192.168.1.15/26
I assume you already know binary and to perform logical operations (AND, OR, etc.), if you don’t you should learn that first.
The first thing is to understand that the /26 gives us the subnet mask itself. And the second thing that we need to know is that an IP is composed by 32 bits, which can be divided in 4 octets. To calculate the subnet mask you need to write down the bits with 1 from left to right and fill out the rest with 0. An IP contains 32 bits.
/26 = 26 bits = _11111111.11111111.11111111.11_000000 = 255.255.255.192
To calculate the gateway just perform and AND operation between the IP and the subnet mask.
IP = 192.168.1.15 = 11000000.10101000.00000001.00001111
AND Subnet Mask = 255.255.255.192 = 11111111.11111111.11111111.11000000
Result = 11000000.10101000.00000001.00000000
Gateway = 192.168.1.0
This may look hard or not be clear at first. Keep practicing. It’s really useful if you want to be a SysAdmin.
You could also use a subnet calculator too, but where is the fun in that?
Had to make some edits. Looks like the Android app for tumblr doesn’t play well with Markdown. I’ll have to look for an alternative later.
I’m trying to get back to writing. Now I’m doing this in english to improve my english ninja skills. In order to keep this simple, fast and cheap I’m using the following:
And that’s it. Eventually I’ll come here and write stuff I learn, and who knows, maybe I’ll write something in spanish just to honor my roots :)
Adios!