Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to list only running application like: firefox, gedit, nautilus etc. by command-line.

Note:- I don't want to list all running process. But only list application which is running (say manually launched GUIs).

share|improve this question
"only list application which is running" what do you mean? all applications (known also as processes) are running. You mean only opened windows, like 'firefox, empathy and thunderbird' or all process that your user started like 'unity, compiz, gnome-terminal, apt-get'? – Braiam Jun 15 '14 at 13:39
up vote 5 down vote accepted

A combination of wmctrl and xprop offers many possibilities.

Example 1:

running_gui_apps() {

    # loop through all open windows (ids)
    for win_id in $( wmctrl -l | cut -d' ' -f1 ); do 

        # test if window is a normal window
        if  $( xprop -id $win_id _NET_WM_WINDOW_TYPE | grep -q _NET_WM_WINDOW_TYPE_NORMAL ) ; then 

            echo "$( xprop -id $win_id WM_CLASS | cut -d" " -f4- )"", window id: $win_id"



The output could look in this case similar like this:

"Firefox", window id: 0x032000a9
"Gnome-terminal", window id: 0x03a0000c
"Thunar", window id: 0x03600004
"Geany", window id: 0x03c00003
"Thunar", window id: 0x0360223e
"Mousepad", window id: 0x02c00003
"Mousepad", window id: 0x02c00248
"Xfce4-terminal", window id: 0x03e00004

Example 2:

running_gui_apps() {

    # loop through all open windows (ids)
    for win_id in $( wmctrl -l | cut -d' ' -f1 ); do 

        # test if window is a normal window
        if  $( xprop -id $win_id _NET_WM_WINDOW_TYPE | grep -q _NET_WM_WINDOW_TYPE_NORMAL ) ; then 

            # filter application name and remove double-quote at beginning and end
            appname=$( xprop -id $win_id WM_CLASS | cut -d" " -f4 )

            # add to result list
            applications+=( "$appname" ) 



    # sort result list and remove duplicates  
    readarray -t applications < <(printf '%s\0' "${applications[@]}" | sort -z | xargs -0n1 | uniq)

    printf -- '%s\n' "${applications[@]}" 

Output example:


You can add the function to your ~/.bashrc or run it from an script file.

share|improve this answer

wmctrl -l could be a thing you wanted. First install it

sudo apt-get install wmctrl

You can also combine it with System Monitor's list, by default it shows "All my processes" which means all process that belong to you as a user.

To have only names of applications, run:


wmctrl -l|awk '{$3=""; $2=""; $1="";  print $0}'
share|improve this answer
OP wants to get only the application name. Is this possible? – Avinash Raj Jun 15 '14 at 13:04
no, i opened firefox browser. Your command shows 0x03c000b3 0 avinash-Lenovo-IdeaPad-Z500 How list of running applications by command? - Ask Ubuntu - Mozilla Firefox plus some extra lines about Desktop,Hud,etc. – Avinash Raj Jun 15 '14 at 13:29
@AvinashRaj: sorry, I am working on it, I will add asap an edition, thanks for your attention – Ruslan Gerasimov Jun 15 '14 at 13:31
@AvinashRaj this is an addition, wmctrl -l|awk '{out=""; for(i=2;i<=NF;i++){out=$out" "$i}; print $out}', will add to my answer. Thank you for pointing out. – Ruslan Gerasimov Jun 15 '14 at 13:43
sorry , won't works for me. – Avinash Raj Jun 15 '14 at 13:52

If I want to see all or search for certain processes I'll use ps aux or ps aux | grep firefox for example.

share|improve this answer
i opened firefox application but ps aux | grep httpd displays nothing. – Avinash Raj Jun 15 '14 at 12:58
because grep httpd is searching for only httpd service ;) just do ps u – Tomanow Jun 15 '14 at 12:59
It display bash only but i opened firefox application also. – Avinash Raj Jun 15 '14 at 13:01
to see firefox process do ps aux | grep firefox – Tomanow Jun 15 '14 at 13:11

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.