So you inherit a box running linux and you have no idea which flavor of linux it is. How do you find out?

If all you need the kernel version you can try
uname -a

This outputs something like this

Linux localhost.localdomain 2.4.20-31.9 #1 Tue Apr 13 18:04:23 EDT 2004 i686 i686 i386 GNU/Linux

If you need the actual distro name you can try
cat /etc/*release

In Ubuntu it shows up as

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=9.04
DISTRIB_CODENAME=jaunty
DISTRIB_DESCRIPTION=”Ubuntu 9.04″

Or even
cat /etc/issue

which spits out the following on Ubuntu

Ubuntu 9.04 \n \l

You can combine all three to get the following
uname -a && cat /etc/*release && cat /etc/issue

Update:
Another one to add to the list
cat /proc/version

 

The lsof command can display all open files in Linux. With some filtering you can use it to show all open/utilized ports as well.

lsof -i TCP:443
This command will list all processes, their pids, and user under which the process is running, that are utilizing port 443.

To list all TCP ports, one could use
lsof -i TCP

Type lsof –help for more options.

© 2012 !NSFW Suffusion theme by Sayontan Sinha