BackgroundI am running an SSH server and have this user that I want to delete. I cannot delete this user because he is currently running a few processes that I need to kill first.This is the pipeline I am using currently using to find out all the process ids of the user I am currently using:ps -u user | awk '{print $1;}'The output looks like this:PID212121222124212523692370I want to pipe this to kill -9 to kill all processes so I can delete this stupid user like this:ps -u user | awk '{print $1;}' | sudo xargs kill -9But this does not work because of the PID header:kill: failed to parse argument: 'PID'The questionI am thinking that there has to be a simple Unix command to remove the first line of input.I am aware that I can use tail for this but I don't want to count how many lines the input contains to figure out exactly how many I want to display.I am looking for something like head or tail but inverted (instead of displaying only the first/last part of the stream it displays everything but the start/end of stream).NoteI managed to solve this issue I had by simply adding | grep [[:digit:]] after my awk command but I am still looking for a way to delete first line of a file as I think would be quite useful in other scenarios.
Command to remove the first N number of lines in input
command line;sed;awk;tail;head
NOTE: if your system already has pgrep/pkill then you are re-inventing the wheel here. If your system doesn't have these utilities, then you should be able to format the output of ps to get the unencumbered PID list directly e.g. ps -u user -opid=If you are already using awk, there is no need to pipe through an additional process in order to remove the first line (record): simply add a condition on the record number NRps -u user | awk 'NR>1{print $1;}'Since you mention head and tail, the formula you probably want in this case is tail -n +2