Wednesday, March 26, 2014

INTERNAL AND EXTERNAL ,PS COMMANDS



PROCESS:
A process is defined as a program in Execution.Each of the process have a unique identification number alloted by a kernal.

INTERNAL AND EXTERNAL COMMANDS:

The classification of command depending on whether they generate seperate process or not upon the running.

Commands that generate seperate processes upon the running are called external command.
Eg: cat,who

Command that do not generate new process
when they are running are called internal commands.
Eg: mkdir,rm,cd


7.6 The ps Command





The ps (i.e., process status) command is used to provide information about the currently running processes, including their process identification numbers (PIDs).


The basic syntax of ps is
ps [options]
guest-9e48Yv@uglab:~$ ps

\ PID TTY TIME CMD

28601 pts/3 00:00:00 bash
28652 pts/3 00:00:00 ps

The four items are labeled PID, TTY, TIME and CMD. TIME is the amount of CPU (central processing unit) time in minutes and seconds that the process has been running. CMD is the name of the command that launched the process.
TTY is the name of the console or terminal that the user logged into.
PID: Process Identification Number
The -a option tells ps to list the processes of all users on the system rather than just those of the current user

guest-9e48Yv@uglab:~$ ps -a
PID TTY TIME CMD
28653 pts/3 00:00:00 ps

The -f option generates a listing that contains fewer items of information for each process

guest-9e48Yv@uglab:~$ ps -f
UID PID PPID C STIME TTY TIME CMD
116 28601 28410 0 15:24 pts/3 00:00:00 bash
116 28654 28601 0 15:25 pts/3 00:00:00 ps -f


The -e option generates a list of information about every process currently running

guest-9e48Yv@uglab:~$ ps -e
PID TTY TIME CMD
27747 ? 00:00:00 gnome-session
27795 ? 00:00:00 dbus-launch
27796 ? 00:00:00 dbus-daemon
27806 ? 00:00:00 at-spi-bus-laun
27810 ? 00:00:00 dbus-daemon
27813 ? 00:00:00 at-spi2-registr
27826 ? 00:00:00 dconf-service
27838 ? 00:00:00 gconfd-2
27863 ? 00:00:00 gnome-settings-
27872 ? 00:00:00 pulseaudio
27878 ? 00:00:00 gvfsd
27886 ? 00:00:15 compiz
27900 ? 00:00:00 nm-applet
27901 ? 00:00:00 gnome-fallback-
27902 ? 00:00:00 polkit-gnome-au
27903 ? 00:00:01 nautilus
27916 ? 00:00:00 gvfs-udisks2-vo
27928 ? 00:00:00 gvfs-gphoto2-vo
27932 ? 00:00:00 gvfs-mtp-volume
27938 ? 00:00:00 gvfs-afc-volume
27944 ? 00:00:00 gvfsd-trash
27951 ? 00:00:00 bamfdaemon
27956 ? 00:00:00 sh
27957 ? 00:00:00 gtk-window-deco
27961 ? 00:00:00 unity-panel-ser
27963 ? 00:00:00 hud-service
27983 ? 00:00:00 indicator-messa
27985 ? 00:00:00 indicator-sound
27987 ? 00:00:00 indicator-sessi
27989 ? 00:00:00 indicator-print
27998 ? 00:00:00 indicator-appli
28000 ? 00:00:00 indicator-datet
28001 ? 00:00:00 indicator-bluet
28002 ? 00:00:00 indicator-sync-
28038 ? 00:00:00 evolution-sourc
28045 ? 00:00:00 gvfsd-burn
28061 ? 00:00:00 unity-applicati
28063 ? 00:00:00 unity-files-dae
28065 ? 00:00:00 unity-lens-frie
28068 ? 00:00:00 unity-music-dae
28076 ? 00:00:00 unity-lens-phot
28078 ? 00:00:00 unity-shopping-
28080 ? 00:00:00 unity-video-len
28119 ? 00:00:00 zeitgeist-daemo
28135 ? 00:00:00 zeitgeist-fts
28137 ? 00:00:00 zeitgeist-datah
28139 ? 00:00:00 cat
28142 ? 00:00:00 sh
28154 ? 00:00:00 pxgsettings
28160 ? 00:00:00 sh
28161 ? 00:00:00 pxgsettings
28166 ? 00:00:22 firefox
28171 ? 00:00:00 unity-scope-gdr
28173 ? 00:00:00 unity-scope-vid
28175 ? 00:00:00 unity-musicstor
28205 ? 00:00:00 sh
28207 ? 00:00:00 pxgsettings
28214 ? 00:00:00 unity-webapps-s
28244 ? 00:00:00 telepathy-indic
28250 ? 00:00:00 mission-control
28259 ? 00:00:00 gnome-screensav
28286 ? 00:00:00 deja-dup-monito
28325 ? 00:00:00 geoclue-master
28329 ? 00:00:00 ubuntu-geoip-pr
28332 ? 00:00:00 sh
28333 ? 00:00:00 pxgsettings
28370 ? 00:00:00 gvfsd-http
28388 ? 00:00:00 sh
28390 ? 00:00:00 pxgsettings
28401 ? 00:00:00 gedit
28410 ? 00:00:00 gnome-terminal
28416 pts/2 00:00:00 bash
28468 ? 00:00:00 oosplash
28524 ? 00:00:12 soffice.bin
28601 pts/3 00:00:00 bash
28656 pts/3 00:00:00 ps


The -u option tells ps to provide detailed information about each process.

guest-dZiUbS@uglab-OptiPlex-3010:~$ ps -u



USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND

136 2468 0.0 0.2 23260 4500 pts/0 Ss 16:19 0:00 bash

136 2855 0.0 0.0 18160 1236 pts/0 R+ 16:29 0:00 ps -u

 

 

-t option Select all processes associated with this terminal. Identical


guest-dZiUbS@uglab-OptiPlex-3010:~$ ps -t

PID TTY STAT TIME COMMAND

2468 pts/0 Ss 0:00 bash

2902 pts/0 R+ 0:00 ps -t 





No comments:

Post a Comment