How about
When using ps always use the -o option to specify exactly which fields you need rather than use a full listing and remove the ones you don't.
With the -E flag that you are already using, the search is for a regular expression. You can include an expression so that grep will not find itself like this:-
The [o] matches the single character o which seems illogical until you recognise that the grep process will therefore not match, so it excludes itself.
You have several options separated with pipes so you pick the row if you match any of the items so you will need to do this to each part.
Two more thoughts:-
You have a search pattern of a space. Is that really what you want? I would expect much more output if that were true.
Your sort -u seems in the wrong place. Perhaps this might be better:-
I use -o comm= to strip out the headings.
You do end up with the output the other way round. Is that a problem?
I hope that this helps,
Robin
These 3 Users Gave Thanks to rbatte1 For This Post:
Hey Radioactive,
Am sorry, it would give same result as before. ---------- Post updated at 05:04 AM ---------- Previous update was at 05:02 AM ----------
Quote:
Originally Posted by apmcd47
How about
When using ps always use the -o option to specify exactly which fields you need rather than use a full listing and remove the ones you don't.
Andrew
Thanks Andrew, it was helpful to certain extent. When I run your command, it gives no output, But I was looking for a output like this :
Hello Guys,
I need some help to find out if processes are running on remote server or not. I could do 'ssh' to do that but due to some security reasons, I need to avoid the ssh & get result from remote server.
Could you please suggest some that can be done without ssh or similar sort of... (8 Replies)
HI
can someone help me to check the process running more than 2 hours.
I have the below command which shows the time and process id, however, I only need the processes running more than 2 hours. (8 Replies)
Hello everybody ,
I launched cron to execute a task every hour but the job takes more than hour that's why I'm getting more than 1000 cron processes running at the same time !!!
My question is how to tell cron not to execute unless the job terminated in order to have only one process running .... (14 Replies)
Hello,
Please help me with a script with which I can check long running processes on the database server and the os is AIX.
Best regards,
Vishal (5 Replies)
Hi can anybody help me regarding this..
i want know the output of ps -ef with explanation.
how can we know the running processess.
this is the output of ps -elf
F S UID PID PPID C PRI NI ADDR SZ WCHAN STIME TTY TIME CMD
19 T root 0 0 0 0 SY ... (1 Reply)
Hi,
I am trying to write a script, which queries a db to get the names of processes, stores it in a file and then checks if that process is running on a remote server. However I am not getting it right, could anyone help me out.
#!/bin/sh
echo "select Address from Device where Cust =... (5 Replies)
Hi
i've been googling a lot but can't find an answer. All I would like to know is how to find out all processes that are running on a machine.
I know ps gives all YOUR processes.
thanks (9 Replies)