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

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