From 33276ce8e9095da895a13ba7eae574890fb9486f Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Fri, 24 Mar 2023 22:28:59 -0400 Subject: [PATCH] add aliases to list open files and exec them --- .bashrc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.bashrc b/.bashrc index d4b9e85..fb9c2df 100644 --- a/.bashrc +++ b/.bashrc @@ -92,6 +92,11 @@ alias ll='ls -alFh' alias la='ls -A' alias l='ls -CF' alias lb='lsblk -o+FSAVAIL,FSUSED,FSUSE%,MODEL,PARTTYPENAME,STATE' +alias opg="lsof 2>/dev/null +D . | grep 'pg.*swp$' | awk '{print \$9}' | sed 's/\.swp//g' | sed 's/\/\./\//g'" +#alias opg="lsof +D . | grep 'pg.*swp$' | awk '{print \$9}' | sed 's/\.swp//g' | sed 's/\/\./\//g' | xargs -r realpath" +alias osw="lsof 2>/dev/null +D . | awk '\$NF ~ /swp$/ {print \$9}' | sed 's/\.swp//g' | sed 's/\/\./\//g'" +alias xpg="lsof 2>/dev/null +D . | grep 'pg.*swp$' | awk '{print \$9}' | sed 's/\.swp//g' | sed 's/\/\./\//g' | xargs -r $PG -f" +alias xsw="lsof 2>/dev/null +D . | grep '.*swp$' | awk '{print \$9}' | sed 's/\.swp//g' | sed 's/\/\./\//g' | xargs -r $PG -f" # Add an "alert" alias for long running commands. Use like so: # sleep 10; alert