options

Uname command with examples

Uname command in Linux

1. uname command

The uname command prints information about the system. uname is a portmanteau word made up from "unix" and "name". uname can be called from the command line in Linux as,

uname [OPTION]...

The most common way to use uname is with the -a option, which stands for "all" the information.… Read more

Sort command in Linux

1.0 Sort

The sort command is for sorting lines in text files. For example, if we have a file names, we can sort it with the sort command,

$ cat names
John Doe
Jane Doe
John Roe
Richard Roe
Tommy Atkins
Max Mustermann
Erika Mustermann
Joe Bloggs
$
$ sort names
Erika Mustermann
Jane Doe
Joe Bloggs
John Doe
John Roe
Max Mustermann
Richard Roe
Tommy Atkins

The words in the input lines are fields, which are numbered 1 onwards.… Read more

htop command in Linux

1.0 INTRODUCTION

htop is a ncurses based program for viewing processes in a system running Linux. htop is quite similar to the top command. However, since htop is a newer program compared to top, it offers many improvements. htop supports mouse operation, uses color in its output and gives visual indications about processor, memory and swap usage.… Read more

logrotate

Linux daemons write log files. Left to itself, these log files would grow with time and take up the disk space. It is necessary to purge the log files periodically so that the disk space is conserved and is available for smooth running of the system.… Read more

iostat

The iostat command is for getting the CPU and input-output devices' statistics for Linux and Unix systems. For example,

$ iostat
Linux 3.0.0-14-generic (hostname) 	Wednesday 06 June 2012 	_i686_	(2 CPU)  

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
          17.38    0.13    3.13    1.63    0.00   77.74

Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
sda              11.78       111.65        69.79   11663838    7290650

The above output has two reports, the CPU utilization report and the device utilization report.… Read more

vmstat

The vmstat command prints the system virtual memory statistics for Linux and Unix systems. vmstat prints information about system processes, memory, swap, I/O blocks, interrupts and context switches and the CPU activity. The most common command format is,

vmstat [delay [count]]

The optional delay parameter tells the time interval between periodic vmstat outputs.… Read more

uptime and w commands in Linux

The uptime and w commands in Linux and Unix systems give pointed information about the system uptime, load average and about logged in users.

uptime

The uptime command is given as,

uptime

And the output is like,

07:47:08 up 25 days, 17:54, 1 user, load average: 0.03, 0.09, 0.08

In the above output, 07:47:08 is the timestamp at the time the command was given.… Read more

Finding the free and used memory with the free command

Using the free command, the free and used memory in a Linux or Unix system can be found. The free command can be given from the command line as,

free

And the system responds with an output like,

             total    used     free  shared  buffers  cached
Mem:        960268  873136    87132       0    14652  168884
-/+ buffers/cache:  689600   270668
Swap:      2996116   95332  2900784

In the above output, the system has 960,268 kilobytes of total memory, which is less than the actual physical memory because the memory occupied by the kernel is not reported here.… Read more

top command

top Command in Linux

The Unix top command is useful for monitoring systems continuously for processes that take more system resources like the CPU time and the memory. top periodically updates the display showing the high resource consuming processes at the top. top is an excellent aid in checking a system.… Read more

ps command usage examples in Linux

The ps command gives information about processes on a Linux or Unix system. Our programs run as processes in the system. Also, for each installed package, there might be one or more processes. So, to find out what is happening in the system, the first instinctive action is to find out about processes running in the system by using the ps command.… Read more