Imagine you have found login to a server shell floating in the wild 馃槢 or just a server handed down from management to deploy something as a solution that they just don’t have an idea. Now before all that hours of meetings and unproductive conversations. You did get a chance to look into the server and check its guts through a text window (shell). Here are some commands that you might use to see what its capable of before suggesting what you slap on it or a thousand clones like it.
I will be giving examples which are relevant to the scenario, no showing off how much command switches I can remember. Just use man command if you want to be a sucker for it.
What Os you are working with. Now although all shell command kind of work with every OS except the ones specific to getting info about the OS itself.
Ubuntu / Debian
lsb_release -a
CentOs / Redhat
cat /etc/redhat-release
This command will let you know the information about what OS your are logged into along with version information. After this its pretty much same for everything.
1. free
This command lets you see how much memory it has the switch after it just changes the units you would like to see.
There would always be some calculation differences in G and M bytes for calculation so don’t go finding your 1G of RAM.
2. df
This would let you see how the space in your defined filesystem is distributed under different mount points. -h just lets us read it in an concise and quick form.
df -h
3. lspci
lspci
This command would list all PCI devices that came up or registered by bios and can be recognized by the OS. Basically its a bunch of lines with type and manufacturer information. In the example barbecue its a VM (virtual machine) a lot of info is emulated. But you get the idea.
4. lscpu
lscpu
This list the CPU identification information, make model, cores and other stuff that you would not read or need if you are reading this post. But you would get a general idea of clock speed and cores, and instruction set.
5. lsblk
lsblk
Here comes the storage. df tells you how its divided. this tells you what you are using. This will let you know what kind of devices you are spinning (god I am getting old. Still think storage spins. ). Basically tells you information about actual disks if directly attached to system or OS can see them along with any partitions created on it. Else you might see devices exposed to OS by your HBA or raid card or storage adapter, whatever gives you peace.
6. dd
dd if=/dev/zero of=1 bs=4K count=1000000
Now some of you folks think I have lost it. using dd here is like under estimating its capability, but we are using this clever command to check read write speeds of the filesystem. Again this is just one use case else dd itself needs an article. Above command will create a file 1 from a device with a sequence of zeros with byte-size of 4K a million times totaling to 4GB, and this in turn will calculate the write speeds of your filesystem. If you reverse the command and dump everything from file 1 to /dev/null an infinite capacity device. You will get sequential read speed for the server.
dd if=1 of=/dev/null bs=4K count=1000000
7. ioping
You may have to install an additional repository to run this command like epel-release in CentOS/Redhat to install it. but it can be easily done by running commands given below.
yum install epel-release -y && yum install ioping -y
ioping /
Initially developed by someone at Google. This command gives you a ping time for your storage device. Just like we have network latency measures in ms(milliseconds). This one just stays in the system and never cross the 7 layers of network. But indeed goes from your CPU to storage and back.
At this point you know what needs to be known for a linux server physically and what it is capable of. It will help you decide what kind of workloads you can run on it. Now there is a major component of network and throughput that you may have to consider but that varies so much as just link speeds of adapter do not tell you anything about real world performance.