List Process running under current user

Hi,

i need to list the processes running only under current logged in user.

EX:

$ whoami
oraaqw

$ ps -ef | grep tnslsnr
  oraaqw 11403300 19267592   0 09:14:47  pts/3  0:00 grep tnslsnr
  oraaqw 15794208        1   0   Jan 14      - 11:59 /11gaamd01/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr listener -inherit
  orauni 29950098        1   0   Jan 14      -  4:39 /11guni01/app/oracle/product/11.2.0/db_1/bin/tnslsnr LISTENER -inherit
  orasas 31326450        1   0   Jan 14      -  7:12 /11gsas01/app/oracle/product/11.2.0/db_1/bin/tnslsnr listener -inherit
  oraaqw 36110420        1   0   Jan 14      -  8:55 /11gaamq01/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr listener -inherit

i am looking for output of only the processes running under oraaqw user.

sample output:

/11gaamd01/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr listener -inherit
/11gaamq01/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr listener -inherit

please, help me.

Thanks.

ps -fu oraaqw

Thanks vgersh99,

I got what iam looking for.

ps -fu $USER -o args | grep tnslsnr

/11gaamd01/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr listener -inherit
/11gaamq01/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr listener -inherit

Thanks.

---------- Post updated at 10:20 AM ---------- Previous update was at 10:15 AM ----------

Hi,

i got one more question, does this run on Linux too.

i cannot see the output on Linux

$ uname -a
Linux testdb01 2.6.32-504.12.2.el6.x86_64 #1 SMP Sun Feb 1 12:14:02 EST 2015 x86_64 x86_64 x86_64 GNU/Linux

$ ps -fu $USER -o args | grep tnslsnr
ERROR: Conflicting format options.

Thanks.

Try:

[s]```text
ps -fu $USER -o args | grep -e tns -e snr


Err...
 ``` -o args ```  should be modified to contain the arguments you want, not the literal word 'args'.
Or just leave \(ignore/remove\) this out.

hth

In the Unix-like world there are several type of styles for ps . Some systems support the BSD style where no `-' is prefixed, some systems support the POSIX or UNIX standards where a prefixed `-' is required. Most Linux systems has the GNU style as well, called long options, which does not affect here, nevertheless, because the GNU ps tries to accommodate all three styles, and mix and match is allowed, conflicts do occur.
-u and u has the greatest chance of conflicting with other flags because they mean different in each style.

Try this one and see if it does what you want.

ps -u $USER -o args

args is a valid user-defined format specifier. Meaning that you use with the -o or o prefixed in front and space is allow.
Some of the others specifiers are:

cmd
comm
command
fname
ucmd
ucomm
lstart
bsdstart
start

Interesting enough cmd, args and command are alias.

-f and -o both specify a format; you cannot have both. Further, -l can only work with -f
--
Most easy with pgrep, if your OS has got it

pgrep -u $USER tnslsnr

While that it is true by themselves in an UNIX standards style, the GNU ps does not raise an ERROR: Conflicting format options. when you include both, since the -f is (elevated or interpreted) to just a BSD style f . Combining both will just provide a warning of
bad syntax, perhaps a bogus '-'? and output as: ASCII-art process hierarchy (forest)