Advertisement
Guest User

Untitled

a guest
Jun 27th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. #!/bin/bash
  2. t="$(uptime | awk -F'( |,|:)+' '{
  3. d=h=m=0;
  4. if ($7=="min")
  5. m=$6;
  6. else {
  7. if ($7~/^day/) { d=$6; h=$8; m=$9}
  8. else {h=$6;m=$7}
  9. }
  10. }
  11. {
  12. print d*24+h+0,":",m+0
  13. }' | sed 's/ //g')"
  14.  
  15. t1="$(uptime | sed 's/ up.*/ up/')"
  16. uptime | sed 's/users/user/' | sed "s/^[^,]*,*/${t1} ${t},/" | sed -e 's/^[ \t]*//'
  17. # uptime line1
  18. grep 'cpu' /proc/stat
  19. # greps every line with cpu in it from /proc/stat
  20. ps -eo %mem,%cpu,pid,comm,args --sort=-%mem | head -7 | tail -6 | sed -e 's/^[ \t]*//'
  21. #gets the 6 processes that use the most memory
  22. free -m | sed -n '1p;2p;4p' | sed 's/buffers/buff\/cache/'
  23. #provides information about the phycical and virtual memory
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement