Debian Codegraph @

HTML/procref1.html

raw symbols SCIP
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <HTML
3 ><HEAD
4 ><TITLE
5 >/proc</TITLE
6 ><META
7 NAME="GENERATOR"
8 CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
9 "><LINK
10 REL="HOME"
11 TITLE="Advanced Bash-Scripting Guide"
12 HREF="index.html"><LINK
13 REL="UP"
14 TITLE="/dev and /proc"
15 HREF="devproc.html"><LINK
16 REL="PREVIOUS"
17 TITLE="/dev and /proc"
18 HREF="devproc.html"><LINK
19 REL="NEXT"
20 TITLE="Network Programming"
21 HREF="networkprogramming.html"><META
22 HTTP-EQUIV="Content-Style-Type"
23 CONTENT="text/css"><LINK
24 REL="stylesheet"
25 HREF="common/kde-common.css"
26 TYPE="text/css"><META
27 HTTP-EQUIV="Content-Type"
28 CONTENT="text/html; charset=iso-8859-1"><META
29 HTTP-EQUIV="Content-Language"
30 CONTENT="en"><LINK
31 REL="stylesheet"
32 HREF="common/kde-localised.css"
33 TYPE="text/css"
34 TITLE="KDE-English"><LINK
35 REL="stylesheet"
36 HREF="common/kde-default.css"
37 TYPE="text/css"
38 TITLE="KDE-Default"></HEAD
39 ><BODY
40 CLASS="SECT1"
41 BGCOLOR="#FFFFFF"
42 TEXT="#000000"
43 LINK="#AA0000"
44 VLINK="#AA0055"
45 ALINK="#AA0000"
46 STYLE="font-family: sans-serif;"
47 ><DIV
48 CLASS="NAVHEADER"
49 ><TABLE
50 SUMMARY="Header navigation table"
51 WIDTH="100%"
52 BORDER="0"
53 CELLPADDING="0"
54 CELLSPACING="0"
55 ><TR
56 ><TH
57 COLSPAN="3"
58 ALIGN="center"
59 >Advanced Bash-Scripting Guide: An in-depth exploration of the art of shell scripting</TH
60 ></TR
61 ><TR
62 ><TD
63 WIDTH="10%"
64 ALIGN="left"
65 VALIGN="bottom"
66 ><A
67 HREF="devproc.html"
68 ACCESSKEY="P"
69 >Prev</A
70 ></TD
71 ><TD
72 WIDTH="80%"
73 ALIGN="center"
74 VALIGN="bottom"
75 >Chapter 29. <TT
76 CLASS="FILENAME"
77 >/dev</TT
78 > and <TT
79 CLASS="FILENAME"
80 >/proc</TT
81 ></TD
82 ><TD
83 WIDTH="10%"
84 ALIGN="right"
85 VALIGN="bottom"
86 ><A
87 HREF="networkprogramming.html"
88 ACCESSKEY="N"
89 >Next</A
90 ></TD
91 ></TR
92 ></TABLE
93 ><HR
94 ALIGN="LEFT"
95 WIDTH="100%"></DIV
96 ><DIV
97 CLASS="SECT1"
98 ><H1
99 CLASS="SECT1"
100 ><A
101 NAME="PROCREF1"
102 ></A
103 >29.2. <TT
104 CLASS="FILENAME"
105 >/proc</TT
106 ></H1
107 ><P
108 ><A
109 NAME="PROCREF2"
110 ></A
111 ></P
112 ><P
113 >The <TT
114 CLASS="FILENAME"
115 >/proc</TT
116 > directory
117 is actually a pseudo-filesystem. The files in <TT
118 CLASS="FILENAME"
119 >/proc</TT
120 > mirror currently running
121 system and kernel <A
122 HREF="special-chars.html#PROCESSREF"
123 >processes</A
124 >
125 and contain information and statistics about them.</P
126 ><P
127 > <TABLE
128 BORDER="0"
129 BGCOLOR="#E0E0E0"
130 WIDTH="100%"
131 ><TR
132 ><TD
133 ><PRE
134 CLASS="SCREEN"
135 > <TT
136 CLASS="PROMPT"
137 >bash$ </TT
138 ><TT
139 CLASS="USERINPUT"
140 ><B
141 >cat /proc/devices</B
142 ></TT
143 >
144 <TT
145 CLASS="COMPUTEROUTPUT"
146 >Character devices:
147 1 mem
148 2 pty
149 3 ttyp
150 4 ttyS
151 5 cua
152 7 vcs
153 10 misc
154 14 sound
155 29 fb
156 36 netlink
157 128 ptm
158 136 pts
159 162 raw
160 254 pcmcia
161
162 Block devices:
163 1 ramdisk
164 2 fd
165 3 ide0
166 9 md</TT
167 >
168
169
170
171 <TT
172 CLASS="PROMPT"
173 >bash$ </TT
174 ><TT
175 CLASS="USERINPUT"
176 ><B
177 >cat /proc/interrupts</B
178 ></TT
179 >
180 <TT
181 CLASS="COMPUTEROUTPUT"
182 > CPU0
183 0: 84505 XT-PIC timer
184 1: 3375 XT-PIC keyboard
185 2: 0 XT-PIC cascade
186 5: 1 XT-PIC soundblaster
187 8: 1 XT-PIC rtc
188 12: 4231 XT-PIC PS/2 Mouse
189 14: 109373 XT-PIC ide0
190 NMI: 0
191 ERR: 0</TT
192 >
193
194
195 <TT
196 CLASS="PROMPT"
197 >bash$ </TT
198 ><TT
199 CLASS="USERINPUT"
200 ><B
201 >cat /proc/partitions</B
202 ></TT
203 >
204 <TT
205 CLASS="COMPUTEROUTPUT"
206 >major minor #blocks name rio rmerge rsect ruse wio wmerge wsect wuse running use aveq
207
208 3 0 3007872 hda 4472 22260 114520 94240 3551 18703 50384 549710 0 111550 644030
209 3 1 52416 hda1 27 395 844 960 4 2 14 180 0 800 1140
210 3 2 1 hda2 0 0 0 0 0 0 0 0 0 0 0
211 3 4 165280 hda4 10 0 20 210 0 0 0 0 0 210 210
212 ...</TT
213 >
214
215
216
217 <TT
218 CLASS="PROMPT"
219 >bash$ </TT
220 ><TT
221 CLASS="USERINPUT"
222 ><B
223 >cat /proc/loadavg</B
224 ></TT
225 >
226 <TT
227 CLASS="COMPUTEROUTPUT"
228 >0.13 0.42 0.27 2/44 1119</TT
229 >
230
231
232
233 <TT
234 CLASS="PROMPT"
235 >bash$ </TT
236 ><TT
237 CLASS="USERINPUT"
238 ><B
239 >cat /proc/apm</B
240 ></TT
241 >
242 <TT
243 CLASS="COMPUTEROUTPUT"
244 >1.16 1.2 0x03 0x01 0xff 0x80 -1% -1 ?</TT
245 >
246
247
248
249 <TT
250 CLASS="PROMPT"
251 >bash$ </TT
252 ><TT
253 CLASS="USERINPUT"
254 ><B
255 >cat /proc/acpi/battery/BAT0/info</B
256 ></TT
257 >
258 <TT
259 CLASS="COMPUTEROUTPUT"
260 >present: yes
261 design capacity: 43200 mWh
262 last full capacity: 36640 mWh
263 battery technology: rechargeable
264 design voltage: 10800 mV
265 design capacity warning: 1832 mWh
266 design capacity low: 200 mWh
267 capacity granularity 1: 1 mWh
268 capacity granularity 2: 1 mWh
269 model number: IBM-02K6897
270 serial number: 1133
271 battery type: LION
272 OEM info: Panasonic</TT
273 >
274
275
276
277 <TT
278 CLASS="PROMPT"
279 >bash$ </TT
280 ><TT
281 CLASS="USERINPUT"
282 ><B
283 >fgrep Mem /proc/meminfo</B
284 ></TT
285 >
286 <TT
287 CLASS="COMPUTEROUTPUT"
288 >MemTotal: 515216 kB
289 MemFree: 266248 kB</TT
290 >
291 </PRE
292 ></TD
293 ></TR
294 ></TABLE
295 >
296 </P
297 ><P
298 >Shell scripts may extract data from certain of the files in
299 <TT
300 CLASS="FILENAME"
301 >/proc</TT
302 >.
303
304 <A
305 NAME="AEN19180"
306 HREF="#FTN.AEN19180"
307 >[1]</A
308 ></P
309 ><P
310 ><TABLE
311 BORDER="0"
312 BGCOLOR="#E0E0E0"
313 WIDTH="100%"
314 ><TR
315 ><TD
316 ><PRE
317 CLASS="PROGRAMLISTING"
318 > 1&nbsp;FS=iso # ISO filesystem support in kernel?
319 2&nbsp;
320 3&nbsp;grep $FS /proc/filesystems # iso9660</PRE
321 ></TD
322 ></TR
323 ></TABLE
324 ></P
325 ><P
326 ><TABLE
327 BORDER="0"
328 BGCOLOR="#E0E0E0"
329 WIDTH="100%"
330 ><TR
331 ><TD
332 ><PRE
333 CLASS="PROGRAMLISTING"
334 > 1&nbsp;kernel_version=$( awk '{ print $3 }' /proc/version )</PRE
335 ></TD
336 ></TR
337 ></TABLE
338 ></P
339 ><P
340 ><TABLE
341 BORDER="0"
342 BGCOLOR="#E0E0E0"
343 WIDTH="100%"
344 ><TR
345 ><TD
346 ><PRE
347 CLASS="PROGRAMLISTING"
348 > 1&nbsp;CPU=$( awk '/model name/ {print $5}' &#60; /proc/cpuinfo )
349 2&nbsp;
350 3&nbsp;if [ "$CPU" = "Pentium(R)" ]
351 4&nbsp;then
352 5&nbsp; run_some_commands
353 6&nbsp; ...
354 7&nbsp;else
355 8&nbsp; run_other_commands
356 9&nbsp; ...
357 10&nbsp;fi
358 11&nbsp;
359 12&nbsp;
360 13&nbsp;
361 14&nbsp;cpu_speed=$( fgrep "cpu MHz" /proc/cpuinfo | awk '{print $4}' )
362 15&nbsp;# Current operating speed (in MHz) of the cpu on your machine.
363 16&nbsp;# On a laptop this may vary, depending on use of battery
364 17&nbsp;#+ or AC power.</PRE
365 ></TD
366 ></TR
367 ></TABLE
368 ></P
369 ><P
370 ><TABLE
371 BORDER="0"
372 BGCOLOR="#E0E0E0"
373 WIDTH="100%"
374 ><TR
375 ><TD
376 ><PRE
377 CLASS="PROGRAMLISTING"
378 > 1&nbsp;#!/bin/bash
379 2&nbsp;# get-commandline.sh
380 3&nbsp;# Get the command-line parameters of a process.
381 4&nbsp;
382 5&nbsp;OPTION=cmdline
383 6&nbsp;
384 7&nbsp;# Identify PID.
385 8&nbsp;pid=$( echo $(pidof "$1") | awk '{ print $1 }' )
386 9&nbsp;# Get only first ^^^^^^^^^^^^^^^^^^ of multiple instances.
387 10&nbsp;
388 11&nbsp;echo
389 12&nbsp;echo "Process ID of (first instance of) "$1" = $pid"
390 13&nbsp;echo -n "Command-line arguments: "
391 14&nbsp;cat /proc/"$pid"/"$OPTION" | xargs -0 echo
392 15&nbsp;# Formats output: ^^^^^^^^^^^^^^^
393 16&nbsp;# (Thanks, Han Holl, for the fixup!)
394 17&nbsp;
395 18&nbsp;echo; echo
396 19&nbsp;
397 20&nbsp;
398 21&nbsp;# For example:
399 22&nbsp;# sh get-commandline.sh xterm</PRE
400 ></TD
401 ></TR
402 ></TABLE
403 ></P
404 ><P
405 >+</P
406 ><P
407 ><TABLE
408 BORDER="0"
409 BGCOLOR="#E0E0E0"
410 WIDTH="100%"
411 ><TR
412 ><TD
413 ><PRE
414 CLASS="PROGRAMLISTING"
415 > 1&nbsp;devfile="/proc/bus/usb/devices"
416 2&nbsp;text="Spd"
417 3&nbsp;USB1="Spd=12"
418 4&nbsp;USB2="Spd=480"
419 5&nbsp;
420 6&nbsp;
421 7&nbsp;bus_speed=$(fgrep -m 1 "$text" $devfile | awk '{print $9}')
422 8&nbsp;# ^^^^ Stop after first match.
423 9&nbsp;
424 10&nbsp;if [ "$bus_speed" = "$USB1" ]
425 11&nbsp;then
426 12&nbsp; echo "USB 1.1 port found."
427 13&nbsp; # Do something appropriate for USB 1.1.
428 14&nbsp;fi</PRE
429 ></TD
430 ></TR
431 ></TABLE
432 ></P
433 ><DIV
434 CLASS="NOTE"
435 ><TABLE
436 CLASS="NOTE"
437 WIDTH="100%"
438 BORDER="0"
439 ><TR
440 ><TD
441 WIDTH="25"
442 ALIGN="CENTER"
443 VALIGN="TOP"
444 ><IMG
445 SRC="common/note.png"
446 HSPACE="5"
447 ALT="Note"></TD
448 ><TD
449 ALIGN="LEFT"
450 VALIGN="TOP"
451 ><P
452 >It is even possible to control certain peripherals with commands
453 sent to the <TT
454 CLASS="FILENAME"
455 >/proc</TT
456 > directory.
457
458 <TABLE
459 BORDER="0"
460 BGCOLOR="#E0E0E0"
461 WIDTH="100%"
462 ><TR
463 ><TD
464 ><PRE
465 CLASS="SCREEN"
466 > <TT
467 CLASS="PROMPT"
468 >root# </TT
469 ><B
470 CLASS="COMMAND"
471 >echo on &#62; /proc/acpi/ibm/light</B
472 >
473 </PRE
474 ></TD
475 ></TR
476 ></TABLE
477 >
478
479 This turns on the <SPAN
480 CLASS="emphasis"
481 ><I
482 CLASS="EMPHASIS"
483 >Thinklight</I
484 ></SPAN
485 > in certain models
486 of IBM/Lenovo Thinkpads. (May not work on all Linux distros.)</P
487 ><P
488 >Of course, caution is advised when writing to <TT
489 CLASS="FILENAME"
490 >/proc</TT
491 >.</P
492 ></TD
493 ></TR
494 ></TABLE
495 ></DIV
496 ><P
497 ><A
498 NAME="PROCRUNNING"
499 ></A
500 ></P
501 ><P
502 >The <TT
503 CLASS="FILENAME"
504 >/proc</TT
505 > directory
506 contains subdirectories with unusual numerical
507 names. Every one of these names maps to the <A
508 HREF="variables2.html#PPIDREF"
509 >process ID</A
510 > of a currently running
511 process. Within each of these subdirectories, there are
512 a number of files that hold useful information about the
513 corresponding process. The <TT
514 CLASS="FILENAME"
515 >stat</TT
516 > and
517 <TT
518 CLASS="FILENAME"
519 >status</TT
520 > files keep running statistics
521 on the process, the <TT
522 CLASS="FILENAME"
523 >cmdline</TT
524 > file holds
525 the command-line arguments the process was invoked with, and
526 the <TT
527 CLASS="FILENAME"
528 >exe</TT
529 > file is a symbolic link to the
530 complete path name of the invoking process. There are a few
531 more such files, but these seem to be the most interesting
532 from a scripting standpoint.</P
533 ><DIV
534 CLASS="EXAMPLE"
535 ><HR><A
536 NAME="PIDID"
537 ></A
538 ><P
539 ><B
540 >Example 29-3. Finding the process associated with a PID</B
541 ></P
542 ><TABLE
543 BORDER="0"
544 BGCOLOR="#E0E0E0"
545 WIDTH="100%"
546 ><TR
547 ><TD
548 ><PRE
549 CLASS="PROGRAMLISTING"
550 > 1&nbsp;#!/bin/bash
551 2&nbsp;# pid-identifier.sh:
552 3&nbsp;# Gives complete path name to process associated with pid.
553 4&nbsp;
554 5&nbsp;ARGNO=1 # Number of arguments the script expects.
555 6&nbsp;E_WRONGARGS=65
556 7&nbsp;E_BADPID=66
557 8&nbsp;E_NOSUCHPROCESS=67
558 9&nbsp;E_NOPERMISSION=68
559 10&nbsp;PROCFILE=exe
560 11&nbsp;
561 12&nbsp;if [ $# -ne $ARGNO ]
562 13&nbsp;then
563 14&nbsp; echo "Usage: `basename $0` PID-number" &#62;&#38;2 # Error message &#62;stderr.
564 15&nbsp; exit $E_WRONGARGS
565 16&nbsp;fi
566 17&nbsp;
567 18&nbsp;pidno=$( ps ax | grep $1 | awk '{ print $1 }' | grep $1 )
568 19&nbsp;# Checks for pid in "ps" listing, field #1.
569 20&nbsp;# Then makes sure it is the actual process, not the process invoked by this script.
570 21&nbsp;# The last "grep $1" filters out this possibility.
571 22&nbsp;#
572 23&nbsp;# pidno=$( ps ax | awk '{ print $1 }' | grep $1 )
573 24&nbsp;# also works, as Teemu Huovila, points out.
574 25&nbsp;
575 26&nbsp;if [ -z "$pidno" ] # If, after all the filtering, the result is a zero-length string,
576 27&nbsp;then #+ no running process corresponds to the pid given.
577 28&nbsp; echo "No such process running."
578 29&nbsp; exit $E_NOSUCHPROCESS
579 30&nbsp;fi
580 31&nbsp;
581 32&nbsp;# Alternatively:
582 33&nbsp;# if ! ps $1 &#62; /dev/null 2&#62;&#38;1
583 34&nbsp;# then # no running process corresponds to the pid given.
584 35&nbsp;# echo "No such process running."
585 36&nbsp;# exit $E_NOSUCHPROCESS
586 37&nbsp;# fi
587 38&nbsp;
588 39&nbsp;# To simplify the entire process, use "pidof".
589 40&nbsp;
590 41&nbsp;
591 42&nbsp;if [ ! -r "/proc/$1/$PROCFILE" ] # Check for read permission.
592 43&nbsp;then
593 44&nbsp; echo "Process $1 running, but..."
594 45&nbsp; echo "Can't get read permission on /proc/$1/$PROCFILE."
595 46&nbsp; exit $E_NOPERMISSION # Ordinary user can't access some files in /proc.
596 47&nbsp;fi
597 48&nbsp;
598 49&nbsp;# The last two tests may be replaced by:
599 50&nbsp;# if ! kill -0 $1 &#62; /dev/null 2&#62;&#38;1 # '0' is not a signal, but
600 51&nbsp; # this will test whether it is possible
601 52&nbsp; # to send a signal to the process.
602 53&nbsp;# then echo "PID doesn't exist or you're not its owner" &#62;&#38;2
603 54&nbsp;# exit $E_BADPID
604 55&nbsp;# fi
605 56&nbsp;
606 57&nbsp;
607 58&nbsp;
608 59&nbsp;exe_file=$( ls -l /proc/$1 | grep "exe" | awk '{ print $11 }' )
609 60&nbsp;# Or exe_file=$( ls -l /proc/$1/exe | awk '{print $11}' )
610 61&nbsp;#
611 62&nbsp;# /proc/pid-number/exe is a symbolic link
612 63&nbsp;#+ to the complete path name of the invoking process.
613 64&nbsp;
614 65&nbsp;if [ -e "$exe_file" ] # If /proc/pid-number/exe exists,
615 66&nbsp;then #+ then the corresponding process exists.
616 67&nbsp; echo "Process #$1 invoked by $exe_file."
617 68&nbsp;else
618 69&nbsp; echo "No such process running."
619 70&nbsp;fi
620 71&nbsp;
621 72&nbsp;
622 73&nbsp;# This elaborate script can *almost* be replaced by
623 74&nbsp;# ps ax | grep $1 | awk '{ print $5 }'
624 75&nbsp;# However, this will not work...
625 76&nbsp;#+ because the fifth field of 'ps' is argv[0] of the process,
626 77&nbsp;#+ not the executable file path.
627 78&nbsp;#
628 79&nbsp;# However, either of the following would work.
629 80&nbsp;# find /proc/$1/exe -printf '%l\n'
630 81&nbsp;# lsof -aFn -p $1 -d txt | sed -ne 's/^n//p'
631 82&nbsp;
632 83&nbsp;# Additional commentary by Stephane Chazelas.
633 84&nbsp;
634 85&nbsp;exit 0</PRE
635 ></TD
636 ></TR
637 ></TABLE
638 ><HR></DIV
639 ><DIV
640 CLASS="EXAMPLE"
641 ><HR><A
642 NAME="CONSTAT"
643 ></A
644 ><P
645 ><B
646 >Example 29-4. On-line connect status</B
647 ></P
648 ><TABLE
649 BORDER="0"
650 BGCOLOR="#E0E0E0"
651 WIDTH="100%"
652 ><TR
653 ><TD
654 ><PRE
655 CLASS="PROGRAMLISTING"
656 > 1&nbsp;#!/bin/bash
657 2&nbsp;# connect-stat.sh
658 3&nbsp;# Note that this script may need modification
659 4&nbsp;#+ to work with a wireless connection.
660 5&nbsp;
661 6&nbsp;PROCNAME=pppd # ppp daemon
662 7&nbsp;PROCFILENAME=status # Where to look.
663 8&nbsp;NOTCONNECTED=85
664 9&nbsp;INTERVAL=2 # Update every 2 seconds.
665 10&nbsp;
666 11&nbsp;pidno=$( ps ax | grep -v "ps ax" | grep -v grep | grep $PROCNAME |
667 12&nbsp;awk '{ print $1 }' )
668 13&nbsp;
669 14&nbsp;# Finding the process number of 'pppd', the 'ppp daemon'.
670 15&nbsp;# Have to filter out the process lines generated by the search itself.
671 16&nbsp;#
672 17&nbsp;# However, as Oleg Philon points out,
673 18&nbsp;#+ this could have been considerably simplified by using "pidof".
674 19&nbsp;# pidno=$( pidof $PROCNAME )
675 20&nbsp;#
676 21&nbsp;# Moral of the story:
677 22&nbsp;#+ When a command sequence gets too complex, look for a shortcut.
678 23&nbsp;
679 24&nbsp;
680 25&nbsp;if [ -z "$pidno" ] # If no pid, then process is not running.
681 26&nbsp;then
682 27&nbsp; echo "Not connected."
683 28&nbsp;# exit $NOTCONNECTED
684 29&nbsp;else
685 30&nbsp; echo "Connected."; echo
686 31&nbsp;fi
687 32&nbsp;
688 33&nbsp;while [ true ] # Endless loop, script can be improved here.
689 34&nbsp;do
690 35&nbsp;
691 36&nbsp; if [ ! -e "/proc/$pidno/$PROCFILENAME" ]
692 37&nbsp; # While process running, then "status" file exists.
693 38&nbsp; then
694 39&nbsp; echo "Disconnected."
695 40&nbsp;# exit $NOTCONNECTED
696 41&nbsp; fi
697 42&nbsp;
698 43&nbsp;netstat -s | grep "packets received" # Get some connect statistics.
699 44&nbsp;netstat -s | grep "packets delivered"
700 45&nbsp;
701 46&nbsp;
702 47&nbsp; sleep $INTERVAL
703 48&nbsp; echo; echo
704 49&nbsp;
705 50&nbsp;done
706 51&nbsp;
707 52&nbsp;exit 0
708 53&nbsp;
709 54&nbsp;# As it stands, this script must be terminated with a Control-C.
710 55&nbsp;
711 56&nbsp;# Exercises:
712 57&nbsp;# ---------
713 58&nbsp;# Improve the script so it exits on a "q" keystroke.
714 59&nbsp;# Make the script more user-friendly in other ways.
715 60&nbsp;# Fix the script to work with wireless/DSL connections.</PRE
716 ></TD
717 ></TR
718 ></TABLE
719 ><HR></DIV
720 ><P
721 ><A
722 NAME="PROCWARNING"
723 ></A
724 ></P
725 ><DIV
726 CLASS="WARNING"
727 ><TABLE
728 CLASS="WARNING"
729 WIDTH="100%"
730 BORDER="0"
731 ><TR
732 ><TD
733 WIDTH="25"
734 ALIGN="CENTER"
735 VALIGN="TOP"
736 ><IMG
737 SRC="common/warning.png"
738 HSPACE="5"
739 ALT="Warning"></TD
740 ><TD
741 ALIGN="LEFT"
742 VALIGN="TOP"
743 ><P
744 >In general, it is dangerous to
745 <SPAN
746 CLASS="emphasis"
747 ><I
748 CLASS="EMPHASIS"
749 >write</I
750 ></SPAN
751 > to the files in <TT
752 CLASS="FILENAME"
753 >/proc</TT
754 >, as this can corrupt the
755 filesystem or crash the machine.</P
756 ></TD
757 ></TR
758 ></TABLE
759 ></DIV
760 ></DIV
761 ><H3
762 CLASS="FOOTNOTES"
763 >Notes</H3
764 ><TABLE
765 BORDER="0"
766 CLASS="FOOTNOTES"
767 WIDTH="100%"
768 ><TR
769 ><TD
770 ALIGN="LEFT"
771 VALIGN="TOP"
772 WIDTH="5%"
773 ><A
774 NAME="FTN.AEN19180"
775 HREF="procref1.html#AEN19180"
776 >[1]</A
777 ></TD
778 ><TD
779 ALIGN="LEFT"
780 VALIGN="TOP"
781 WIDTH="95%"
782 ><P
783 >Certain system commands, such as
784 <A
785 HREF="system.html#PROCINFOREF"
786 >procinfo</A
787 >,
788 <A
789 HREF="system.html#FREEREF"
790 >free</A
791 >,
792 <A
793 HREF="system.html#VMSTATREF"
794 >vmstat</A
795 >,
796 <A
797 HREF="system.html#LSDEVREF"
798 >lsdev</A
799 >,
800 and <A
801 HREF="system.html#UPTIMEREF"
802 >uptime</A
803 >
804 do this as well.</P
805 ></TD
806 ></TR
807 ></TABLE
808 ><DIV
809 CLASS="NAVFOOTER"
810 ><HR
811 ALIGN="LEFT"
812 WIDTH="100%"><TABLE
813 SUMMARY="Footer navigation table"
814 WIDTH="100%"
815 BORDER="0"
816 CELLPADDING="0"
817 CELLSPACING="0"
818 ><TR
819 ><TD
820 WIDTH="33%"
821 ALIGN="left"
822 VALIGN="top"
823 ><A
824 HREF="devproc.html"
825 ACCESSKEY="P"
826 >Prev</A
827 ></TD
828 ><TD
829 WIDTH="34%"
830 ALIGN="center"
831 VALIGN="top"
832 ><A
833 HREF="index.html"
834 ACCESSKEY="H"
835 >Home</A
836 ></TD
837 ><TD
838 WIDTH="33%"
839 ALIGN="right"
840 VALIGN="top"
841 ><A
842 HREF="networkprogramming.html"
843 ACCESSKEY="N"
844 >Next</A
845 ></TD
846 ></TR
847 ><TR
848 ><TD
849 WIDTH="33%"
850 ALIGN="left"
851 VALIGN="top"
852 ><TT
853 CLASS="FILENAME"
854 >/dev</TT
855 > and <TT
856 CLASS="FILENAME"
857 >/proc</TT
858 ></TD
859 ><TD
860 WIDTH="34%"
861 ALIGN="center"
862 VALIGN="top"
863 ><A
864 HREF="devproc.html"
865 ACCESSKEY="U"
866 >Up</A
867 ></TD
868 ><TD
869 WIDTH="33%"
870 ALIGN="right"
871 VALIGN="top"
872 >Network Programming</TD
873 ></TR
874 ></TABLE
875 ></DIV
876 ></BODY
877 ></HTML
878 >