Add line numbers to everything!
Use nl to add line numbers to every output of your commands. Useful for to explain a configuration file. Examples:
$ nl httpd.conf
$ nl httpd.con | less
Scan ports without nmap
Next time you’re on linux and don’t have nmap available, use this simple trick to scan ports:
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.
Calculating Gateway and Subnet Mask
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:
Pelican to generate static content Octopress, now I’m using octopress. Is a lot easier to setup and write. NearlyFreeSpeech.NET keep it cheap (see their pricing summary). If everything goes as expected this site should be up for a loooooong time. VirtualBox to have my dev environment on my Windows machine but running linux on the host Ubuntu Minimal to keep my VM lighting fast and boot it in 5 seconds :o)
- Markdown to keep writing simple and be able to migrate whenever I want.(To give you an example I’ve made this site on Pelican, Octopress and now Tumblr with minimal editing)
- And finally Tumblr, I found it easier to mantain and faster to publish, can follow others and it also supports Markdown.
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 :)