Why the -u flag doesn't work for ps?
I'm executing the following ps command:
root@dor-desktop:/home/dor# ps u -t "$(tty)" -u mysql
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
dor 2070 0.0 0.1 22436 5240 pts/0 Ss 20:29 0:00 bash
root 2411 0.0 0.0 56028 1916 pts/0 S 20:45 0:00 su
root 2419 0.0 0.0 19532 2276 pts/0 S 20:45 0:00 bash
root 2488 0.0 0.0 4108 668 pts/0 S 20:51 0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --skip-networking --skip-grant-tables --user=mysql --b
mysql 2607 0.0 0.4 146552 19024 pts/0 Sl 20:51 0:00 /usr/local/mysql/libexec/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/var --use
root 2672 0.0 0.0 15268 1224 pts/0 R+ 20:59 0:00 ps u -t /dev/pts/0 -u mysql
You can see that the command asks for processes who are associated with the current terminal and who's user is mysql. But I get both types of processes!
How can I separate? I want only the process who initiated by the user mysql.
I found the following command: ps -C mysqld, which gives me want I need, but I prefer to understand what's wrong with the first command.
I'm executing the following ps command:
root@dor-desktop:/home/dor# ps u -t "$(tty)" -u mysql
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
dor 2070 0.0 0.1 22436 5240 pts/0 Ss 20:29 0:00 bash
root 2411 0.0 0.0 56028 1916 pts/0 S 20:45 0:00 su
root 2419 0.0 0.0 19532 2276 pts/0 S 20:45 0:00 bash
root 2488 0.0 0.0 4108 668 pts/0 S 20:51 0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --skip-networking --skip-grant-tables --user=mysql --b
mysql 2607 0.0 0.4 146552 19024 pts/0 Sl 20:51 0:00 /usr/local/mysql/libexec/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/var --use
root 2672 0.0 0.0 15268 1224 pts/0 R+ 20:59 0:00 ps u -t /dev/pts/0 -u mysql
You can see that the command asks for processes who are associated with the current terminal and who's user is mysql. But I get both types of processes!
How can I separate? I want only the process who initiated by the user mysql.
I found the following command: ps -C mysqld, which gives me want I need, but I prefer to understand what's wrong with the first command.
No comments:
Post a Comment