Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Find Memory and activity from command output Post 303041748 by RudiC on Tuesday 3rd of December 2019 05:10:49 PM
Old 12-03-2019
With grep's greedy regex matching its not easy to lay hands on the activity if its "name is after "/opt/rather/". There may be better solutions than these ones that rely on the input lines' structure. Try
Code:
ps -eo pid,etime,command | grep -o "/opt/rather/[^ /]*\|-Xmx[^ ]*" | uniq | grep -A1 "\-Xmx"
-Xmx2048M
/opt/rather/bar
-Xmx3002M
/opt/rather/raal

or

Code:
ps -eo pid,etime,command | grep -o "\-Xmx[0-9M]* *-cp[ .:]*/opt/rather/[^/]*"  | grep -o "\-Xmx[0-9M]*\|[^ /]*$" | paste -s -d"\t\n"
-Xmx2048M    bar
-Xmx3002M    raal

or
Code:
ps -eo pid,etime,command | grep -o "\-Xmx[0-9M]*.\{,30\}/opt/rather/[^ /]*" | grep -o "\-Xmx[0-9M]*\|[^ /]*$" | paste -s -d"\t\n"
-Xmx2048M    bar
 -Xmx3002M    raal


A small awk script might be more apt to fulfill your needs to the full extent...
This User Gave Thanks to RudiC For This Post:
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

output of find command

Hi, I am confused about the output of find command. Please see the two find commands below. When i put "*.c" i get lots of files. But when i put *c only i get only one file. Any answer?? $ find . -name "*c" ./clarify/cheval/hp_server/rulemanager/rulemansvc... (3 Replies)
Discussion started by: shriashishpatil
3 Replies

2. Shell Programming and Scripting

hiding output from find command

when I do the find command from / , there are a lot of directories that I do not have access to and so I get "find: cannot open ..." How can I suppress these messages so only what was found is output. I was thinking on find / -name 'searchterm' | grep -v find but this doesnt work ... (5 Replies)
Discussion started by: JamesByars
5 Replies

3. Shell Programming and Scripting

Incorrect output using find command

I'm using the below command to list files older than 2 hours but it returns redundant output, am I missing something. # find . -mmin +120 -exec ls -l {} \; total 0 -rw-r--r-- 1 root system 0 Oct 13 09:52 test1 -rw-r--r-- 1 root system 0 Oct 13 09:52 test2 -rw-r--r-- 1 root ... (5 Replies)
Discussion started by: mbak
5 Replies

4. UNIX for Dummies Questions & Answers

problem with output of find command being input to basename command...

Hi, I am triying to make sure that there exists only one file with the pattern abc* in path /path/. This directory is having many huge files. If there is only one file then I have to take its complete name only to use furter in my script. I am planning to do like this: if ; then... (2 Replies)
Discussion started by: new_learner
2 Replies

5. AIX

Command to find TOP 5 Memory consuming process

HI All, Can anyone send me a command to find TOP 5 Memory consuming process. It would be lelpful if I get output something like below processname - pid - memory(in MB) - command I tried few commands from the internet but the result only give the real memory usage or pagging, I want total... (4 Replies)
Discussion started by: bce_groups
4 Replies

6. Shell Programming and Scripting

Command to find the Memory and CPU utilization using 'top' command

Hi all, I found like top command could be used to find the Memory and CPU utilization. But i want to know how to find the Memory and CPU utilization for a particular user using top command. Thanks in advance. Thanks, Ananthi.U (2 Replies)
Discussion started by: ananthi_ku
2 Replies

7. Shell Programming and Scripting

Wrong output in find command

Hi guys - I am trying a small script to tell me if there is a file that exists less than 1k. It should report ERROR, otherwise the check is good. I wrote this script down, however it never runs in the if/then statement. It always returns the echo ERROR. MYSIZE=$(find /home/student/dir1... (8 Replies)
Discussion started by: DallasT
8 Replies

8. Shell Programming and Scripting

indication of find activity - bash script

Hi All, I wanted to show on stdout that a file was found right after it happens due to indicate the activity of long search. Further more I want to store the result of the find in a file. I have tried this: echo -n "Searching" find . -name Makefile -type f -print -exec echo -n "." \; >... (16 Replies)
Discussion started by: vercsab
16 Replies

9. Red Hat

How to find memory taken by a process using top command?

I wanted to know how to find the memory taken by a process using top command. The output of the top command is as follows as an example: Mem: 13333364k total, 13238904k used, 94460k free, 623640k buffers Swap: 25165816k total, 112k used, 25165704k free, 4572904k cached PID USER ... (6 Replies)
Discussion started by: RHCE
6 Replies
VMSTAT(1)						      General Commands Manual							 VMSTAT(1)

NAME
vmstat - report virtual memory statistics SYNOPSIS
vmstat [ -fsi ] [ drives ] [ interval [ count ] ] DESCRIPTION
Vmstat delves into the system and normally reports certain statistics kept about process, virtual memory, disk, trap and cpu activity. If given a -f argument, it instead reports on the number of forks and vforks since system startup and the number of pages of virtual memory involved in each kind of fork. If given a -s argument, it instead prints the contents of the sum structure, giving the total number of several kinds of paging related events which have occurred since boot. If given a -i argument, it instead reports on the number of inter- rupts taken by each device since system startup. If none of these options are given, vmstat will report in the first line a summary of the virtual memory activity since the system has been booted. If interval is specified, then successive lines are summaries over the last interval seconds. ``vmstat 5'' will print what the system is doing every five seconds; this is a good choice of printing interval since this is how often some of the statistics are sampled in the system; others vary every second, running the output for a while will make it apparent which are recomputed every second. If a count is given, the statistics are repeated count times. The format fields are: Procs: information about numbers of processes in various states. r in run queue b blocked for resources (i/o, paging, etc.) w runnable or short sleeper (< 20 secs) but swapped Memory: information about the usage of virtual and real memory. Virtual pages are considered active if they belong to processes which are running or have run in the last 20 seconds. A ``page'' here is 1024 bytes. avm active virtual pages fre size of the free list Page: information about page faults and paging activity. These are averaged each five seconds, and given in units per second. re page reclaims (simulating reference bits) at pages attached (found in free list) pi pages paged in po pages paged out fr pages freed per second de anticipated short term memory shortfall sr pages scanned by clock algorithm, per-second up/hp/rk/ra: Disk operations per second (this field is system dependent). Typically paging will be split across several of the available drives. The number under each of these is the unit number. Faults: trap/interrupt rate averages per second over last 5 seconds. in (non clock) device interrupts per second sy system calls per second cs cpu context switch rate (switches/sec) Cpu: breakdown of percentage usage of CPU time us user time for normal and low priority processes sy system time id cpu idle If more than 4 disk drives are configured in the system, vmstat displays only the first 4 drives, with priority given to Massbus disk drives (i.e. if both Unibus and Massbus drives are present and the total number of drives exceeds 4, then some number of Unibus drives will not be displayed in favor of the Massbus drives). To force vmstat to display specific drives, their names may be supplied on the command line. FILES
/dev/kmem, /vmunix SEE ALSO
systat(1), iostat(1) The sections starting with ``Interpreting system activity'' in Installing and Operating 4.2bsd. 4th Berkeley Distribution March 15, 1986 VMSTAT(1)
All times are GMT -4. The time now is 12:28 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy