0

If I did top or htop then it will display current running process.

I want to display the process names by with some other names and not with original name.

For example even Firefox running I want display in top as icefox or waterfox in top or htop .like that how can I do in Ubuntu?

Thank you.

2

I don't understand why you would want to do this, but if it's just for the sake of curiosity then a quick and dirty

top | sed 's/firefox/whatever/'

appears to work, at least for the default top output - but you should not rely on it being a robust solution.

  • Thats for not me. It's for a linux user from linuxforums.org . I will give him this link. Thank you. I will let you know sure. – rɑːdʒɑ Dec 8 '13 at 14:22
1

Why not just rename the executable to a different name? Or just relink it. For example for firefox this would be the easiest way:

  • We have to hide the folder name, so make a new directory

    sudo mkdir /usr/lib/icefox
    
  • Next we make a link to firefox executable

    cd /usr/lib/icefox
    sudo ln -s /usr/lib/firefox/firefox icefox
    
  • Now modify the firefox launcher

    sudo vi /usr/lib/firefox/firefox.sh
    

    And there change the MOZ_LIBDIR or MOZ_APP_NAME variables appropriately so they should read:

    MOZ_LIBDIR=/usr/lib/icefox
    MOZ_APP_NAME=icefox
    

    Leave all other lines untouched.

After these firefox should show up as icefox in ps/top/htop.

If you don't like this method you have to modify the source code of top/htop/etc. All of these reporting programs get their data from the /proc filesystem. For e.g. the file which you should modify in htop's source is this. There you have to change the ProcessList_readCmdlineFile function. Just insert an if section after the

 command[amtRead] = '\0'; 

line in which you check whether it is a process of which you want to hide it's name and if it is, then modify the command char array to what you want. Then after the changes you have to compile htop for yourself and use this modified version instead. But this method is not simple and I don't like it.

  • Have you tried that ? Because if process got some other name then we need to modify its launchDr code too. – rɑːdʒɑ Dec 8 '13 at 11:23
  • You mean the .desktop file or the firefox.sh file? Yes, you have to modify them if you want to use them. But because they are simple text file it's quite easy to change them. But you can launch directly the executable /usr/lib/firefox/firefox file. I've just tried it: I renamed the /usr/lib/firefox/firefox file to /usr/lib/firefox/icefox. Then I cd-d into /usr/lib/firefox directory. From there I ran ./icefox and it is working and in htop/top/ps i only see icefox, no firefox. – falconer Dec 8 '13 at 11:43
  • But if changing the executable names are not suitable for you, I can give another way, but that is the harder one. – falconer Dec 8 '13 at 11:45
  • Give it no problem. – rɑːdʒɑ Dec 8 '13 at 12:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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