Questions tagged [time]

`time` is a command line utility for running another program and summarizing resource usage

Filter by
Sorted by
Tagged with
-3
votes
1answer
57 views

How do i take observations with 24 hourly time stamps and write the average the data in a single line with awk? [closed]

I have a series of hourly data. I am attempting to compute a daily average of the 13th column along with condensing the series down to a single data line. Is there a way i can do this in awk for the ...
0
votes
2answers
28 views

Formatting current time

I would like to get time in below format 2020-10-12 10:41:42,526 How can it be done. I tried this but looks not correct date +"%Y-%m-%d %H:%M:%S,%N"
0
votes
0answers
14 views

Handling USER_HZ and the output from cpuacct.usage

I am writing a program that is supposed help run foreign code "safely". I also want to get the memory utilization and CPU compute time for the foreign code so I thought I would use cgroups. ...
2
votes
1answer
45 views

Any way to make system time go slower or faster?

I'd like to make the system clock go slower or faster on Linux. On Windows, there's a very useful freeware called "Time Travel". To get an idea of what it does, just check this image, ...
0
votes
0answers
24 views

Why is systemd-analyze more accurate than dmesg?

It seems dmesg measurement is not reliable since it merely collects output from drivers and other processes. But I'm curious how exactly does systemd-analyze do the job better? I'm not quite familiar ...
0
votes
1answer
21 views

Does running time on an executable significantly increase run time

Does running time on a shell command noticeably increase the runtime of the command itself? After all, since it distinguishes between time spent in user space and time spent waiting for system calls ...
0
votes
2answers
43 views

How to disable caching when using the time command?

When running time on process/application, it seems like it always cache the result/process, and thus doesn't give the real timing of the process. I tried: sync; time process and sync -f; time process ...
2
votes
3answers
120 views

How to profile wall-clock time?

In my program, real time duration is sometimes as much as 3 times that of cpu time. This is a single thread application that does a lot of memory allocation and NFS base read/write. So my doubt is ...
1
vote
1answer
205 views

Wrong time on archlinux

The system is located in Italy, and executing date gives Fri 7 Aug 16:15:56 CEST 2020, whereas the actual time is 14:21:09. Executing timedatectl status gives: Local time: Fri 2020-08-...
2
votes
1answer
44 views

Cronjob timing accuracy - planned time as a parameter

I would like to know how accurate and certain cron timing is. Lets say I got cronjob to run at 11:00:00 and then I pass time as a parameter for this cron job. Would it be possible, in any scenario, ...
1
vote
0answers
14 views

How to retrieve a systemctl service's notion of the “current time” (CRON jobs run two hours early)?

My scheduled CRON jobs run two hours early, although both date and hwclock reports the correct time for my timezone. I've read that a possible solution would be to restart cron.service (CRON) after ...
28
votes
1answer
3k views

These two Bash lines are functionally equivalent. Can someone explain why one is faster?

$ time if [[ $dir2 -ot $dir1 ]] ; then open $dir2 ; else open $dir1 ; fi real 0m0.055s user 0m0.023s sys 0m0.018s $ time [[ $dir2 -ot $dir1 ]] && open $dir2 || open $dir1 real ...
-1
votes
1answer
32 views

How to search in Ubuntu/Linux using two different date?

Please assist. I am trying to search few events in Ubuntu from auth.log and syslog in /var/log/ folder using two different date range, how can I do it? My Code is like below with only one date range ...
0
votes
2answers
33 views

Debian on Synology NAS keeps changing timezone

I have a Debian setup running on Synology NAS Virtual Machine Manager and it keeps changing the timezone. At the top of the screenshot above you can see that the timezone was GMT -4. then, at the ...
1
vote
1answer
61 views

How date command keep tracking time

I got a weird scenario in which the date of my computer is getting the wrong time (and he keeps fixing the time but still keep repeating this issue) let me share with you an example who make this much ...
-2
votes
2answers
65 views

convert milliseconds column to seconds in a csv file [closed]

I have a large tab separated file without headers like this: Tue Jun 09 18:06:53 GMT 2020 1591726013187 Tue Jun 09 18:20:31 GMT 2020 1591726831779 Tue Jun 09 18:09:01 GMT 2020 1591726141456 ...
0
votes
1answer
35 views

Copy latest file from one server to another at specific time

I want to copy a latest file of file.txt from Linux server A to server B at a specific time . It may be a duplicate question but i could not find the solution for this. Everyday I need to wait util ...
0
votes
3answers
85 views

Time elapsed of a bash script (days/minutes/seconds)

Infact when i want to have an estimated time it took when a script is finished. startdate=$date stuffs enddate=$date I wished to get the difference between these two dates and normally the script ...
1
vote
0answers
38 views

Linux Time persist through reboot issue

I have a custom board that houses a System on module(SOM) running linux kernel 4.4.15 The board has an RTC that is backed up via small battery. I have the board running with no network connection ...
0
votes
1answer
21 views

Write only differences with watch -d command

I have to use watch in order to write in a file (doc.txt) the differences between a new version of a file and an older. I tried watch -t -d -n 10 "cat myfile.txt | tee doc.txt" but all myfile.txt's ...
1
vote
1answer
37 views

Why is ls much slower than echo *? [duplicate]

(Inspired by the comments for this question) Why is ls this much slower than echo *? $ time bash -c 'for i in {1..10000}; do ls -f > /dev/null; done' bash -c 'for i in {1..10000}; do ls -f > /...
4
votes
3answers
460 views

iptables rule to unblock internet acess, and block it again 3600 seconds later

I do this, from my son's terminal, to sometimes give him internet access (disabled by default): ./unblockinternet.sh <enter password> with this script: su -c "iptables -D OUTPUT -m owner --...
1
vote
1answer
82 views

Differences between (command) and command in bash

While investigating the problem of redirecting the stderr of the bash keyword time and the standard solution to the problem, I came across another question. The description man bash gives of the (list)...
3
votes
0answers
60 views

Measuring cumulative peak memory usage of multiple parallel processes

Imagine I run a bunch of processes in parallel using xargs and want to measure their cumulative peak memory usage. How can I do that in Linux? GNU time only measures peak RSS of a single process I run....
0
votes
1answer
67 views

Are file modification times in UTC or in the local time zone?

If I touch a new file, I see that its modification time is showing as the current time in my local time-zone rather than in UTC. If I were to copy that file to a machine that's in another time-zone, ...
2
votes
0answers
31 views

bash: pass each command through time command (to measure execution time)

How to pass each command (typed in the shell) through time command? Reason of the question: need to measure execution time of each command (without typing time each time). Example (wanted behavior): ...
4
votes
3answers
163 views

Log background job execution time

I have a script I execute in the background and capture all output with a command like this: nohup bash -x test.sh < /dev/null > log.txt 2>&1 & How can I find out how long it took ...
0
votes
0answers
80 views

wrong time on Virtualbox client

I have a Virtualbox host (6.0.16 r135674 (Qt5.9.5)) on Ubuntu 18.04 with a client running Ubuntu 16.04 with guest additions installed and the guest's time keeps being out of sync with the host. How do ...
3
votes
3answers
77 views

How to `time` a command N times (and be able to use CTRL-C to stop it)

Short question: This is done on a Mac: time for i in {1..10}; do python3 foo.py ; done but CTRL-C won't be able to stop it. How to make it work? (or how to time the running time of N times?) ...
0
votes
1answer
24 views

Does the system need to be at the right hour in order to get a GPS fix

I am using an ARM device on which Debian is installed. A GPS chip is installed on the machine and I use it in my program. That being said, it seems extremely, long, or sometimes impossible to even ...
0
votes
1answer
44 views

Using stat for time or date -r?

I have listed properties of a folder this way stat -c $'-------------- File: %n Size: %s Owner: %U Group: %G Permissions: %A' but I am having ...
0
votes
0answers
179 views

convert mtime to to human-readable date

I have different mtime values, and I am trying to convert them to human-readable date. I am triyng to achieve this using python: import time t = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(...
1
vote
1answer
54 views

How to switch panes in tmux and then begin typing immediately

I can successfully switch panes in tmux with the following command: Ctrl+bleft arrow (or any other direction) However, because I am impatient, I usually want to start typing in the new pane ...
1
vote
1answer
26 views

How to get sleep time of a program

I am trying to collect some statistics for a script that I run on a daily bases. I would like to get the amount of time that is actually spent sleeping. Is there a way to just get the sum of all sleep ...
0
votes
0answers
28 views

Bash: time a command only if successful [duplicate]

I have a command in a repeatedly running bash script for which I need to collect timing info and save in a file. I use the following form: time (cmd >/dev/null) 2>>timing.txt However, the ...
2
votes
1answer
29 views

Block commands at certain times of the day

I was wondering if anyone knew of a way to block certain commands from particular users/groups on any Linux distro (or most, if not all distros) at certain times of the day. What I would ideally like ...
0
votes
2answers
155 views

Which code works (with builtins) both in bash and zsh with the `time` keyword?

It is usual to do time cmd for many types of cmd(s) in bash: $ time true real 0m0.000s user 0m0.000s sys 0m0.000s The output format could be changed (even to a posix format with time -p): ...
3
votes
1answer
424 views

`time <command>` is different in zsh than in bash

Format of time <command> in bash: $time ./test.sh real 0m0.000s user 0m0.006s sys 0m0.000s In zsh: $time ./test.sh ./test....
0
votes
3answers
50 views

Invalid date on one system; perfectly valid on another system?

My code takes a start hour, and then defines a few other date/time variables from that start hour. Like so: shour=$(date -d "yesterday 3PM" -u) dd=$(date "+%d" -d "$shour" -u) sdate=$(date "+%Y%m%...
1
vote
2answers
69 views

Adding time to a time variable

I'm trying to add 3 hours to my time variable like so: today3AM=$(date -d "today 3AM" "+%Y%m%d%H" -u) today6AM=$(date -d "${today3AM} + 3 hours" -u) echo $today6AM Something isn't quite right as ...
2
votes
0answers
60 views

2038 problem behaving differently in different time zone

I am working on 32 bit linux and i understand 2038 problem https://en.wikipedia.org/wiki/Year_2038_problem Anyhow , when i try to use date command to set time beyond 03:14:07 UTC on 19 January 2038 ...
0
votes
0answers
36 views

How to set correct time on Windows and Ubuntu

I'm on Windows 10, with a VMWare guest Ubuntu. Following commands show they have different time, Ubuntu is ahead by 1 second. ~$ ssh ubuntu date +%s;date +%s 1578128791 1578128790 Then I ...
0
votes
0answers
43 views

Timer to know when script ended with total time [duplicate]

I wrote some bash script, which should run approximately around 1-2 hours. I want to add timer that will capture the time that script is running, is it possible ? ./script.bash . . . . TOTAL TIME =...
1
vote
0answers
29 views

time command stdout not working [duplicate]

I ran the time command on Linux and redirected the output to a file time > time.out The above command didn't work. The output time command was displayed on the terminal, the file named 'time.out'...
0
votes
1answer
87 views

Live time in prompt - bash

Is there any way to have the live time in the promt, such that when I execute a command, the time shown is the time the command was executed? So far I'm using S1="[\t me@here]\$ " for example, and ...
4
votes
1answer
63 views

Change perception of real time for one process

I would like to change the perception of real time for one process. Making the process believe that time is passing at 50% or 150% of the speed my system/kernel/hardware-clock thinks. I'd like to ...
0
votes
1answer
66 views

How can I estimate the whole time of a write process including sync?

Progress and estimated time to write without and with sync I have found no tool (or straightforward method) that will include flushing the buffers when showing the progress and estimating the ...
0
votes
0answers
58 views

How can I kill a process if it exceeds a timeout duration while also measuring its resource usage?

I'm currently using GNU time to measure the memory usage and runtime of a program. This is working great. However, I have noticed that in rare cases the program in question never exits, or takes a ...
-2
votes
3answers
98 views

how to build stable NTP server

we have in some room ( with no connection to internet network ) , linux redhat servers we installed the NTP clients based on crhony service on all machines to sync to NTP server now we want to ...
0
votes
1answer
404 views

is it mandatory to configure the allow in chrony.conf

according to the redhat document - https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system_administrators_guide/sect-understanding_chrony_and-its_configuration allow ...

1
2 3 4 5
9