DistroBaker 660347
diff --git a/ps/output.c b/ps/output.c
DistroBaker 660347
index e718f19..b66d543 100644
DistroBaker 660347
--- a/ps/output.c
DistroBaker 660347
+++ b/ps/output.c
DistroBaker 660347
@@ -1250,6 +1250,26 @@ static int pr_luid(char *restrict const outbuf, const proc_t *restrict const pp)
DistroBaker 660347
 }
DistroBaker 660347
 
DistroBaker 660347
 
DistroBaker 660347
+/* full path to executable */
DistroBaker 660347
+static int pr_exe(char *restrict const outbuf, const proc_t *restrict const pp){
DistroBaker 660347
+    char filename[48];
DistroBaker 660347
+    ssize_t num_read = 0;
DistroBaker 660347
+
DistroBaker 660347
+    snprintf(filename, sizeof filename, "/proc/%d/exe", pp->tgid);
DistroBaker 660347
+
DistroBaker 660347
+    num_read = readlink(filename, outbuf, OUTBUF_SIZE-1);
DistroBaker 660347
+    if (num_read > 0) {
DistroBaker 660347
+        outbuf[num_read] = '\0';
DistroBaker 660347
+    }
DistroBaker 660347
+    else {
DistroBaker 660347
+        outbuf[0] = '-';
DistroBaker 660347
+        outbuf[1] = '\0';
DistroBaker 660347
+        num_read = 1;
DistroBaker 660347
+    }
DistroBaker 660347
+
DistroBaker 660347
+    return num_read;
DistroBaker 660347
+}
DistroBaker 660347
+
DistroBaker 660347
 /************************* Systemd stuff ********************************/
DistroBaker 660347
 static int pr_sd_unit(char *restrict const outbuf, const proc_t *restrict const pp){
DistroBaker 660347
   return snprintf(outbuf, COLWID, "%s", pp->sd_unit);
DistroBaker 660347
@@ -1533,6 +1553,7 @@ static const format_struct format_array[] = {
DistroBaker 660347
 {"etimes",    "ELAPSED", pr_etimes,   sr_etime,   7,   0,    BSD, ET|RIGHT}, /* FreeBSD */
DistroBaker 660347
 {"euid",      "EUID",    pr_euid,     sr_euid,    5,   0,    LNX, ET|RIGHT},
DistroBaker 660347
 {"euser",     "EUSER",   pr_euser,    sr_euser,   8, USR,    LNX, ET|USER},
DistroBaker 660347
+{"exe",       "EXE",     pr_exe,      sr_nop,    27,   0,    LNX, PO|UNLIMITED},
DistroBaker 660347
 {"f",         "F",       pr_flag,     sr_flags,   1,   0,    XXX, ET|RIGHT}, /*flags*/
DistroBaker 660347
 {"fgid",      "FGID",    pr_fgid,     sr_fgid,    5,   0,    LNX, ET|RIGHT},
DistroBaker 660347
 {"fgroup",    "FGROUP",  pr_fgroup,   sr_fgroup,  8, GRP,    LNX, ET|USER},
DistroBaker 660347
diff --git a/ps/ps.1 b/ps/ps.1
DistroBaker 660347
index 844341c..6818667 100644
DistroBaker 660347
--- a/ps/ps.1
DistroBaker 660347
+++ b/ps/ps.1
DistroBaker 660347
@@ -1253,6 +1253,14 @@ option can be used to force the decimal representation.  (alias
DistroBaker 660347
 .BR uname ", "  user ).
DistroBaker 660347
 T}
DistroBaker 660347
 
DistroBaker 660347
+exe	EXE	T{
DistroBaker 660347
+path to the executable. Useful if path cannot be printed via
DistroBaker 660347
+.BR cmd ", " comm
DistroBaker 660347
+or
DistroBaker 660347
+.BR args
DistroBaker 660347
+format options.
DistroBaker 660347
+T}
DistroBaker 660347
+
DistroBaker 660347
 f	F	T{
DistroBaker 660347
 flags associated with the process, see the
DistroBaker 660347
 .B PROCESS FLAGS