Archive for the tag 'processes'

SBDavid

Peeking at the processes

Peeking at the processes

This example uses two parameters, the -e parameter, which shows all of the processes running on the system, and the -f parameter, which expands the output to show a few useful columns of information:

UID: The user responsible for launching the process
PID: The process ID of the process
PPID: The PID of the parent process (if a process is started by another process)
C: Processor utilization over the lifetime of the process
STIME: The system time when the process started
TTY: The terminal device from which the process was launched

root@dell:/etc# ps -ef |less |head -n 1
UID PID PPID C STIME TTY TIME CMD
root@dell:/etc# ps -ef |less |grep -i terminal
jyothis 3889 3271 0 08:49 ? 00:00:07 xfce4-terminal
root 4261 3996 0 09:42 pts/0 00:00:00 grep -i terminal

TIME: The cumulative CPU time required to run the process
CMD: The name of the program that was started

SBDavid

/etc/inittab parent of all processes

Init is the parent of all processes. Its primary role is to create processes from a script stored in the file /etc/inittab.

Some Linux implementations contain a table of processes to start automatically on bootup. On Linux systems this table is usually located in the special file /etc/inittab.

The Linux operating system uses an init system that utilizes run levels. A run level can be used to
direct the init process to run only certain types of processes, as defined in the /etc/inittab file. There are five init run levels in the Linux operating system.

At run level 1, only the basic system processes are started, along with one console terminal process. This is called single user mode. Single user mode is most often used for emergency filesystem maintenance when something is broken. Obviously, in this mode only one person (usually the
administrator) can log in to the system to manipulate data.

# /etc/init.d executes the S and K scripts upon change
# of runlevel.
#
# Runlevel 0 is halt.
# Runlevel 1 is single-user.
# Runlevels 2-5 are multi-user.
# Runlevel 6 is reboot.
SBDavid

How to sort the selected processes

Here are the different keywords that may be used to control the output format (e.g. with option -o) or to sort the selected processes with the GNU-style –sort option.

For example:

ps -eo pid,user,args –sort user

This version of ps tries to recognize most of the keywords used in other implementations of ps. The following user-defined format specifiers may contain spaces: args, cmd, comm, command, fname, ucmd, ucomm, lstart, bsdstart, start.

fuser - identify processes using files or sockets

In order to look up processes using TCP and UDP sockets, the corresponding name space has to be selected with the -n option. By default fuser will look in both IPv6 and IPv4 sock-ets. To change the default, behavior, use the -4 and -6 options. The socket(s) can be specified by the local and remote port, and the remote address. All fields are optional, but commas in front of missing fields must be present:

[lcl_port][,[rmt_host][,[rmt_port]]]

Either symbolic or numeric values can be used for IP addresses and port numbers.

fuser outputs only the PIDs to stdout, everything else is sent to stderr.

root@dell:~# fuser -nv tcp 25
USER PID ACCESS COMMAND
25/tcp: root 3926 F…. master

FILES

/proc location of the proc file system

EXAMPLES

fuser -km /home kills all processes accessing the file system /home in any way.

if fuser -s /dev/ttyS1; then :; else something; fi invokes something if no other process
is using /dev/ttyS1.

fuser telnet/tcp shows all processes at the (local) TELNET port.

How to track which site is using the apache processes.

For apache 1.3, edit your /etc/httpd/conf/httpd.conf and add

ExtendedStatus On
<Location /httpd-status>
SetHandler server-status
</Location>

just after the code that says “ServerSignature On”. Save, exit, then restart apache. You can access the stats page by going to http://192.168.1.1/httpd-status where 192.168.1.1 is your server’s IP.

If you’re running apache 2.x with custombuild, then it’s already in the file:

/etc/httpd/conf/extra/httpd-info.conf

Change the “Allow from” lines to include your IP, or remove the line completely to allow from all.

Source : http://directadmin.com/

« Prev - Next »