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.

learn more… | top users | synonyms

68
votes
15answers
11k views

What are the legitimate uses of the `touch` command?

What's the point of the touch command? I know I can create empty files with it, but so is also the case with echo -n. Otherwise, why would someone need to change the timestamps of a file? Unless to ...
0
votes
1answer
132 views

Where does bash store the time commands were executed?

Enabling history to display time via export HISTTIMEFORMAT='%F %T ' shows the times of the commands but .bash_history doesn't contain any times. Where does bash store the times the commands were ...
3
votes
2answers
559 views

Identify and assign most recent file to shell variable

I have a directory of .jpg files that continuously grows. I want to copy the most recent one elsewhere. This is what I currently have and it works, just curious if there's a better way to identify the ...
1
vote
1answer
109 views

touch and tar from a text file

Am trying to zip a certain number of files and am stuck at below point, ls -lrt /lag/cnn/*/*/*/adb.tar.gz | grep -nri ABC >> sample.txt In sample.txt i got filesNames on which i have to do ...
1
vote
2answers
1k views

How to log Serial data with time stamp?

I have an Arduino sending serial data to the computer. I'm able to view the data using a Serial console. But, I want to be able to log it with time stamp. I want a ready made script or program that ...
7
votes
2answers
317 views

What counts as a file modification or change?

Does renaming affect the file modify or access time? Is there a list somewhere of what changes which times?
3
votes
2answers
88 views

Is there any mitigation against touch date/time forgery?

I have been using touch -t to change time of a file when I started using Linux, is there any mitigation against touch date/time forgery? Like, echoing original created date and time, even after using ...
3
votes
4answers
1k views

get age of given file

How can I get the age of a given file in, at least, days? I'm well aware of ls -lh and similar commands. I want something that will work sort of like this: getfage <FILE> # prints out '12d' ...
4
votes
3answers
283 views

What could be the use case of changing modified time of a file to the future?

I was reading through the man page of ls on UNIX, specifically OS X Mavericks. This got me intrigued: If the modification time of the file is more than 6 months in the past or future, then the ...
3
votes
1answer
187 views

Chrony 506 Cannot talk to daemon

I'm having trouble configuring chrony to sync the time between my raspberry pi and a desktop computer in an isolated network. My raspberry pi's chrony.config file looks like this: server master ...
2
votes
1answer
212 views

Why Linux syslog file does not follow the RFC3339 protocol?

Why Linux syslog file: /var/log/syslog does not follow the timestamp format defined in the protocol http://tools.ietf.org/html/rfc5424#page-11?
1
vote
1answer
223 views

How can I finding the Modify/Access/Change time of a file or directory? [closed]

I am using Debian 7.2 and would like to know the shell command for finding the MAC time of a file or directory. I tried man -k "MAC" and got a lot of hits about macros. I then tried man -k "MAC ...
4
votes
4answers
3k views

Convert Unix timestamp into human-readable format on AIX

I need to convert unix timestamp (number of seconds since 1970, e.g. 1381260225 is Tue Oct 8 19:23:45 GMT 2013) into a standard human-readable format. I could get some answers by googling but those ...
20
votes
6answers
21k views

How to find creation date of file?

I want to find out the creation date of particular file, not modification date or access date. I have tried with ls -ltrh and stat filename.
2
votes
1answer
284 views

Hardware Timestamping using PTP

I'm new to Linux programming. I have an Intel NIC with e1000e driver. I'm working on accurate time stamping of packets being captured from a network. My question is if I want to use RT Linux how ...
1
vote
3answers
213 views

How to ensure File System is Mounted with ' atime ' enabled ?

Let's run mount /dev/mapper/VolGroup-lv_root on / type ext4 (rw) proc on /proc type proc (rw) sysfs on /sys type sysfs (rw) devpts on /dev/pts type devpts (rw,gid=5,mode=620) tmpfs on /dev/shm type ...
7
votes
7answers
2k views

timestamp before an echo

Exists a nicer way to create timestamp in front of an echo? Currently I do it this way: #!/bin/sh if mount | grep -q /mnt/usb; then echo `date +%R\ ` "usb device already mounted" else ...
3
votes
3answers
3k views

How can I change the date modified of a folder to the last changed file inside? [duplicate]

In my media center directory all modified times of my folders are somehow not the desired date. How can I change all modified times of the main folders to the modified time of the newest media-file ...
0
votes
2answers
88 views

Programmatically get folders last edit time

How can I programmatically get a folders latest edit? I have already written the following script: #!/usr/bin/perl my @ls_command_result=qx(ls -l); my @the_folder=grep /folder_i_want/, ...
1
vote
1answer
80 views

GNU date epoch +%s vs. now in timestamp phrases with computations including months?

I am trying to do date computations in a shell script using gnu date with timestamp phrases and fail to explain these differences. Can someone enlighten me? Is this a bug? % date -u -d "now" Fri Aug ...
1
vote
1answer
1k views

How to set system time from Unix timestamp

I know arbitrary timestamp and I want to set system time using it. I've tried following: date +%s -s "1371729865" date +%s -s '1371729865' date +%s -s 1371729865 but without success. The idea is, ...
1
vote
1answer
431 views

Attaching the time-stamp to the name of a log file

I have a Makefile which I invoke using the following command: $ make analyze foo=History01 I have the following Makefile and I need to attached the timestamp to the name of the log file: ...
4
votes
2answers
318 views

Extract timestamp from a gzip file

How can I know the raw original timestamp of a file foo compressed with gzip without having to decompress foo.gz? gzip --verbose --list foo.gz and file foo.gz will print formatted date and time.
5
votes
1answer
259 views

What does the “00:00:00” timestamp mean in kern.log?

I'm looking for causes of a particular problem in kern.log. There are many entries with a 00:00:00 timestamp: Jun 11 00:00:00 mymachine kernel: [ 0.000000] Initializing cgroup subsys cpusetJun 11 ...
17
votes
3answers
2k views

How does touch -t work internally?

How does touch -t command works exactly, internally (I tried to find its source code but couldn't)?
14
votes
2answers
991 views

How long is the password for executing a command with sudo cached?

If I run a command which requires root privileges with sudo, I will be asked to enter the current user's password. After that for a while, if I execute the same sort of commands with sudo, I won't be ...
4
votes
2answers
414 views

Sort files by modification time

I've seen many questions and answers here using a construction along the lines of list_dir=`ls -t /path/to/dir/` for i in $list_dir; do or ls -t | while read i; do Now, I know that you shouldn't ...
1
vote
1answer
2k views

Comparing file times in ksh

I have developed a script which will compare two dates. #!/bin/ksh #################################################################### # #DECLARING ALL THE VALUES AND PATHS # ...
1
vote
1answer
48 views

SVN wants to commit everything after server re-install

the motherboard of a dedicated server I'm renting since five years went south and the motherboard got replaced by a new one. The very old (Debian) distro couldn't keep up with all the new hardware on ...
10
votes
4answers
9k views

How to get milliseconds since Unix epoch?

I want to do a bash script that measures the launch time of a browser for that I am using an html which gets the time-stamp on-load in milliseconds using JavaScript. In the shell script just before i ...
2
votes
1answer
575 views

rsync and backup and changing timezone

I back up my pictures from my camera using rsync, using: rsync -vzrtl --progress --stats --timeout=0 host destination Now I was in a different timezone when I did my first backup then I moved to a ...
0
votes
2answers
2k views

Solaris 10 modified time

In Solaris 8, when we access the file, the access time changes but modified time remains same. But in Solaris 10, we see that both access and modified time changes when accessing the file. We checked ...
4
votes
2answers
6k views

list all files newer than given timestamp and sort them

I want to list all files (sorted by date) that are newer than timestamp in format 20130207003851 in directory /tmp only. Subdirectories can be omitted. Using SUSE Linux Enterprise Server 11. The ...
7
votes
4answers
3k views

Changing the timestamp of a symlink

I know how to change the timestamp of a regular file: touch -t 201301291810 myfile.txt I was not able to do the same with a symlink. Is it possible? Distro: RHEL 5.8
1
vote
1answer
569 views

Validate Unix Timestamp using BASH

My google-fu has failed me so I'm hoping someone here can point me in the right direction. I'm in the middle of doing some data validation efforts and I suspect the system is recording some invalid ...
0
votes
2answers
230 views

I want to add the above date to each line on a prstat log file

I have a prstat log, as you all know the date and time is recorded on the top of the log file, I would like to add that date and time to the begging of each line until it gets to a new date, then I ...
0
votes
1answer
928 views

Whats the most efficient way of adding milliseconds to this code?

#----------------------------------------------------------------------------- # # Get time string # #----------------------------------------------------------------------------- # sub formatTime ...
1
vote
1answer
518 views

Why ls -lrth and ls -ltch gives different results

I was trying to find the time of database backup. Normally i use ls -ltch But this time i used ls -lrth It gave me different result for One file and all date-stamps were same for both ...
2
votes
2answers
7k views

Solaris + display file time stamp [year][month][day]

I have Solaris 10 machine I need to verify time stamp of some file in my Solaris machine And to get the following format [year][month][day] Example of working command on Linux ls -l ...
7
votes
2answers
6k views

How to find difference between two timestamps up to milliseconds?

I am new to shell scripting. The heart of my script is to find the difference between two timestamps up to milliseconds. With me I have a file with content of timestamps only as 2012-09-13 ...
3
votes
1answer
350 views

How can I get high-precision timestamps (better than 1s) with Samba?

I did a quick test and got the results below. Whats with the horrible time resolution? Is there a way I can make it better? creation 129971441605098285 mod 129971442166583272 a.ToFileTimeUtc() ...
2
votes
2answers
357 views

Why sudo timestamp is not updated when NOPASSWD is set?

I've set up sudo not to prompt for password by editing the sudoers file: myuser ALL=(ALL:ALL) NOPASSWD: ALL And it works fine, running sudo with no password prompting. But when entering sudo -v I ...
3
votes
4answers
1k views

Modification and Access time of a file?

Is it possible to change the file modification time without changing the file acess time?
1
vote
1answer
1k views

rsync error: Time value of file truncated on receiver

I run the following rsync command to back up my data. I am on Ubuntu 12.04. rsync -rt --delete --links --exclude-from '/home/john/rsync-exclude.txt' /media/data/ server:/backup/data The data ...
0
votes
2answers
773 views

Correct timeline of a .ts file

I have some MVs that is recorded from a TV, but timeline was incorrect somehow: Anyone know some tool that can fix it ? The media plays fine, just the displayed stuff doesn't look good
4
votes
5answers
22k views

Display time stamp in dd/mm/yyyy_hh:mm:ss:ms in Unix or Linux

I need help to display date and time in desired format in Unix/ Linux. My desired format is: dd/mm/yyyy hh:mm:ss:ms in Unix or Linux. I got close using the following command: echo $(date +%x_%r) ...
1
vote
1answer
426 views

rename files maching specific mtime value within directory

I use simple set of shell commands to in order to create mysqldumps daily. The script is called by cron daemon. It looks like: presentdate="`date +%d-%m-%Y_%H:%M.%S`" basedir="/var/db_my_backup" ...
1
vote
2answers
352 views

Remove oldest folders + files (50GB) from a folder when share/HD reaches 95% full capacity

I have a big share (~5TB) that is getting full. Now I want to make a script that deletes data from 2 specified folders. But this need to be the oldest files/folders and it need to stop when ~50GB has ...
17
votes
4answers
1k views

Finding command execution time in hindsight

I've just executed a long-running process from the bash prompt. In hindsight, I wish I'd run time on it, or noted down the time at which I kicked it off. Is there any way of getting this information ...
10
votes
4answers
2k views

Preserve modified time stamp after edit

For files within a specific folder, I would like vim to never touch "modified" timestamp at all. The background is that I use Bloxsom for blogging, which uses plain text files in ~/bloxsom as source ...