Stack Exchange Network

Stack Exchange network consists of 175 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.

0
votes
1answer
39 views

How to prevent `atime` in Linux from overwriting `Date created` in Windows on NTFS?

From Linux, if I alter files on an NTFS external HD so that I get some specific values for mtime, atime and ctime (readable with the stat command, and with ctime = mtime because one cannot change ...
0
votes
1answer
9 views

ausearch how to specify both time and date

I can run ausearch based on time: sudo ausearch --start '16:48:07' or date: sudo ausearch --start '05/07/2019' but not both: > sudo ausearch --start '05/07/2019 16:48:07' Invalid start time (...
1
vote
0answers
15 views

Timestamp retrived with `date -r file` does not fit the time order of commands [duplicate]

I was playing around with the command date to create timestamps and profile the execution of a script. I decided to set four of them, named t1 through t4. For t2 I created an empty file whose last ...
0
votes
0answers
24 views

Inconsistent timestamp in exFAT volume on macOS and Linux

To read exFAT volumes on Fedora, I installed the fuse exFAT package from rpmfusion repository on my Fedora computer at work. I maintain a few webapps in my exFAT USB drive so that I can work on them ...
0
votes
2answers
24 views

Showkey with timestamp

How can I record keyboard actions with the timestamp, either to console, or preferably to a file? I have showkey output like: keycode 28 release keycode 30 press keycode 30 release keycode 48 ...
0
votes
1answer
39 views

Sync 1pps sync with system clock

We need to use 1pps (gpio source) for timestamp in application. I thought that ntp should be used with the linux pps for this purpose. But the system is standalone without any other servers connected....
0
votes
1answer
45 views

Why is my files “last modified” timestamp only showing the year with the 'ls' command? [duplicate]

I'm building a java service that modifies the "Last Modified" field of some of the files it works with. The service keeps copies of files in a folder, it periodically checks a database for changes, ...
1
vote
2answers
33 views

modify time for extracted folder

I just (today is 31-jan-2019) downloaded some random source.tar.gz and extracted it. When I do stat on the resulting folder, I see: Access: 2019-01-31 10:37:26.308991485 +0100 Modify: 2018-11-18 00:...
5
votes
3answers
70 views

Comparing the time of a symlink

I want to check whether link lnkfile is older than a regular reference file reffile. The bash test builtin dereferences links, so test lnkfile -ot reffile compares the target of lnkfile, not the link ...
0
votes
4answers
60 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 ...
2
votes
1answer
89 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
78 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
28 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
34 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
69 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
58 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
41 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
53 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
45 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
756 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
753 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
1answer
130 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
57 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
61 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
255 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
186 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 ...
2
votes
1answer
597 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
224 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 ...
33
votes
6answers
7k 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
1answer
97 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
217 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
1k 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
57 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
2answers
119 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
437 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 ...
12
votes
3answers
725 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
149 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 ...
3
votes
2answers
237 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
188 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
566 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
2k 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
74 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
797 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
88 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
1k 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
190 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
6k 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
183 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 ...
10
votes
2answers
646 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" ...
2
votes
1answer
1k 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 ...