LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-15-2009, 10:39 AM   #1
engee
LQ Newbie
 
Registered: Jun 2009
Posts: 4

Rep: Reputation: 0
Renaming a process


Hi!

I've tried to search the forum for an answer to my question, but I've been unable to find a suitable one.

What I want to do is rename/change what is displayed as "cmd" when doing a ps -ef.

My goal is to have a more streamlined display of these and other processes running in the system, so that I can monitor them more easily.

Below is a sample of what I want to truncate into something more usable.

Code:
bin/dna -Djava.class.path=classes:../classes/diacommon.jar:classes/dna.jar -Djavax.net.ssl.keyStore=../config/mykey -Djavax.net.ssl.keyStorePassword=password -Djavax.net.ssl.trustStore=../config/mykey -Djava.security.policy=file:../config/rmipolicy.txt -Djava.security.auth.login.config=file:../config/diajaas.cfg -DCA_DIA_HOME=/opt/CA/SharedComponents/ccs -Djava.rmi.server.hostname=hostname.com com/ca/dia/dna/DNA
Is there some way to change what is displayed when starting the program, or perhaps afterwards?

Last edited by engee; 06-15-2009 at 10:41 AM.
 
Old 06-15-2009, 10:43 AM   #2
jamescondron
Member
 
Registered: Jul 2007
Location: Scunthorpe, UK
Distribution: Ubuntu 8.10; Gentoo; Debian Lenny
Posts: 961

Rep: Reputation: 69
http://stupefydeveloper.blogspot.com...cess-name.html

Its quite technical, so you ought to have a bit of knowledge of
Code:
struct task_struct
in how the kernel implements processes
 
Old 06-15-2009, 10:43 AM   #3
Agrouf
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: LFS
Posts: 1,591

Rep: Reputation: 79
use "| cut -c n", where n is the num of characters you want in a line:
ps -ef | cut -c 80
 
Old 06-16-2009, 10:04 AM   #4
engee
LQ Newbie
 
Registered: Jun 2009
Posts: 4

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Agrouf
use "| cut -c n", where n is the num of characters you want in a line:
ps -ef | cut -c 80
This might help in some circumstances, but what I wish to achieve is to "permanently" rename the cmd, so that the processes will be reported as "java 1", "java 2" each time you do a regular ps -ef|grep java, these process will be monitored by another system, so the grep was just way to explain what I wanted to change.

Quote:
Originally Posted by jamescondron
This is more along what I have in mind, like you say it's quite technical so I'll have to do some thinking here, thank's for pointing me in the right direction.
 
Old 06-16-2009, 10:26 AM   #5
Agrouf
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: LFS
Posts: 1,591

Rep: Reputation: 79
This is probably not what you want either but you can make an alias to the ps command and use a bit of sed to get the name you want.
Anyway good luck and have fun with the setprocname program and please post here anything that you find and that might be useful to other people as well.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Finding the Process ID of a Process While Initiating the Process senthilmuthiah Linux - Newbie 7 04-02-2009 11:37 AM
scheduler invocation, process selected, process entry and exit linuxdoniv Programming 1 03-14-2008 04:48 AM
child process usses same amount of ram as parent process socialjazz Programming 7 10-19-2006 06:48 PM


All times are GMT -5. The time now is 09:43 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration