unix commands @ garzafx.com

5 CentOS commands for basic troubleshooting for a Windows guy

Recently in configuring a third party application on CentOS, I had made some interesting notes in troubleshooting an issue on Unix. Before starting, I had understood navigating around some general commands like LS, LS –L, PWD, TOP on Solaris 9.x, ESX 5.x and Ubuntu 12.x. with a touch of VI. The work this week had helped transpose some logic in search of my CentOS Gremlin.

1. List running services at boot: chkconfig –list

In Microsoft Windows, many IT folks had launched msconfig or the registry to get a quick rundown of suspects to knife during boot. To get a list of those in CentOS, that command had been:

chkconfig –list

This command had generated a print screen of services being off or on. In my case, I had needed to stop a service.

2. Stop a service at boot: chkconfig service (on/off)

In Windows, some people had leveraged the GUI with the snap-in services.msc, unchecked a box in msconfig, or set value to 0 in the registry. Here the handy command had followed this syntax: chkconfig service on or chkconfig service off.

Example:

chkconfig NetworkManager off

NOTE: This disables network configuration service for desktops

or

chkconfig iptables off

NOTE: This disables the firewall

3. List running network configuration: ip a

In the M$ world, developers had made this accessible via the run command: ncpl.cpa or ipconfig /all. On the CentOS platform, to get a quick rundown of network interfaces, I had entered the following command:

ip a

Example:

[root@localhost network-scripts]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
link/ether 00:19:b9:b6:90:06 brd ff:ff:ff:ff:ff:ff
inet 172.24.1.10/24 brd 172.24.1.255 scope global eth0
inet6 fe80::219:b9ff:feb6:9006/64 scope link
valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc mq state DOWN qlen 1000
link/ether 00:19:b9:b6:90:08 brd ff:ff:ff:ff:ff:ff
4: eth1.0100@eth1: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc noqueue state DOWN
link/ether 00:19:b9:b6:90:08 brd ff:ff:ff:ff:ff:ff

4. Print the routing table: netstat –rn

Sometimes in Windows, it had been important to understand the default gateway and destination for all traffic. In my case the last line entry had a misconfigured gateway.

Example:

[root@localhost network-scripts]# netstat –rn
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
172.24.1.0    0.0.0.0         255.255.255.0   U         0 0          0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 eth1
0.0.0.0         172.24.1.10    0.0.0.0         UG        0 0          0 eth0

5. Restarting a service: service ServiceName (stop/start/restart)

In my adventure, I had three different services requiring some manual control (i.e. NetworkManager, MySQL, network). The one exception with a different name had a different service name, MySQL with MySQLD.

Example:

service network restart

Shutting down loopback interface:                          [  OK  ]

Bringing up loopback interface:                            [  OK  ]

Bringing up interface eth0:                                [  OK  ]

Bringing up interface eth1:                                [  OK  ]

So with those commands in hand and some editing of some network configuration files, I had fixed the issue preventing an application from completing initialization. Hopefully, some of this explanation had illuminated possibilities on a starting point for working with CentOS. The more light one had saught, the less Gremlins you’ll see.

centos

Read More:

Download Centos 6.4 
CentOS (Wikipedia)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s