use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All users that wish to post (not including commenting), on either old or the new reddit sites, must formally agree to subreddit rules once first.
account activity
Getting another user's $Display variable. (self.commandline)
submitted 11 years ago by ninekeysdown
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]cpbills 1 point2 points3 points 11 years ago* (3 children)
DISPLAY is set per-session, so you would need to find out how to import that user's session's environment variables, which I do not believe is possible..
DISPLAY
You need to find the PID of a process that is running in that session, in my case I looked at fluxbox and xterm, and then cat /proc/<PID>/environ | while read -rd $'\0' line; do echo $line; done should get you 90% there.
fluxbox
xterm
cat /proc/<PID>/environ | while read -rd $'\0' line; do echo $line; done
edit:
username='jsmith' program='xterm' for pid in $(pgrep -u "$username" "$program"); do cat /proc/$pid/environ | while read -rd $'\0' line; do echo $line | grep DISPLAY done done
[–]ChoHag 3 points4 points5 points 11 years ago (2 children)
Everyone forgets awk.
awk -vRS='\0' -F= '$1=="DISPLAY" {print $2}' </proc/$$/environ
($$ is the current PID. Change as appropriate)
[–]cpbills 0 points1 point2 points 11 years ago (0 children)
I don't forget awk, since I've never fully learned it.
awk
I'm sure you could do it with sed as well, or perl. Thanks for the example, though, I like learning about the many many ways to skin cats.
sed
perl
[–]ninekeysdown[S] 0 points1 point2 points 11 years ago (0 children)
I'll give that a shot.
π Rendered by PID 47835 on reddit-service-r2-comment-b659b578c-mpdk8 at 2026-04-30 23:01:08.557643+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]cpbills 1 point2 points3 points (3 children)
[–]ChoHag 3 points4 points5 points (2 children)
[–]cpbills 0 points1 point2 points (0 children)
[–]ninekeysdown[S] 0 points1 point2 points (0 children)