How to always cut the PID from `ps aux` command?

-d ' ' means using a single space as delimiter. Since there’re 1 space before 2049 and 2 spaces before 12290, your command get them by -f 2 and -f 3.

I recommend using ps aux | awk '{print $2}' to get those pids.

Or you can use tr to squeeze those spaces first
ps aux | tr -s ' ' | cut -d ' ' -f 2

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)