[R] [FORGED] file.exists() on device files

Rolf Turner r.turner at auckland.ac.nz
Thu Jan 12 07:42:51 CET 2017


On 12/01/17 16:33, Henrik Bengtsson wrote:

<SNIP>

> FYI, the /proc is there because Unix has something called the "proc
> filesystem (procfs; https://en.wikipedia.org/wiki/Procfs) is a special
> filesystem in Unix-like operating systems that presents information
> about processes and other system information in a hierarchical
> file-like structure".  For instance, you can query the uptime of the
> machine by reading from /proc/uptime:
>
> $ cat /proc/uptime
> 332826.96 661438.10
>
> $ cat /proc/uptime
> 332871.40 661568.50
>
>
> You can get all IDs (PIDs) of all processes currently running:
>
> $ ls /proc/ | grep -E '^[0-9]+$'
>
> and for each process you there are multiple attributes mapped as
> files, e.g. if I start R as:
>
> $ R --args -e "message('hello there')"
>
> then I can query that process as:
>
> $ pid=$(pidof R)
> $ echo $pid
> 26323
>
> $ cat /proc/26323/cmdline
> /usr/lib/R/bin/exec/R--args-emessage('hello there')
>
> Unix is neat

Indeed.  Couldn't agree more.  Thanks for the insight.

<SNIP>

cheers,

Rolf

-- 
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276



More information about the R-help mailing list