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.

Filter by
Sorted by
Tagged with
3
votes
5answers
167 views

How can I sort a list of directories alphabetically and get the first value that sorts after a specific string?

I have a directory full of backup folders, with names in the format yyyy-MM-dd--HH:mm:ss If I enter a date in the same format, is there a way to get the first directory that sorts after it, and copy ...
0
votes
2answers
36 views

Compare date and timestamps

I am trying to compare two timestamps and if x is greater than y then do some action. I tried it with bash on my Linux machine but I get an error "invalid date" here is my code: #!/bin/bash x='2020....
0
votes
2answers
27 views

Convert mm-dd-YY to Timestamp at Midnight UTC

I need to convert a mm-dd-YY string to a UNIX timestamp for use with HubSpot's API. Said API requires that dates be set to midnight UTC. I can convert the date using: date -j -f "%m-%d-%Y" "01-20-...
0
votes
0answers
9 views

locale timestamp causing overflow when executing python script

I'm trying to run a python script I wrote on my Raspberry Pi Zero, but I keep getting the error OverflowError: timestamp out of range for platform time_t. I'm relatively certain it's something with ...
0
votes
1answer
75 views

Compare timestamps

I am trying to compare timestamp of the latest modified file towards current time and if the diff is more than two hours I am trying to print that out. How can this be done? The following command ...
0
votes
0answers
18 views

ksh not saving history in it's HISTFILE and HISTTIMEFORMAT not working

I have created a custom shell script and put it inside /etc/profile.d/ that declares the HISTFILE. It works on bash and sh however it does not seem to work in ksh. As can be seen below, it gets the ...
0
votes
1answer
56 views

Grep - return different line sized contents after a match

I need to find a way for grep to return different line sized contents after a match. Some matches have 4 lines after them, other have 20. I need them all. Every hour I am looking to return the ...
2
votes
2answers
36 views

Get last X minutes of log file that has particular timestamping

I am trying to go through an IPA host's log file to grab the last five minutes of content and get updates on things like new user creations or DNS changes. I want to cron this so every five minutes it ...
0
votes
1answer
21 views

strftime - ignore empty fields

input sample: one two 1578678600 awk command: $ echo -e "one\ntwo 1578678600"|awk '{print $1,strftime("%Y-%m-%d %H:%M:%S", $2)}' one 1970-01-01 00:00:00 two 2020-01-10 17:50:00 How strftime could ...
0
votes
2answers
38 views

Force the stdout, stderr logging with timestamp

I have a Raspberry-Pi based device that takes input from switches and sensors connected to its GPIO, as well as from Arduino connected via TTY serial. The main app managing all this is written in ...
0
votes
2answers
41 views

list filenames stored in text file with a certain timestamp

I have stored a couple of file names in a text file by the name new1.txt in my home directory, now i'm using a loop to list all the files in the directory they are present in. I am able to write the ...
0
votes
1answer
36 views

use one date variable but format it different ways

In a shell script, there are the following variables: datestamp=$(date '+%Y-%m-%d_T%H-%M-%S') datestamp_pretty=$(date '+%m/%d/%Y at %I:%M:%S %p') The first one is used as part of the output filename ...
0
votes
1answer
42 views

Extract last lines of a logfile by time

tail -n 100 myfile.log gives my the last 100 lines of myfile.log. Is there an existing tool that expects the first "column" of each line in a file as a timestamp and can give me the n last hours/...
0
votes
3answers
60 views

Transform Timestamp inside of the text file

I extract the tables from UDB to local into csv file format. After I extract it, my time stamp which shows up multiple times is messed up. I would like to write shell script to update it when it sees ...
2
votes
1answer
368 views

Timezone correct, UTC correct, time still wrong

I have an AWS EC2 server running Amazon Linux (like rhel fedora) which does not know how to tell time, or is somehow not accounting for Daylight Savings Time. This makes all of my timestamps off by 1 ...
16
votes
7answers
2k views

Convert Unix timestamp to human-readable time

I would like to view a text file with awk/grep which contains a Unix timestamp in the first column. How can I convert it to a human-readable time while viewing?
1
vote
1answer
27 views

List of files (the ones in subfolders included) older than a certain date

On a Unix server (Solaris) I would like to have a list of file like the output of ls -lrtR (i.e. all the files of a folder, included the ones in the subfolders, with the indication of their path and ...
1
vote
2answers
86 views

How to work with date command in a bash script through variable

I have a file with specific dates and i want to convert them to UTC format. so I prepared a small script I get below errors: date: option requires an argument -- 'd' Try `date --help' for more ...
0
votes
0answers
23 views

How does htop calculate times? (Impossible times shown)

I was running what was supposed to be a small make job on a small node in our cluster, but a sorting process seemed to be overwhelming the allocated RAM, so I killed it after 20 hours (same jobs on ...
0
votes
1answer
43 views

Is there a cross-platform “time units separation” standard?

When I create backups with date I usually put the current date as part of a backup file in the format of: year-month-day-hour:minute:second so I get a file like: database-username_database-name---...
0
votes
2answers
38 views

Can we find in history command the dates & timing of the command execution [duplicate]

This command does not give time & date when command was executed. Is this possible to check date & time with history command or other command. $ history 1 cd /strswork/strsapp/...
3
votes
1answer
55 views

List of files with a certain suffix in my path and its subdirectories, listed with their last update date

On a Unix server (Sun Solaris), with ls -lrtR I get the list of all the file in my path and its subdirectories with their last update date. With find . -type f -name "*.sas" I find the list of my ....
0
votes
1answer
75 views

How to add timestamp to file in script

I'm a newby in making scripts and need help in making a timestamp to the file domoticz.db so the output will be $DEST_FOLDER/domoticz.timestamp.db in the following script: #!/bin/bash DEST_FOLDER=...
1
vote
1answer
134 views

Logging rotation using logrotate and timing

I have just set up a fairly extensive logging and logrotation operation on a system, to hopefully eliminate or at least minimize the risks of out-of-space errors (possible vulnerabilities?). However,...
1
vote
0answers
87 views

How to measure software + hardware latency using tcpdump? ( Hw Timestamp)

I have an low latency application.But it's performance is unstable. So i want to find the bottleneck if it's related to network or related to my server ( software , os etc.) So first i tried tcpdump ...
0
votes
1answer
74 views

how to add timestamp to stdout and stderr from a crontab job?

I want putting timestamp traces into two different files when I call to the script from a cron task. One file is for stdout script.log and another for stderr script.err With this cron line I get ...
2
votes
1answer
85 views

How to change a file name containing “:” in timing info

I am learning Linux commands. When rename the file name with timing info, there are : marks automatically assigned. how can I change this : sign to _? Below is a file name example. It was updated ...
1
vote
0answers
26 views

Change timezone of mov files

I forgot to set the correct timezone in my camera during a vacation and now the times are all off by 7 hours. To correct this for the image files I used exiv2 -a -07 adjust *.JPG which changes the ...
1
vote
0answers
26 views

Can you set a file's ctime to min(ctime, mtime) [duplicate]

We know that the mtime of a file can be earlier than the ctime when you make copies of files (or, in my case, move files between file systems without successfully retaining timestamps). I see many ...
1
vote
1answer
85 views

How to check the timestamp of a symbolic link?

Is there a way to use traditional commands to update a symlink when it's older than the original file? I use a Seafile server (similar to Dropbox) to make certain files available to my students. So I ...
2
votes
2answers
123 views

Why cannot I set the date of my GNU/Linux machines to the Epoch?

Both on a Raspberry Pi and on a Ubuntu 16.04 x86_64 machine I have access to, running # date -s @0 returns date: cannot set date: Invalid argument thu 1 jan 1970 01:00:00 CET and I wonder: what ...
0
votes
1answer
471 views

Get mtime Epoch timestamp with milliseconds from `stat`

If I'm using stat to display the mtime, I get a date with milliseconds: $ stat -c '%y' test.log 2019-07-04 14:32:10.730059167 +0200 However, if I want to display the Epoch timestamp, I don't get ...
1
vote
1answer
31 views

How to move files with a particular timestamp in linux?

I want to move some files from /usr/local/packageA directory to /usr/local/packageB directory. I accidentally installed both the packages in the same directory and want to move the files which were ...
2
votes
1answer
46 views

Can we preserve the timestamp of parent directory after modifying the files inside it?

I have a folder structure: /home/us3r/scripts I've some scripts inside the scripts folder. Now, i want to preserve the timestamp of the scripts folder even if someone does a vim and saves any of the ...
0
votes
0answers
19 views

How do I display the timestamp of history file from another machine

How do I display the timestamp of history file from another machine. I review logs and sometimes it is helpful to see what commands the users were running. When I view the bash_history file from ...
0
votes
0answers
17 views

How to know the download date of a zip folder

I downloaded a zip file which contains a .csv file (DOS format, i.e. I needed to convert it using dos2unix). I need to check the data (at least the day/month/year) which I downloaded the file in. ...
1
vote
1answer
94 views

A simple way to update the access time of multiple files

I have a folder with several sub-folders and files. I work on a server where any files that are older than 60 days are automatically deleted. What are some simple commands to update the access time (...
0
votes
2answers
61 views

Converting date's default output to Unix epoch

If I run date without any options, I'll get something like this as output: Sun Mar 31 01:05:19 CDT 2019 Is there anyway to convert that to what I would have gotten if I had typed date +%s?
1
vote
1answer
1k views

how to grep in the output of ls -a

I'd like to grep the output of ls and pipe it into less so I can scroll through the output. This doesn't work, but ideally, I'd be able to type this: ls -alh | grep "file" | less Any suggestion ...
0
votes
1answer
107 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
535 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
17 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
50 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
49 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
153 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
292 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
57 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
152 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
67 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
233 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 ...