5 more basic UNIX commands for troubleshooting for a Windows Guy

Recalling another blog this week, 5 CentOS commands for basic troubleshooting for a Windows guy, I had wanted to cover few more UNIX commands. These commands had come in handy recently and in the past.

1. w, for who is logged in to system? Simply type: w

Example of output:

USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT

root     pts/0    garzafx               14:05    0.00s  0.12s  0.00s w

Administering applications requiring UNIX user logons, this command had offered a quick view of the folks being displaced with service restarts or system restarts (i.e. Init 0,1,6 or reboot).

2. man, for help from the manual. If you had needed to get assistance on a command, simply remember, type man followed by what you are looking for! Syntax had followed this example;

man man or man ip a

Example of output:

[root@localhost ~]# man man

man(1)                                                                  man(1)

NAME

man – format and display the on-line manual pages

SYNOPSIS

man  [-acdfFhkKtwW]  [–path]  [-m system] [-p string] [-C config_file]

[-M pathlist] [-P pager] [-B browser] [-H htmlpager] [-S  section_list]

[section] name …

DESCRIPTION

man formats and displays the on-line manual pages.  If you specify sec-

tion, man only looks in that section of the manual.  name  is  normally

the  name of the manual page, which is typically the name of a command,

function, or file.  However, if name contains  a  slash  (/)  then  man

interprets  it  as a file specification, so that you can do man ./foo.5

or even man /cd/foo/bar.1.gz.

3. cp, for copying files. With UNIX configuration files of all sorts, this command had provided quick CYA measure worthy of mentioning. The syntax that UNIX had followed:

cp oldfile.txt newfile.txt

4. mv, for renaming files. Some applications had recreated configuration files on restart. Keeping it simple for this scenario, I had suggested a move in one command;

mv oldfile.txt newfile.txt

5. pf -ef | grep –I, for searching system wide. This command had required a lot of exposition maybe; however, in avoiding verbosity and any confusion, I had thought useful mentioning just the syntax. This piped command had come up multiple times in my travels from AIX to CentOS. Years ago, I had witnessed this command shopping for crash dump files (i.e. core files). The most recent occasion had occurred with hunting down NetworkManager service.

Example of output:

[root@localhost network-scripts]# ps -ef | grep -i network

root      1454     1  0 09:34 ?        00:00:00 NetworkManager –pidfile=/var/run/NetworkManager/NetworkManager.pid

If you had remembered other commands worth mentioning, chime in. Hopefully with your next system administrative crisis with UNIX gremlins, this post had provided some guide to navigating the waters of cli.

centos

Read More:

Download Centos 6.4 
CentOS (Wikipedia)

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)