Useful CLI tools (bash) for Arch Linux administration
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

24 lines
564 B

#!/bin/env sh
NAMESPACES=( $(ls /run/netns) )
if [[ ${1} =~ ^(\-h|\-\-help)$ ]]; then
echo "
List processes in non-default namespaces.
"
exit 0
fi
printf "%-25s%-20s%-20s%s%-15s%-30s%s\n" "USER" "PID" "COMMAND" "NAMESPACE"
echo "--------------------------------------------------------------------------"
for namespace in ${NAMESPACES[@]}; do
for pid in $(sudo ip netns pids ${namespace}); do
printf "%-25s%-20s%-20s%s%-15s%-30s%s\n" $(ps -q ${pid} -o uname,pid,comm= | tail -1) ${namespace}
done
done
echo "To alter a process, use: $(killns)"