System Administration, for Linux

DeveloperSide.NET Articles

Procedure for checking System

Check the environment.

...]# set

Show logged in users and what they are doing.

...]# w

Report process status -- make sure all needed processes are running (ex: apache, mysql, ssh).

...]# ps -auxf

Display used/free system memory.

...]# free -m

Display used/free disk memory.

...]# df -h

Display network interface information -- make sure your interfaces are up and running.

...]# ifconfig

Show network connections -- check the ports your system is listening on and the programs behind those ports.

...]# netstat -ape

View logged activity.

...]# less /var/log/secure

View logged activity.

...]# less /var/log/messages

Show listing of last logged in users.

...]# last

Show log of login activity by user name.

...]# lastlog

List loaded modules.

...]# lsmod

Services

chkconfig is a tool for maintaining the /etc/rc[0-6].d directory hierarchy by relieving system administrators of the task of directly manipulating the numerous symbolic links in those directories.

List all of the services which chkconfig knows about.

...]# chkconfig --list

Turn services OFF or ON, under the specified System Run-Levels.

...]# chkconfig --level 0123456 service off/on

Control a Service.

...]# service service-name start/stop/reload

Processes

List running processes with their pids, under a hierarchical structure.

...]# ps -auxf

Kill a process.

...]# kill pid

Really kill a process, if previous kill is unsuccessful.

...]# kill -s 9 pid

Changing Hostname

Edit /etc/sysconfig/network, and re-login into the shell

Display new hostname.

...]# hostname

Note that the prompt will now display the host: [user@www dir]#

Update local host aliases

Edit /etc/hosts...

Format is: IP <tab> www.your.domain <tab> alias

For localhost: 127.0.0.1 <tab> localhost.localdomain <tab> localhost

Add an extra IP address

...]# cd /etc/sysconfig/network-scripts/ /etc/sysconfig/network-scripts]# cp ifcfg-eth0 ifcfg-eth0:1

Edit ifcfg-eth0:1...

Bind IP address.

...]# ifup eth0:1

Put NIC into Promiscuous Mode

Promiscuous mode allows your NIC to read ALL the data that is sent over the wire, and not just the data destined for your IP.

...]# ifconfig eth0 promisc

To remove promiscuous mode...

...]# ifconfig eth0 -promisc

View Process info and Network connections

System info

Display Bootup messages: ...]# dmesg

Display System information: ...]# uname -a

Linux www.domain.com 2.4.20-19.7 #1 Tue Jul 15 13:44:14 EDT 2003 i686 unknown

File Ownership

Change file owner and group: ...]# chown owner:group file

Change dir/file owner and group recursively: ...]# chown -R owner:group dir

Red Hat Network up2date, command line

Note:

Register with the Red Hat Network

...]# rhn_register --nox

Change up2date options

...]# up2date --configure

Update the update program

...]# up2date --nox up2date

Show available relevant updated packages

...]# up2date --nox -l

Update system with all relevant packages

...]# up2date --nox -u

Install or Update package

...]#up2date --nox package_name