How do I kill all processes by a specific user from the last 10 hours?

by Christiana Tomescu   Last Updated May 28, 2018 11:00 AM

I need a shell script to kill all processes by a specific user from the last 10 hours... I'm a beginner. however I wrote a script ...

#!/bin/bash
Echo “User name : “
    Echo $1
pkill -9 -u ‘id -u $1’ $(ps -eo comm,pid,etimes | awk '/^procname/ {if ($3 <36000) { print $2}}')

is this correct?

Tags : linux process


Related Questions





What is a Process Handle?

Updated June 30, 2015 13:00 PM

Killing process group safely

Updated August 02, 2017 16:00 PM