Questions tagged [top-command]

Unix/Linux utility providing a "dynamic, real-time view of a running system".

84 questions
0
votes
2 answers

paramiko python script for linux command execution

_stdin, _stdout,_stderr = client.exec_command("top -c") print(_stdout.read().decode()) print(_stderr.read().decode()) client.close() output: TERM environment variable not set. i am not getting top command output, please help in advance.
0
votes
1 answer

Unexpected memory usage behaviour when using static linking in C

I am studying static linking and dynamic linking, and my understanding is that static linking consumes more memory and disk space compared to dynamic linking. It is evident that static linking occupies more disk space because the static libraries…
0
votes
1 answer

top command doesn't show me the full path of COMMAND

I wrote this shell script named example.sh on Linux. #!/bin/sh TOPLOG=/tmp/top.log date +%H:%M:%S >> ${TOPLOG} top -b -c -n 1 |head -n 8 |tail -n 2 >> ${TOPLOG} echo >> ${TOPLOG} When I run it with the command "sh /tmp/example.sh", texts in…
leaN5525
  • 11
  • 2
0
votes
1 answer

Is there a way to measure CPU usage inside the Kubernetes POD?

In CNF world, measuring the CPU usage on a POD with usual commands for example, top command doesnot actually provide the POD's actual CPU usage, instead it will be like you run it on the host system/node because the pod is using kernel of the host…
0
votes
1 answer

Does resource consumption of a process shown using "top" also contains resource consumption of subprocess?

I have created a function in C which trace system calls. This function calls the "perf" tracer. The function is executing the command "perf trace -p pid" using "popen". I have to measure the resource consumption of the C program using "top" linux…
0
votes
2 answers

How to get %CPU and %MEM only from top command

I am looking for the command/filter for the top command to get only %CPU and %MEM columns. Currently I am using like : Command: top -b -p 1665,2398 -n 1 -o -PID | tail -n +7 Output: PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+…
0
votes
1 answer

Python cron job returns different output than manual execution

My python script cuts off strings when run via cron. I have a python script that captures the output from the unix "top" command, iterates through to find the metrics I require and prints these to an output file. I want to capture these metrics…
daragh
  • 487
  • 9
  • 18
0
votes
1 answer

spin locks not consuming 100% cpu

#include "boost/smart_ptr/detail/spinlock.hpp" boost::detail::spinlock lock; main(){ std::lock_guard guard(lock); while(true) { i=i+100; } } Machine details: CPU(s): …
anurag86
  • 1,635
  • 1
  • 16
  • 31
0
votes
1 answer

Running a script with top command in the background

I have a script that basically prints that output of top -n1 to a file every second In its simplest form: while [ 1 ] ; do top -n1 sleep 1 done If I run my secript like: ./my_script.sh > out.log it runs fine If I run it in the…
code_fodder
  • 15,263
  • 17
  • 90
  • 167
0
votes
0 answers

Understanding CPU from TOP command having multi-core processor

I am currently using the TOP command to fetch the CPU and Memory of a process. My query here is on understanding the value it displays. PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND …
sdgd
  • 723
  • 1
  • 17
  • 38
0
votes
2 answers

Bash script output of a top command

When I execute command top -c -b -n | grep XXX > TEST on Red Hat Linux command line, all the paths and the rest of the stuff from the top command is exported into the TEST file (in one line it wrote more than 100 columns/character, for example).…
pet238
  • 5
  • 5
0
votes
1 answer

regarding VRT column of top command's output on linux

In the man pages of top command, it is given that VRT column shows memory consumption in kb(kilo bits). When i am running my application in linux, memory consumed is shown as 157m. Does this 157m mean 157 mega bytes or 157 mega bits? Any…
abcd
  • 75
  • 1
  • 8
0
votes
2 answers

The memory of linux top command and the jconsole heap usage is so different

The memory usage of the same program displayed by them are so different. Is there some thing other cost the memory ?
Brutal_JL
  • 2,839
  • 2
  • 21
  • 27
0
votes
2 answers

Add timestamp to the end of each line of a CSV file

I am trying to get the first 5 lines of top command using shell script. Here is the output of my shell…
Arun Ramachandran
  • 1,270
  • 5
  • 23
  • 36
0
votes
1 answer

Why does my EC2 instance invariably always show a 20.1% steal percentage when I issue the top command?

It quickly jumps down to 0%, but I am curious as to why it claims 20.1% steal literally every time I enter top. Try it yourself... top, q, top, q, top, q... it never fails. Is it actually 20.1% steal or is this a bug with the top command? This is…
darkAsPitch
  • 1,855
  • 4
  • 23
  • 35