Search Results

Search: Posts Made By: nteath
1,334
Posted By nteath
cut -d' ' -f5This returns only blank fields. ...
cut -d' ' -f5This returns only blank fields.

Let me be a little more clear:
i have the command:
top -d 1.0 -p $PID -n 10 | grep $PIDwhich returns information about a process. This looks like :...
1,334
Posted By nteath
Cut an output
Hi everyone, happy new year

I have the following output:
2503 nteath 20 0 4892 312
2503 nteath 20 0 5872 312
2503 nteath 20 0 6852 312
2503 nteath 20 0 7832 ...
1,713
Posted By nteath
I am on ubuntu 10.10 and i want to know the...
I am on ubuntu 10.10 and i want to know the memory consumption of my program (program.c). I understand that ps is the best choice and i made it work ( #4 reply) but i wonder if it is possible to use...
1,713
Posted By nteath
Hi That seems to work great and that's what i...
Hi
That seems to work great and that's what i want to do but as i said in a previous reply i need to use command top.
1,713
Posted By nteath
Thanks for your reply, I want to retrieve...
Thanks for your reply,
I want to retrieve information for the process every 1 sec and i am not sure if tha's possible with ps, also the script is for a project where i am asked to use top. So i...
1,713
Posted By nteath
Execute a C program and retrieve information
Hi
I have the following script:
#!/bin/sh
gcc -o program program.c
./program &
PID=$!

where i execute a C program and i get its pid. I want to retrieve information about this program (e.g...
17,089
Posted By nteath
Ok after all i got my pid with: PID=$! Thank...
Ok after all i got my pid with: PID=$!
Thank you :)

---------- Post updated at 01:51 PM ---------- Previous update was at 12:55 PM ----------

I have another question ( not sure if i had to...
17,089
Posted By nteath
./program & wait PID=$! ...
./program &
wait
PID=$!
This is working but when i use
echo $PID
I get two numbers
17,089
Posted By nteath
Hey scottn, I am new in shell scripting and i...
Hey scottn,
I am new in shell scripting and i 'm a bit confused.

I execute a C program with:
gcc -o dummy dummy.c
./dummy
and then i put it to sleep with: sleep 120

While it is "sleeping"...
17,089
Posted By nteath
I tried the following: pid=$(ps -ef | grep...
I tried the following:
pid=$(ps -ef | grep program | awk '{print $2}')
echo $pid

and i got a number '3348'
I assume this is my pid :)

Could you please explain what "grep -v grep" does?
17,089
Posted By nteath
The only way i managed to get an output is : ...
The only way i managed to get an output is :
pid=$(ps -ef | grep program )
echo $pid

out: nteath 3241 3239 0 19:16 pts/0 00:00:00 grep program
17,089
Posted By nteath
Thanks for the reply pid=$(ps -ef | grep...
Thanks for the reply

pid=$(ps -ef | grep program | grep -v grep | cut -d" " -f2,2)
I'm not sure i understand this line.
I tried echo $pid
but it doesn't print anything.
17,089
Posted By nteath
Execute a C program from Shell
Hi
I want to create a shell script tha executes a C program and then retrieves information about it.

I managed to run the program with:
#!/bin/bash

gcc -o program program.c
./program

Now...
2,466
Posted By nteath
Thank you :) worked great!
Thank you :) worked great!
2,466
Posted By nteath
Remove characters from string
Hi
I am new in shell scripting and i want to manipulate a string.

I have a string tha looks like: /home/nteath/file.txt
I want to remove everything until the last "/" , to keep only the...
Showing results 1 to 15 of 15

 
All times are GMT -4. The time now is 08:25 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy