Linux Commands for System Administration – Part 1

Linux System Administration involves procedures and tasks that are required to keep a computer system up and running and in usable order. Usually, it includes :

  • installing new programs
  • creating / deleting user accounts
  • ensuring file system is not corrupted
  • taking backups and restoring the backup when required
  • monitor system resources, users, status of critical processes and file system usage
  • starting and stopping the system
  • configuring run levels, boot process, init, etc.

Let us take a look at the tasks and commands that are generally used by the system administrators.

  • Monitoring the system

In order to check the health of a Linux machine, we can us commands such as :

  1. w   – this command shows which users are logged on
  2. uptime – shows how long the system has been running
  3. iostat – shows CPU statistics

  • Process Management

The top command displays the status of the processes, their resource usage, etc. Apart from that,  commands like “ps -auxw”  and “pstree” will give detailed information about the processes running.  Also, the “kill” command can be used to stop a specific process using its PID (process id – which is a unique number associated with each process).

top command :

pstree command :

“ps -auxw” command :

“ps -ef” command :

  • Monitoring Memory Usage

There are many commands used for monitoring the memory usage. Following are the frequently used ones.

  1. vmstat – used for monitoring virtual memory
  2. free – displays the amount of free and used memory in the system
  3. pmap – examines the memory map and libraries
  4. sar – System Activity Report – used to collect, report & save CPU, Memory, I/O usage

Examples :

  • Monitoring the File System

The file system has to be monitored to see whether the diskspace has reached the maximum allocated size, file system corruption, etc. Some of the useful commands to monitor file system are :

  • “df -k”          – to find out the disk space usage
  • “du -sh”        – to calculate file space for a given directory
  • “mount”       –  displays all mounted devices

These commands can be used with many other options. A detailed list of options regarding how to use these commands can be obtained from the man pages of these commands.

Examples :

  • Displaying System Information

The Linux system information can be displayed using “uname -a” command. Another command is “dmesg”, which shows the kernel ring buffers. These messages contain valuable information about device drivers loaded into the kernel at the time of booting as well as when we connect a hardware to the system on the fly.

Examples :

 

 

 

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top