Advertisement
Sergio_Istea

arbol de procesos interprete en uso

Aug 30th, 2021
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.44 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # el siguiente script utiliza el comando 'pstree'
  4.  
  5. su -c "apt update && apt install psmisc"
  6.  
  7. # Abrir arbol de procesos para la tty en uso
  8. # Averguar tty en uso
  9. TTY1="$(tty | cut -d "/" -f 3)/$(tty | cut -d "/" -f 4)"
  10.  
  11. # Obtener el PID para el interprete en uso en la tty en uso
  12.  
  13. BASHPID="$(ps aux | grep $TTY1 | grep bash | grep -v grep | cut -d ' ' -f 5)"
  14.  
  15. # Arbol de procesos para el interprete en uso
  16.  
  17. pstree -p $BASHPID
  18.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement