System, Network & Disk management Linux commands you should know to manage your web server

System, Network and Disk Management in Linux
This entry is part 4 of 8 in the series Network Admin in SSH

System, Network and Disk Management in LinuxWe have already completed our discussion on connecting to our Web Server using SSH. I’d recommend you to follow the last tutorial, where you will create your own pair of keys to login through SSH tunnel. After you login, you are given a standard Linux terminal, using which you can do, more than just a few things, to manage various aspects of your server. To do that, you’ll need to get yourself familiar with a few commands.

So, in the upcoming posts on this series, we shall discuss various Linux shell commands for everyday use. In this post, we are going to see a few useful system, network and disk management commands.

#1: System related Linux Terminal commands:

#1.1: View system information at once:- uname

To get the current server system information at a glimpse, we use uname command. It can print information on kernel name, version, release, network node name, machine, processor, operating system etc. It comes handy to check which Linux distribution you are using. To print the OS information, we use:

uname -o

The distribution information is embedded inside the kernel version, so we can use

uname -v

Or, we can print all the information using

uname -a

A sample output would be:

Linux swashata-itg 3.2.0-24-generic #39-Ubuntu SMP Mon May 21 16:52:17 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

#1.2: View Logged in user and their activities:- w

You might want to check if someone else is logged in and her activities if she is. Along with this, the w command also prints a header which shows the current time, how long the system has been running, how many users are currently logged on, and the system load averages for the past 1, 5, 15 minutes.


Sample output would be:

 12:22:08 up  1:15,  2 users,  load average: 0.79, 0.72, 0.84
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
swashata pts/0    :0               11:07    1:14m  0.00s  0.85s kdeinit4: kded4 [kdeinit]
swashata pts/2    :0               12:10    0.00s  0.20s  0.00s w

#1.3: Check the uptime of the system:- uptime

If you quickly want to check the header information given by the w command, then you can use the uptime command instead. It will just print the current time, how long the system is running and the load averages.


The output would be

 12:25:33 up  1:18,  2 users,  load average: 0.98, 0.79, 0.84

#1.4: Check the proc filesystem directly:- /proc

/proc is a virtual filesystem created and managed by the kernel itself, where it stores and retrieves hardware information. You can do a list inside the filesystem to see what kind of information are available.

ls /proc

and you will find a something similar like this.

Sample output of listing Proc
Sample output of listing Proc
ls /proc

Each of the files holds information on the corresponding hardware. For example, if you want to check the hardware information available with your cpu, you can do so, using:

cat /proc/cpuinfo


For memory:

cat /proc/meminfo

For current hard disk partitions:

cat /proc/partitions

and so on.

#2: Disk management Linux Command:

For managing disk over the server, we are concerned mainly with two things:

  • File system Disk space usage (for available partitions).
  • File space on current directory.

#2.1: Checking overall partition file system usage:- df

Reports file system disk space usage. In other words, it shows all the mounted devices, where they are mounted, how much space they have and much is being used. The best option is to run it with -h for a proper human readable output.

df -h

A sample output would be:

swashata@swashata-itg:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       233G   33G  189G  15% /
udev            3.9G   12K  3.9G   1% /dev
tmpfs           1.6G 1000K  1.6G   1% /run
none            5.0M     0  5.0M   0% /run/lock
none            3.9G  328K  3.9G   1% /run/shm
/dev/sda3        93G  8.9G   80G  10% /media/Developments

#2.2: Checking directory wise file space:- du

If you wish to check the space used by directories residing inside the current directory, then you can use du command.


It will list all directories and their space usage. A sample output might be:

76      /home/swashata/localhost/public_html/wp/wp-content/plugins/wp_admrs/static/admin/css/images
132     /home/swashata/localhost/public_html/wp/wp-content/plugins/wp_admrs/static/admin/css
152     /home/swashata/localhost/public_html/wp/wp-content/plugins/wp_admrs/static/admin/images
36      /home/swashata/localhost/public_html/wp/wp-content/plugins/wp_admrs/static/admin/js
324     /home/swashata/localhost/public_html/wp/wp-content/plugins/wp_admrs/static/admin
4       /home/swashata/localhost/public_html/wp/wp-content/plugins/wp_admrs/static/front/css
4       /home/swashata/localhost/public_html/wp/wp-content/plugins/wp_admrs/static/front/images
4       /home/swashata/localhost/public_html/wp/wp-content/plugins/wp_admrs/static/front/js
16      /home/swashata/localhost/public_html/wp/wp-content/plugins/wp_admrs/static/front
344     /home/swashata/localhost/public_html/wp/wp-content/plugins/wp_admrs/static
264     /home/swashata/localhost/public_html/wp/wp-content/plugins/wp_admrs/classes
8       /home/swashata/localhost/public_html/wp/wp-content/plugins/wp_admrs/includes
636     /home/swashata/localhost/public_html/wp/wp-content/plugins/wp_admrs
8       /home/swashata/localhost/public_html/wp/wp-content/plugins/wp-category-posts-list/static/admin/js
16      /home/swashata/localhost/public_html/wp/wp-content/plugins/wp-category-posts-list/static/admin
96      /home/swashata/localhost/public_html/wp/wp-content/plugins/wp-category-posts-list/static/css/images
124     /home/swashata/localhost/public_html/wp/wp-content/plugins/wp-category-posts-list/static/css
144     /home/swashata/localhost/public_html/wp/wp-content/plugins/wp-category-posts-list/static
92      /home/swashata/localhost/public_html/wp/wp-content/plugins/wp-category-posts-list/classes
64      /home/swashata/localhost/public_html/wp/wp-content/plugins/wp-category-posts-list/includes
4       /home/swashata/localhost/public_html/wp/wp-content/plugins/wp-category-posts-list/translations
712     /home/swashata/localhost/public_html/wp/wp-content/plugins/wp-category-posts-list
12832   /home/swashata/localhost/public_html/wp/wp-content/plugins
4       /home/swashata/localhost/public_html/wp/wp-content/upgrade
132040  /home/swashata/localhost/public_html/wp/wp-content
160520  /home/swashata/localhost/public_html/wp

Now to make this output understandable, we can use similar options:

For human readable format:

du -h path/to/dir

Check the total usage:

du -hc path/to/dir

Check the summary:

du -hs path/to/dir

#3: Network Management Linux Commands:

When talking about remote servers, most of the network management are taken care by the hosting company itself. Yet, you would like to know the current status of the network or the hardware configuration.

#3.1: Check the status:- netstat

The netstat command is very handy on doing a few useful things:

  • Checking active network connections and ports associated.
  • Checking kernel routing table.
  • Checking network interfaces.

and much more. Simply executing the command would display a list of open sockets (In simpler words combination of IP and port, using which some connections are being made to or from your server). Here are some useful options:

Check the TCP statistics:

netstat -st

Check all protocol statistics:

netstat -s

Display kernel Routing table:

netstat -r

Display kernel routing table only with IP address:

netstat -rn

Show the program id/name to which an open socket belongs:

netstat -p

Show the program with open socket and TCP protocol:

netstat -tp

Show programs with inet protocol having active connection:

netstat --inet -p

Above with detailed IP address:

netstat --inet -np

Above with every second update:

netstat --inet -npc

Press Ctrl+C to exit.

#3.2: Check the interface configuration:- ifconfig

If you want to check the interface configuration (ethernet, wireless, loopback etc), then you can:


and it will show the hardware MAC address, inet address, mask etc for all available interfaces.


That was all about the commands you will need to manage the said aspects of your Linux server. Hope it was useful for you. You can anytime do a man <command_name> to get more information on that command. For example, if you want to know more about ifconfig, then you can

man ifconfig

and it will come up with a detailed manual page with several examples and description.

That’ll be all for today. If you have any problem or doubt, please ask us in the comments.