Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [timestamps]

timestamp is used for questions that are about data specifying seconds since the epoch (19700101T00:00:00) or possible some other standard, and also for (date) and time information in filenames.

-2
votes
0answers
44 views

Calculate percentage from two date/time stamps bash

I have two files "DURATION.txt" and "ABCDURATION.txt" which contain ~900 records where DURATION.txt is the total runtime and "ABCDURATION.txt" is a portion of that total. What I need to do is ...
0
votes
4answers
54 views

Calculate date/time difference form entries in two files in bash script

I have two files (STARTED and COMPLETED) that look like this: STARTED FILE: 2018-01-30 10:21:41 2018-01-17 12:22:50 2018-06-27 23:09:20 INVALID INVALID ... for 800 Rows COMPLETED FILE: 2018-01-30 ...
0
votes
0answers
30 views

What time format to use

I am trying to parse an XML-fromatted file. There is a time item with this example format: 2018-11-04T11:01:04.000 What format is this? I need to use a data structure (in Java) to store this format.
2
votes
1answer
25 views

Filter files by string timestamp in filename

I've got a folder with several thousand files with names like ousjgforuigor-TIMESTAMP.txt The timestamp is a standard Unix timestamp (e.g. 1543932635). Is there an easy way to list only files with a ...
-1
votes
1answer
70 views

Script to change the timestamp of files according to filename

I'm in a macOS environment. I'd like to change the time stamp on multiple files that has names that starts with this format: XXXXX_DD_MM_YYYY_HH-MM-SS_ This is an example of a filename: CALLU_16-...
1
vote
1answer
25 views

Logline nanosecond to microsecond conversion

I am loading a data into ElasticSearch and later visualizing it in Kibana. However, the Kibana does not support nanosecond precision. As my file contains 900,000 lines, how do I iterate over it to ...
2
votes
0answers
33 views

How do I display file modification time (linux) as “Nov 8 12:00” format? [duplicate]

The format I want is "Nov 8 12:00". It is the format you get by using the ls -l command. It is month, day of the month, hour and minute. I tried stat -c %Y filename which gives time of last data ...
0
votes
0answers
26 views

How to paste a timestamp (YYYYMMDDHHMMSS) immediately anywhere using hotkey, without reserving the clipboard?

I would like to paste an YYYYMMDDHHMMSS timestamp everywhere with a specified keyboard key or combination. Here is a way to do so: http://www.arcadien.net/node/48 But this reserves the clipboard, ...
1
vote
1answer
33 views

Unknown timestamp format

I do not understand the time encoding of the first line below. I got it in a sample record file and I just have the number but I don't know how it transforms into the corresponding time. This is the ...
0
votes
2answers
35 views

How may I give the current time as the modification time for a file or directory in a tar archive

I want to create a tar archive which will have files and directories. I need to change the modification time of these files and directories so that their modification timestamp is the current date and ...
1
vote
0answers
32 views

AIX auditpr timestamp format

Is there a way to customize the timestamp format that the auditpr command on AIX generates? I am logging to binary, and when I use auditpr to read the binary audit logs, I get something similar to : ...
1
vote
1answer
32 views

Customize “tar --list” date format

This is tar's output when listing files in a tarball: > tar zvtf my.tar.gz -rw-rw-r-- myuser/mygroup 2363 2018-05-03 15:45 test.txt Is there any way to customize the date format to print out ...
13
votes
2answers
555 views

Timestamps of files copied to USB drive

I have a problem with the timestamps of files copied from my PC or laptop to USB drives: the last modification time of the original file and that of the copied file are different. Therefore, ...
3
votes
2answers
414 views

ksh - subtract 5 minutes from current time

I need to get the date and time of the command date minus 5 mins. date: 29 Aug 2018 21:56:01 result: 29 Aug 2018 21:51:02 I tried to search on the Internet/forums but most of it involved using the -...
0
votes
0answers
96 views

Kernel messages in messages log have wrong timestamp. How can I correct CLOCK_MONOTONIC drift without rebooting?

We have a bunch of linux nodes out in the field running a 2.6 kernel. hostname:~# uname -a Linux hostname 2.6.23.1 #1262 Fri Nov 29 07:11:22 EST 2013 armv5teb GNU/Linux Most of them have an uptime ...
0
votes
1answer
55 views

Change a timestamp to epoch use Bash get error like extra operand

I define a variable in my Bash script like: BIRTHDAY="1993-01-11 11:11 +08:00" and convert it to epoches use date then echo with echo $(date -d $BIRTHDAY +%s). However, I get error: date: extra ...
-1
votes
3answers
49 views

Removing directory and it's contents with %Y_%b_%d format

I have created a script which should delete the directories and it's contents older then 2 days. The script is working fine but the directory is not getting deleted. Kindly help, it will be much ...
1
vote
1answer
31 views

Inode Timestamp Plus/Minus Interpretation

What does +0200 mean after the Access/Modify/Change timestamps? File: task-system.md Size: 197 Blocks: 24 IO Block: 4096 regular file Device: 33h/51d Inode: 14155787 Links: ...
0
votes
1answer
66 views

Moving file with wildcard and add timestamp to the file name

I need to move a file to an archive folder, and add a timestamp in front of the file name. mv /dev/DataStage/myProject/source/TEST/MyFile_*.csv /dev/DataStage/myProject/Archive/TEST/MyFile_*.csv ...
2
votes
2answers
85 views

Updating Linux system time programmatically

I have a system of 3 or 4 different Linux Ubuntu machines that I would like to be time synced. My plan is to use one of them (let's call it master) as the NTP server that serves time to the 3 other ...
1
vote
1answer
88 views

Use rsync to only copy files that have changed

Right now I have these commands: my_dir="$HOME/foo/bar"; rm -rf "$my_dir/WebstormProjects/"; rsync -r --exclude=".git" --exclude="node_modules" "$HOME/WebstormProjects/" "$my_dir/WebstormProjects/" ...
9
votes
3answers
120 views

Linux system time temporally jumps

I saw a strange system time changing behavior in some (hardware) servers: in /var/logs/syslog, the date time preceding each log message sometimes change to a random one and gets back to normal in the ...
32
votes
5answers
6k views

Running a loop precisely once per second

I'm running this loop to check and print some things every second. However, because the calculations take maybe a few hundred milliseconds, the printed time sometimes skip a second. Is there any way ...
0
votes
0answers
164 views

How to convert vmcore-dmesg.txt timestamp to human readable format?

I have crash dump log in /var/crash/ directory in CentOS 7.2 system. But timestamp in vmcore-dmesg.txt are not human readable. How to convert vmcore-dmesg.txt timestamp to human readable format? ...
0
votes
0answers
54 views

Wrong/No timestamp on local mountpoint using curlftpfs

I'm mounting an HDD (formatted with ext4) that is connected via USB to my router, enabled as FTP access. I'm mounting a subfolder of the FTP server in a local folder in my home directory. (/etc/fstab)...
0
votes
1answer
45 views

Change creation time of files (RPM) from download time to build time

I am going to create my own internal repository service via createrepo and want to provide an Java repository as well. Downloading the JRE and JDK packages automatically and as described at Stack ...
2
votes
0answers
120 views

Time measurment in Linux kernel: how are clock_gettime, gettimeofday and getrusage related?

I am trying to understand how time is measured by the Linux kernel. I tried to go through the kernel code, but I miss the big picture to understand the code that I'm reading, even if this article ...
0
votes
3answers
675 views

How may I find the most recently modified file(s)?

In a directory, I have a number of files, and I need to do something with the most recently modified file with a .txt suffix. Ideally, I'd like to do myutility "$newest" in the end, where $newest ...
0
votes
0answers
45 views

Unix Timestamp for script input [duplicate]

I have a script to collect errpt data based on Unix Timestamps with start and end range. I can retrieve the current timestamp on AIX using below command and can use it as end timestamp. date '+%m%d%...
0
votes
0answers
59 views

Efficient rsync

Now 5 years after this question was orignially asked, is there a way for rsync to do the following? same time and same size ► skip file (no transfer, no checksum) different sizes ► transfer ...
4
votes
2answers
293 views

Get List of Directories and Timestamp in a specific format in HP-UX

I am on HP-UX B.11.11 OS. My requirement is to display a list of directories only and the last modified time format should be DD-MON-YYYY HH:MI:SS AM/PM. I am able to get the list using either ...
11
votes
3answers
609 views

Performing -nt/-ot test in a POSIX sh

The built-in test and [ utilities have the -nt ("newer than") and -ot ("older than") tests in most shells, even when the shell is running in "POSIX mode" (also true for the external utilities of the ...
0
votes
2answers
99 views

How to compare time in shell script?

I have two time variables. I want to compare it in if statement in shell script. e.g. time1=HH:MM:SS and time2=HH:MM:SS. Format is HH:MM:SS. if [it matched] then echo "matched" else echo ...
2
votes
1answer
112 views

How to remove temp files without changing the directory's modification timestamp?

I work on testcase, each of being a subdirectory of ~/test. It's convenient to see which were the testcases I worked most recently using something like ls -rtl. Now I'd like to remove certain ...
2
votes
1answer
111 views

Dash “-nt” behavior

The use case I can think of for -nt, would be updating a file if it is too old, or if it does not exist. Bash handles this just fine: $ bash -c 'touch 2.txt; sleep 1; touch 1.txt; [ 1.txt -nt 2.txt ];...
0
votes
1answer
550 views

'ls' output timestamps different for “old” files in /tmp versus in home directory

I'm ssh'd into my university Linux servers (RHEL 7). My question has to do with 'ls' and "old" files. Home directory: $ touch -d '1918-11-11 11:00 GMT' wwi-armistice $ touch now $ sleep 1 $ touch ...
1
vote
1answer
1k views

Add 5 minutes to date in bash

I've seen that the "date" command can do powerful manipulation of timestamps, but I'm not quite getting it to work right. Can anyone help explain the output below, and suggest how I could get the ...
1
vote
1answer
71 views

How to delete content of file between time range. (Not on the basis of pattern matching)

I am trying to delete the content of the file on the basis of time range.So far i have tried on the basis of the pattern matching as below: sed -i '/2018-03-09T13:53/,/2018-03-09T14:00/!d' ...
0
votes
2answers
457 views

Redirect stdout / stderr output to log file with timestamp

I'm trying to redirect the stdout and stderr to a log file. The filename should be created dynamically with current timestamp. I can create the filename with the following command: $ date +%Y-%m-%d_%...
2
votes
0answers
62 views

Alternative to debugfs for Android environment

For the purposes of retrieving a file's creation time (if available), I'd use debugfs. Unfortunately, debugfs is not part of most Android distributions. Are there any similar, more ubiquitous ...
0
votes
2answers
900 views

How to list files within date range at cli [duplicate]

Can one pls tell a proper to list files within date range on cli. Say between Feb 20 to Mar 2 then mv these files to another dir. Thanks
0
votes
2answers
177 views

Match the nearest timestamp in milliseconds

I have a large data.txt file as below; for every timestamp, I need to find the nearest time match 5 minutes later and the value on column 4. Now print both in two new columns. for example for "2018-...
0
votes
2answers
3k views

Current time/date as a variable in BASH and stopping a program with a script

I am trying to create a raspberry pi spy cam bug. I am trying to make it so the new file created for the various processes come up with NOW=`date '+%F_%H:%M:%S'`; which works fine. but it requires ...
1
vote
1answer
57 views

how to write a script for running a stat command for a directories and sub directories and print only most recent file

how to find most recent files in a directory? my script is giving some extra outputs with most recent file in the directory. #!/bin/bash echo "Please type in the directory you want all the files to ...
0
votes
0answers
249 views

Setting the creation time of a file on a CIFS share

I'm trying to replace an old Windows laptop I've been using as a "sneakernetting station" to copy files from NTFS-formatted hard drives to a Samba share using the WIndows robocopy utility. rsync is a ...
10
votes
2answers
508 views

How can I use files from HTTP as prerequisites in GNU make?

I want to use files from the World Wide Web as prerequisites in my makefiles: local.dat: http://example.org/example.gz curl -s $< | gzip -d | transmogrify >$@ I only want to "transmogrify" ...
1
vote
1answer
606 views

Moving directory without modifying timestamp

I would like to move a directory from one location to another but when I do I can see that the timestamp gets changed. Is there any way to retain the timestamp as original? Have looked at the man ...
2
votes
1answer
4k views

Convert epoch time to human readable in LibreOffice Calc

I have a epoch time in cell H2 which has a value of 1517335200000. I am trying to convert it to a human readable format which should return 30/01/2018 6:00:00 PM in GMT. I have tried to convert it ...
4
votes
2answers
214 views

Set directory timestamps to most recently modified file within (recursively)

How do I change the timestamp of a directory and all the sub-folders within that directory to reflect the modification times of the contained files? For example with this directory structure: [Jan 9]...
10
votes
4answers
738 views

will `ls -lt` follow the accurate mtimes or just the approximate mtimes up to second?

ls -l only shows the modification timestamps of the files up to second. If two files have the same timestamp up to second, but were modified not exactly at the same time, will ls -lt order the files ...