The tag has no wiki summary.

learn more… | top users | synonyms

3
votes
3answers
675 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
225 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 ...
2
votes
1answer
152 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
189 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
187 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
2k 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 ...
19
votes
5answers
16k 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
220 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
169 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
2k 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
83 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
65 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
778 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
374 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
275 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
237 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
874 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
280 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
47 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 ...
9
votes
4answers
7k 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
531 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
1k 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 ...
3
votes
2answers
5k 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
2k 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
520 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
208 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
810 views

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

#----------------------------------------------------------------------------- # # Get time string # #----------------------------------------------------------------------------- # sub formatTime ...
1
vote
1answer
481 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
6k 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
5k 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
328 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
347 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
728 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
19k 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
407 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
342 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 ...
16
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 ...
2
votes
3answers
1k views

How do I mass-convert the “last modified” dates in a particular directory?

For example, say, I know that my time-offsets are off by several hours (perhaps because my system clock was a few hours ahead at a certain time). In that case, how would I mass-change the "last ...
2
votes
2answers
325 views

find command for the newest 500 files in a directory tree and also be POSIX compliant

I am looking for a single line shell script or unix command to find the newest 500 files in a directory. Major constraints are it should be POSIX complaint and the directory can have tons of files.
3
votes
1answer
2k views

See if file has been copied to USB

Is there a way to see if a file has been copied to an USB drive? (Ex: I have the file secret.db and I suppose that my friend has copied it into his USB drive. With stat $filename I cannot see the ...
5
votes
1answer
1k views

Get “date” to understand a timestamp phrase of a different language

My web-scraping scripts have long enjoyed using date -d to read in human-formatted time and date stamps like "March 11, 1999" and convert to any other format I need via the -s parameter. How might I ...
3
votes
3answers
5k views

How can I change 'change' date of file?

How can I change 'change' date? $ touch -t 9901010000 test;stat test File: `test' Size: 0 Blocks: 0 IO Block: 4096 regular empty file Device: fe01h/65025d Inode: 11279017 ...
6
votes
7answers
2k views

Bash, remove oldest files

I`m trying to delete old files from directory and leave only 3 newest files. cd /home/user1/test while [ `ls -lAR | grep ^- | wc -l` < 3 ] ; do rm `ls -t1 /home/user/test | tail -1` ...
5
votes
1answer
1k views

On what occasion will inode change?

I checked manual of find , and there's an option -ctime which specify the last modification time of inode. But on what occasion would inode change ? When is that option useful ?