Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I have used following command to fetch the CPU utilization of a process. It is giving result, but it is not coming out. I have used following command.
top | grep <processname>
I just want to put this in a loop and I will insert sleep in the code so that I can fetch the value in regular intervals
Use top's batch mode, eg.
top -b -n1 | grep processname
You can do:
while [ 1 ]; do top -n 1 | grep something; sleep 1; done
Use the -n option of top:
-n
Number of iterations. Update the display this number of times and then exit.
Related
Closed. This question is not about programming or software development. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 days ago.
This post was edited and submitted for review 6 days ago.
Improve this question
In a grep that i use to find some values in a log, i'm using
-exec grep -cHF "55=36" {} \; | grep -v ":0"
To show me values that are different to zero, so i get this output:
opt/route/file_1.log:7
I want to know how i can set a range of numbers to show me, for example if the grep finds only 7 matches no to show me anything but if it is more than 50 ( > 50), to show me the output.
I was told that maybe something like this could work?
grep -v ':[0-7]$' but it doesn't seem to work for me
Like this:
<INPUT> | tail -n+7
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 10 months ago.
Improve this question
I have wrote a simple script to keep monitor log file and append line and have implement some if statement if memet.
From my understanding, tail -n0 -f and tail -n1 -f both will does the job where you tell your script to keep monitor this log file of last line at the time and append one at the time.
Key thing is last line.
tail -n0 -f print NO lines, then waits for incoming new lines.
tail -n1 -f print the last line of the input file, then waits for new lines.
If no -n is provided, it defaults to 10.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
I am looking to increase the default size of the scrolling up buffer from linux command line. It is a Debian server without gui.
I don't find related option in bashrc and I don't even know if there is other configuration file for the default prompt alt+f1 alt+f2 ...
You can change the scrollback-buffer size using kernel options as described here: https://wiki.archlinux.org/index.php/Scrollback_buffer .
However, if you are interested in the output of a command but at the same time you want to watch the command's progress interactively I suggest to use tee:
command | tee out.file
or if you want to append to a file use
command | tee -a out.file
tee is nice! use it! :)
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
By using UNIX/Linux commands, pipes (“|”) and redirections (“>”, “>>”)
make a listing of the smallest 5 files in the “/etc” directory whose names
contains string “.conf”, sorted by increasing file size.
This will work:
ls -lS /etc | sort -k 5 -n| grep ".conf" | head -n 5
First list files by size, then sort by 5th column of results by number, then filter lines containing the string ".conf" and finally show only 5 lines.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
Is there a trick to show linux command's specific option? Such as I want to know some detail about tar's -z option, and I try this: tar --help | grep '-z' but shows nothing.
So is it possible just show details about specific command option?
Appreciate first if you can help me.
Specifically for the problem of tar --help | grep '-z' not working, do this:
tar --help | grep -- '-z'
Without the --, grep takes -z as an option rather than an argument.