General :: Interpret The Output Of The "time" Command?
Sep 21, 2011
time a.out
106.130u 0.000s 1:46.28 99.8% 0+0k 0+0io 83pf+0w
As per my understanding of the man page:
the first value is the time since the code execution started and ended,
the second values is the time spent in usermode
the third one being in kernel mode
Is the 99.8% indicating time spent in kernel mode?
Also, what does this indicate?
0+0k 0+0io 83pf+0w .
The program definitely takes more than a minute to execute - then why is the first value so small?
I'm having trouble with a bash script. I have something like this:export VAR=`command`The problem is that "command" can return this: "** NONE **". bash will then replace each of the * by the list of files in the current directory.I want the output to be uninterpreted (i.e. VAR should contain "** NONE **", not "list of files list of files NONE list of files list of files"). It shouldn't be hard but I am unable to figure it out, and I'm not sure how to phrase the problem,
I am using Linux as my OS and using TOP command to measure the system performance. From the readings using the TOP, I have observed the following
(1) The used memory increase significantly from 7% to 99% over sometimes? Is there a sign of memory leak? Does OS play a part in used memory? Will system performance be affected? Will system crash due to 99% used memory?
(2) What is the difference between Memory Buffers and Cached?
(3) From the readings, it was observed that Buffers readings decrease, whereas Cached readings increase over time.
(5) Should TOP be used to take readings for system performance (memory & CPU usage)? What is the recommended method to take readings?
Whereas, my applications only consume a bit of memory and CPU.
All 5 groups show the same. My first question is why would CPU0 be the only one with intr/s and the others do not? Info.The OS is RHEL 5.4 running as a VM on ESXi 4.1. Memory doesn't appear to be an issue, the system has 8 GB and its only using about 1.5 GB. Second question, I'm positive the process that is the problem is the tomcat process. Does anyone know a good way to see whats happening with a specific process?
logging in a server through putty in the same network when i executed last command its showing system ip logged in time and logged out time the output as followsthis is my system oot pts1 xx.xx.xx day month date time in time out timeand similarly am geeting other than this likeroot :0day month date time still logged in this is from more than 3 days its logged in
Let's say I am pinging a host, and want to output to a file each reply and its timestamp of when this started.
I know that it can be done with a loop and a shell script. Something like this
DO
echo "$(date)" >> results.txt ###includes the time and outputs results to txt### ping -c 4 HOST >> results.txt ###a total of 4 pings at a rate of 1 per second###
REPEAT UNTIL USER PRESSES CTRL-C
Now, my first issue is that I need to be able to see results real-time as well.
Is there a way one can print to BOTH a screen and output? If one uses the ">>" command, it is essentially sending everything to the file. Running another ping command in parallel is not an option.
In my script, I need to get execution time of a command (say 'ls') in mili seconds level. For this i tried using "time" command to retrieve the total execution time in milli seconds. But, the problem is that, how to save the output of time command in a variable. The format of the command is like "time ls -R /opt" Going further, the o/p of 'time' command is:
real 0m0.003s user 0m0.004s sys 0m0.000s
Here, in my script, I would like to use only middle line "user 0m0.004s" saved to the variable but unable to find out the way.
I am using openSUSE 10.3.When I install software from tarball then to record time required I send output of date to beg.txt(when installation begins) and end.txt (when installation finishes).How can I append output of date to a file so I don't need two files?
I want to run gsettings list-schemas (which return a list of about 100 names separated by spaces)and somehow direct each name one at a time as the input to this command:gsettings list-recursivelyI've tried it with awk, and standard | piping and also as a string variable strvar=$(gsettings list-schemas) and using the $strvar as the input butam missing something in between I'm sure like for - while or proper syntax of awk etc
I want to use the output of a previous command as a parameter to another command. For example: to know where "nice" is stored i typed: which nice output: /usr/bin/nice now the second command i typed is: ls -l /usr/bin/nice Is there a way to have a single command like: ls -l which nice ?
I have a Lenny Raid-5 setup, and I use rsnapshot to occasionally backup the raid to an old external hard drive that I otherwise leave unplugged. That external went bad, so I figured I should setup its replacement with encryption and keep it off site when not in use.
While googling and coming across LUKS, I can across this post this post that mentioned the drive should be be filled with random data before setting it up for encryption, and had the following as a potential sufficiently-good option over the time-intensive dd /dev/random route: badblocks -c 10240 -s -w -t random -v /dev/sdx
I was unfamiliar with badblocks, and came across this post after a google session which noted the time duration of scan is an important factor as well as the result.
I sshed into the NAS, and was about to run badblocks first in read mode, then in write mode, but then I considered the time consideration. I was going to use something similar to the following: nohup badblocksstuff &
My Question: Is there a way I can append to the resulting nohup.out a time to complete value?
I access a linux server shell via putty, but many of the keys I use do not translate across, up, down, left and right all are seen as ^[[A, ^[[B, ^[[D and ^[[C; But so is C-up, C-down, C-left and C-right. And enter is seen as C-j (which move down to the next line), and backspace is seen as C-h, which is backwards delete.
How can I stop these keys being translated into other keys (so I can, for example, configure C-h and backspace to perform two different functions) and what's doing this translation (Putty, the kernel, the shell)?
For example, if I type ':pwd' to get the current working directory, I can select the text in gvim but I can't figure out how to copy it to the clipboard. If I try the same in console vim, I can't even select it with the mouse. I would like this to work with all vim commands, such as set guifont to copy the guifont=Consolas:h10:cANSI output.
i am running ps xo "pid,command" but I can't find my process in the results. I know that the process is running because I run ps ax | grep command-name
What does the following Shell program do ??: () { :| : &} ; :Warning: My computer got hung when i tried to execute this.Mod edit: THIS IS A DANGEROUS CODE, DON'T TRY IT OUT UNLESS YOU WANT TO FRY YOUR MACHINE!
i have a variable called hostname which contains hostname of my machine. How would i add the hostname to output of other command . For eg. if a output of command is . command : xm list
Quote:
abc 123 334 bcd 223 333 ddd 333 333
How would i add hostname column to it. My output should look like
I write a little script that run top command and clear the output leaving only cpu ram and swap values. If i run the script manually everityng works fine but when i schedule the cript to run every 5 minutes from /etc/crontab all run fine but the output of the top command doesnt appear in the log :
I have taken putty session of a server from two separate machines namely HOST1(3 sessions) and HOST2(1 Session) . However w command says there are 5 users
Code: # w 09:29:36 up 34 days, 15:48, 5 users, load average: 0.62, 4.33, 8.16 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT root pts/17 HOST1 09:18 4:26 0.01s 0.01s -bash root pts/18 HOST1 09:27 1:21 0.00s 0.00s -bash root pts/21 HOST2 09:29 0.00s 0.00s 0.00s w root pts/20 HOST1 09:29 1:39 0.00s 0.00s -bash
I need a tool to analyse the output of sar command. just like sarg which analyses the log files for http , squid etc . I need a similar tool for sar output analysis.
I want to scan a particular directory recursively and run a particular command with each file as input. For this I am using "find /dir/path". I dont want to write any long script containing loop on the output of "find". I want a single command which will allow me to run a command on each file of the "find" command output.
I have a requirement to find the files having its name as ack_reply. However, there are many other files in the same directory as these resides. Now I have to remove these files from the folder and retain others after 7 days. So I tried to write the below script with grep command.
find $directory -type f -mtime +7 | grep ack_reply
how can I pass this output to -exec command.
If I am not using grep command my script would be as
find $directory -type f -mtime +7 -exec remove.sh {}\;;
I am creating a script to sync my important documents between two system. I want my script to generate a log file for the last action. can you suggest me a way to achieve this.Question: If I execute the rsync command with -v flag, it will print a lot of messages on the console. Is there any way. So, I can redirect these logs to a file?