processes

 ps
  PID TTY          TIME CMD
 3395 pts/13   00:00:00 bash
11087 pts/13   00:00:00 ps
ubuntu2@ubuntu2:~$ ll /proc | grep 3395
dr-xr-xr-x   9 ubuntu2    ubuntu2             0 Jun 17 02:03 3395/

/proc/3395/environ
-r-------- 1 ubuntu2 ubuntu2 0 Jun 21 01:08 /proc/3395/environ


You can obtain the environment variables associated with the process by executing the following command:

cat environ
XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0XDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/usr/share/upstart/xdg:/etc/xdgLANG=en_US.UTF-8SHLVL=0XDG_VTNR=7COMPIZ_CONFIG_PROFILE=ubuntuLANGUAGE=en_USMANDATORY_PATH=/usr/share/gconf/ubuntu.mandatory.pathLOGNAME=ubuntu2PWD=/home/ubuntu2GNOME_KEYRING_PID=2846XDG_GREETER_DATA_DIR=/var/lib/lightdm-data/ubuntu2DISPLAY=:0QT_QPA_PLATFORMTHEME=appmenu-qt5GTK_IM_MODULE=ibusSELINUX_INIT=YESXDG_SESSION_ID=c2XAUTHORITY=/home/ubuntu2/.XauthorityDESKTOP_SESSION=ubuntuIM_CONFIG_PHASE=1DEFAULTS_PATH=/usr/share/gconf/ubuntu.default.pathGDMSESSION=ubuntuGNOME_KEYRING_CONTROL=/run/user/1000/keyring-3Bs6adTEXTDOMAIN=im-
 .....

Each variable is represented as a name=value pair and are separated by a null character (\0). If you can substitute the \0 character with \n, you can reformat the output to show each variable=value pair in each  

cat environ | tr '\0' '\n'
XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
XDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/usr/share/upstart/xdg:/etc/xdg
LANG=en_US.UTF-8
SHLVL=0
XDG_VTNR=7
COMPIZ_CONFIG_PROFILE=ubuntu
LANGUAGE=en_US
MANDATORY_PATH=/usr/share/gconf/ubuntu.mandatory.path
LOGNAME=ubuntu2
PWD=/home/ubuntu2
GNOME_KEYRING_PID=2846
 

Comments

Popular posts from this blog

HAproxy logging

teamcity Automatic Agent Start under Linux

NFS mount add in fstab _netdev instead of default | firewall-cmd --list-all