Linux Network Setup/Monitor commands

Posted on November 30, 2009. Filed under: Linux | Tags: , , , , |

1. check devices status:

lspci  (dmidecode, lsusb, lshw , lspci)

reference: http://ubuntuforums.org/showthread.php?t=320995

2.  Check the network status:

mii-tool  (you should be root)

ip link

References:

http://www.linuxforums.org/forum/redhat-fedora-linux-help/129167-how-detect-hardware-add-new-one.html

3. NIC card change sequence:

nameif

(hwinfo)

/lib/udev/rename_netiface <old> <new>

References:

http://www.centos.org/modules/newbb/viewtopic.php?topic_id=10434

http://www.cyberciti.biz/faq/rhel-fedora-centos-howto-swap-ethernet-aliases/

http://www.linuxforums.org/forum/suse-linux-help/92280-how-change-ethx-ethy.html

4. iftop

a good console bandwidth visualization tool that shows you active
connections, where they are going to/from and how much of your precious bandwidth
they are using.

iftop is a command-line system monitor tool that produces a frequently-updated list of network connections. By default, the connections are ordered by bandwidth usage, with only the “top” bandwidth consumers shown.

Reference:

http://en.wikipedia.org/wiki/Iftop

5. iptraf

IPTraf is a console-based network statistics utility for Linux. It gathers a variety of figures such as TCP connection packet and byte counts, interface statistics and activity indicators, TCP/UDP traffic breakdowns, and LAN station packet and byte counts.

http://iptraf.seul.org/

Advertisements
Read Full Post | Make a Comment ( 1 so far )

Useful linux commands: null,zero,full,lsof

Posted on November 1, 2009. Filed under: Linux | Tags: , , , |

Linux / Unix Command: null

NAME

null, zero – data sink

DESCRIPTION

Data written on a null or zero special file is discarded.

Reads from the null special file always return end of file, whereas reads from zero always return characters.

null and zero are typically created by:

mknod -m 666 /dev/null c 1 3
mknod -m 666 /dev/zero c 1 5
chown root:mem /dev/null /dev/zero
chmod 666 /dev/null /dev/zero

References:

http://linux.about.com/library/cmd/blcmdl4_null.htm

DESCRIPTION
File /dev/full has major device number 1 and minor device number 7.

Writes  to  the  /dev/full device will fail with an ENOSPC error.  This
can be used to test how a program handles disk-full errors.

Reads from the /dev/full device will return characters.

Seeks on /dev/full will always succeed.

CONFIGURING
If your system does not have /dev/full created already, it can be  cre-
ated with the following commands:

mknod -m 666 /dev/full c 1 7
chown root:root /dev/full

Reference:

man full

lsof

lsof is a command meaning “list open files”, which is used in many Unix-like systems to report a list of all open files and the processes that opened them. This open source utility was developed and supported by Vic Abell, the retired Associate Director of the Purdue University Computing Center. It works in and supports several UNIX flavors.[2]

Open files in the system include disk files, pipes, network sockets and devices opened by all processes. One use for this command is when a disk cannot be unmounted because (unspecified) files are in use. The listing of open files can be consulted (suitably filtered if necessary) to identify the process that is using the files.

# lsof /var
COMMAND     PID     USER   FD   TYPE DEVICE SIZE/OFF     NODE NAME
syslogd     350     root    5w  VREG  222,5        0 440818 /var/adm/messages
syslogd     350     root    6w  VREG  222,5   339098   6248 /var/log/syslog
cron        353     root  cwd   VDIR  222,5      512 254550 /var -- atjobs

To view the Port associated with a daemon :

 # lsof -i -n -P | grep sendmail
 sendmail  31649    root    4u  IPv4 521738       TCP *:25 (LISTEN)

From the above we can see that “sendmail” is listening on its standard port of “25”.

  • -i Lists IP sockets.
  • -n Do not resolve hostnames (no DNS).
  • -P Do not resolve port names (list port number instead of its name).

Reference:

http://en.wikipedia.org/wiki/Lsof

man lsof

Read Full Post | Make a Comment ( None so far )

Useful Linux commands: Screen, ttyload, mytop, mtop

Posted on October 23, 2009. Filed under: Linux, MySQL, Shell | Tags: , , , , , |

1. Screen

Screen is a full-screen window manager that multiplexes a physical terminal between several processes (typically interactive shells). The same way tabbed browsing revolutionized the web experience, GNU Screen can do the same for your experience in the command line. Instead of opening up several terminal instances on your desktop or using those ugly GNOME/KDE-based tabs, Screen can do it better and simpler. Not only that, with GNU Screen, you can share sessions with others and detach/attach terminal sessions. It is a great tool for people who have to share working environments between work and home

References:

http://www.cyberciti.biz/tips/how-to-use-screen-command-under-linux.html

http://linux.die.net/man/1/screen

http://en.wikipedia.org/wiki/GNU_Screen

2. ttyload

ttyload is a little *NIX utility I wrote which is meant to give a color-coded graph of load averages over time.

Reference:

http://www.daveltd.com/src/util/ttyload/

3. mtop/mkill

mtop (MySQL top) monitors a MySQL server showing the queries which are taking the most amount of time to complete. Features include ‘zooming’ in on a process to show the complete query, ‘explaining’ the query optimizer information for a query and ‘killing’ queries. In addition, server performance statistics, configuration information, and tuning tips are provided.

mkill (MySQL kill) monitors a MySQL server for long running queries and kills them after a specified time interval. Queries can be selected based on regexes on the user, host, command, database, state and query.

Reference:

http://mtop.sourceforge.net/

http://astguiclient.sourceforge.net/vicidial.html

http://www.voip-info.org/wiki/view/VICIDIAL+Dialer

4. mytop

mytop is a console-based (non-gui) tool for monitoring the threads and overall performance of a MySQL 3.22.x, 3.23.x, and 4.x server. It runs on most Unix systems (including Mac OS X) which have Perl, DBI, and Term::ReadKey installed. And with Term::ANSIColor installed you even get color.

Reference:

http://jeremy.zawodny.com/mysql/mytop/

Read Full Post | Make a Comment ( None so far )

Liked it here?
Why not try sites on the blogroll...