Posts Tagged ‘process’

netstat (network statistics) is a command-line tool that displays network connections (both incoming and outgoing), routing tables, and a number of network interface statistics. It is available on Unix, Unix-like, and Windows NT-based operating systems.
It is used for finding problems in the network and to determine the amount of traffic on the network as a performance measurement. [wikipedia.com]

Parameters used with netstat command are:

netstat /? Output

In case you want to kill a process without knowing its name and the only information you’ve got is a port number; there’s no need to worry about it. Here are the six simple steps in KILLING A PROCESS BASED ON A SPECIFIC PORT NUMBER.

1. Go to RUN and type cmd
2. Use netstat -aon | find ":port number" command to view a specific network port if it is in use or not. 
3. Go to Task Manager (Alt+Ctrl+Del)
4. Select Processes Tab
5. Check PID on view menu
6. Kill the process base on PID

If you want to change a port number, you may edit services file located on C:\WINDOWS\system32\drivers\etc

Nice numbers (NI) alter the CPU priority and are used to balance the CPU  load in a multiuser environment. Each process is started with a default nice number of 0. Nice numbers range from 19 [lowest] to -20 [highest].

All processes start with a default nice number of zero. Only the root user can decrease the nice number of a process. nice is used to modify a process that is not running while renice is uses to modify a process that is already running.

syntax:
nice -n # process &
e.g.: nice -n 15 xclock &

Syntax:
renice -n # -p PID
e.g: renice -n 15 -p 1620

When running a computer system, several process are executed. As a System Administrator of your own computer, you have to manage the processes running on your system. Processes have to be monitored so as to check the health and use of system resources. If you are running Linux, I created a summary on creating, monitoring, and killing a process. A process is actually an executable running in the computer’s memory. Each process has an assigned unique number known as Process ID(PID).  PID’s may be up to 32757. PID’s 0 and 1 are reserved for the kernel, the heart of the Operating System and the init, the mother of all processes.

PROCESS MONITORING
ps: displays a a snap shot of the current processes in the working directory.
ps uxa: displays a snapshot of all the current  running processes.

pstree: displays a snapshot of the genealogy of processes.

top: displays all current running processes in real time.

CREATING A PROCESS
executable file: run the executable
e.g.: usr/sbin/httpd – run the httpd process

KILLING A PROCESS
kill -9 PID: terminate the process through a kenrel call
kill -15 PID: terminate a process nicely

FIELD NAMES IN PROCESS MONITORING
USER –  The user who started the process
PID – The process ID
%CPU –  Shows the cputime / realtime percentage.
%MEM – The fraction of RSS divided by the total size of RAM
VSZ – Size of virtual memory used by the process
RSS – Resident set size (Data & Text segments only) in Kb
TTY – The TTY associated with this process
STAT – The current status
TIME – CPU time in MINS:SECS
COMMAND –  The full command line used to start the process

I also included additional commands in controlling a process. to run a process in the background use & command.
e.g.: xclock &
output: [JOB_ID] PID

jobs: Lists all commands stopped, or running in the background
jobs -l: Lists PID
fg JOB_ID: force a suspended or background process to continue running in the foreground
bg JOB_ID: force a suspended process to continue running in the background