Facebook Twitter Instagram
    WiredRevolution.com
    • Home
    • About
    • Contact Us
    • Essential Linux Commands
    • Sitemap
    Facebook Twitter Instagram
    WiredRevolution.com
    system administration

    View process environment details with proc

    RyanBy RyanDecember 10, 2008Updated:December 20, 20082 Mins Read
    Facebook Twitter Pinterest LinkedIn Reddit WhatsApp Email

    The process environment consists of all the individual environment variables which are passed on to the program by the shell when the program is launched. This environment can be read and changed by the program during its execution, and can affect how a program is linked or how it executes. For all these reasons it may be important at times to see exactly what the environment contains. The proc filesystem provides the interface to make this happen.

    The proc pseudo-file system is used as an interface to kernel data structures. It is commonly mounted at /proc and most of the files inside are read-only. Within proc there exists a subdirectory for every running process on the system identified by its process ID (PID).

    Inside each process directory is an environ file which contains the current environment for that process.

    /proc/<PID>/environ

    This file is limited at this point in time to 4096 characters. Therefore if you have a process with an unusually large environment the data beyond this limit will be truncated.

    The environment variable entries are separated by null characters ‘\0‘, which makes it difficult to view the file. The best way to get around this is with the tr command which will replace the the null characters with newline characters ‘\n‘.

    $ cat /proc/12345/environ | tr "\000" "\n"
    
    Share. Facebook Twitter Pinterest LinkedIn WhatsApp Reddit Email
    Previous ArticleView system information with /proc/cpuinfo and /proc/meminfo
    Next Article How to SSH into Ubuntu LiveCD

    Related Posts

    Find the parent PID of a Bash Script

    Find the PID of a background child process in Bash

    Find the PID of the current Bash script

    Most Commented
    March 12, 2009

    Fix blue tinted video in Ubuntu

    September 10, 2010

    Setup SSH access between VirtualBox Host and Guest VMs

    March 8, 2011

    Install GNOME Shell in Ubuntu 10.10 Maverick

    April 4, 2009

    Setup the PS3 Bluetooth Controller on Ubuntu

    October 22, 2008

    How to correctly use LD_LIBRARY_PATH

    Recent Comments
    • Execute command on linux virtual machine (or server) from windows commandline on Setup SSH access between VirtualBox Host and Guest VMs
    • Solved: How to SSH to a VirtualBox guest externally through a host? - Daily Developer Blog on Setup SSH access between VirtualBox Host and Guest VMs
    • How to SSH to a VirtualBox guest externally through a host? [closed] – Code D3 on Setup SSH access between VirtualBox Host and Guest VMs
    • How to copy and paste from VirtualBox? [duplicate] on Setup SSH access between VirtualBox Host and Guest VMs
    • Jackie Laguna on Fix OpenGL: ChoosePixelFormat SketchUp error in WINE
    © 2025 ThemeSphere. Designed by ThemeSphere.

    Type above and press Enter to search. Press Esc to cancel.