How to get the memory or CPU usage from a pid

sometimes i want to know the memory or cpu usage of just one process. this can be done easy with ps -p {PID} -o %cpu,%mem

in this examples, i use 28386 as the process id (pid) if you use the command like this: ps -p {PID} -o %cpu | tail -n1 you get only the number (without the extra line with %MEM or %CPU)

only memory usage:

ps -p 28386 -o %mem

example output:

%MEM
4.0

only cpu usage:

ps -p 28386 -o %cpu

example output:

%CPU
13.2

memory and cpu usage:

ps -p 28386 -o %mem,%cpu

example output:

%CPU %MEM
13.2  4.0