Sys.info
Extract System and User InformationReports system and user information.
Sys.info()
This uses POSIX or Windows system calls. Note that OS names (sysname
) might not be what you expect: for example macOS identifies itself as Darwin and Solaris as SunOS.
Sys.info()
returns details of the platform R is running on, whereas R.version
gives details of the platform R was built on: the release
and version
may well be different.
A character vector with fields
sysname | The operating system name. |
release | The OS release. |
version | The OS version. |
nodename | A name by which the machine is known on the network (if any). |
machine | A concise description of the hardware, often the CPU type. |
login | The user's login name, or |
user | The name of the real user ID, or |
effective_user | The name of the effective user ID, or |
The first five fields come from the uname(2)
system call. The login name comes from getlogin(2)
, and the user names from getpwuid(getuid())
and getpwuid(geteuid())
.
The last three fields give the same value.
The meaning of release
and version
is system-dependent: on a Unix-alike they normally refer to the kernel. There, usually release
contains a numeric version and version
gives additional information. Examples for release
:
"4.17.11-200.fc28.x86_64" # Linux (Fedora) "3.16.0-5-amd64" # Linux (Debian) "17.7.0" # macOS 10.13.6 "5.11" # Solaris
There is no guarantee that the node or login or user names will be what you might reasonably expect. (In particular on some Linux distributions the login name is unknown from sessions with re-directed inputs.)
The use of alternatives such as system("whoami")
is not portable: the POSIX command system("id")
is much more portable on Unix-alikes, provided only the POSIX options -[Ggu][nr] are used (and not the many BSD and GNU extensions). whoami
is equivalent to id -un
(on Solaris, /usr/xpg4/bin/id -un
).
Windows may report unexpected versions: there, see the help for
.Platform
, and R.version
. sessionInfo()
gives a synopsis of both your system and the R session (and gives the OS version in a human-readable form).
Sys.info() ## An alternative (and probably better) way to get the login name on Unix Sys.getenv("LOGNAME")
Copyright (©) 1999–2012 R Foundation for Statistical Computing.
Licensed under the GNU General Public License.