From the man page for ps:
a Lift the BSD-style "only yourself" restriction, which
is imposed upon the set of all processes when some
BSD-style (without "-") options are used or when the ps
personality setting is BSD-like. The set of processes
selected in this manner is in addition to the set of
processes selected by other means. An alternate
description is that this option causes ps to list all
processes with a terminal (tty), or to list all
processes when used together with the x option.
-f Do full-format listing. This option can be combined
with many other UNIX-style options to add additional
columns. It also causes the command arguments to be
printed. When used with -L, the NLWP (number of
threads) and LWP (thread ID) columns will be added. See
the c option, the format keyword args, and the format
-e Select all processes. Identical to -A.
grep is used to
print lines matching a pattern.
What it does
ps -aef | grep `pwd`
prints our all the lines matching the output of the command
pwd(which will be the path your current working directory), from the output of
saji@geeklap:~$ ps -aef | grep `pwd`
saji 2854 2814 0 09:51 ? 00:00:00 /usr/bin/ssh-agent /usr/bin/gpg-agent --daemon --sh --write-env-file=/home/saji/.gnupg/gpg-agent-info-geeklap /usr/bin/dbus-launch --exit-with-session gnome-session --session=ubuntu
saji 2855 2814 0 09:51 ? 00:00:00 /usr/bin/gpg-agent --daemon --sh --write-env-file=/home/saji/.gnupg/gpg-agent-info-geeklap /usr/bin/dbus-launch --exit-with-session gnome-session --session=ubuntu
saji 2879 1 0 09:51 ? 00:00:00 /usr/lib/gvfs//gvfs-fuse-daemon -f /home/saji/.gvfs
saji 14242 14148 0 15:26 pts/7 00:00:00 grep --color=auto /home/saji
As you can see the output shows the lines matching my current working directory, which is
If a command is in $(...) or
..., then the command is run and the output (what is printed to the screen) is caught and substituted to where the original $() or `` string was. So the actual command run is grep pwd.
For more information refer this link.(Thanks to @minerz029 for this information).
Do check out the following link for a detailed technical answer from the man pages itself: