I'll comment below. # lsof|awk /libssl\|libcrypt/'{print $1,$3}'|uniq I'm not going to comment on the construct of the pipeline much because awk is a language itself and this is fairly basic once you understand the awk portion (shortly: output of lsof is sent to awk which searches for either libssl or libcrypt and when found print the first and third field. pass the result to u