Skip to content

Instantly share code, notes, and snippets.

@hh10k
Created January 4, 2014 05:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hh10k/8252135 to your computer and use it in GitHub Desktop.
Save hh10k/8252135 to your computer and use it in GitHub Desktop.
Do a pstree for each screen process.
#!/usr/bin/env perl
use warnings;
use strict;
opendir my $dir, "/var/run/screen/S-$ENV{USER}/";
foreach my $file (readdir $dir) {
my ($pid) = ($file =~ /^(\d+)\./);
next unless $pid;
print `pstree -p $pid`;
}
closedir $dir;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment