Tagged Questions

Date is a command line utility for printing or setting the date and time.

learn more… | top users | synonyms

3
votes
1answer
116 views

Generate time as expression of 1/1000ths of the day

Completely new to bash and having trouble working out how to make the arithmetic work. I think this should be easy, it's just.. argh. I want to express the time of day in terms of 1/1000ths (ie, ...
5
votes
1answer
259 views

Remind syntax combining a weekly event with a time range

How should I write "Every Tuesday, Thursday, Friday after 2011 Sep 13, but before Sep 28, with reminder 1 day before event". Now I got REM Tue Thu Fri 13 Sep 2011 +1 UNTIL 28 Sep 2011 MSG Esem, but ...
9
votes
3answers
2k views

How to use the date command to find out what date “monday week 40” will be?

How can I use the date command to convert something like "monday week 40" into a ISO date? I am playing with something like this: date --date='monday week 40' +'%Y-%m-%d' And the date I'm ...
2
votes
3answers
3k views

How to feed the results of date command into grep to filter results of another command

I need to use the result of a formatted date command (date +"%m/%d") as the grep filter to filter the results of another command that will display alerts on a system so that I only see alerts from the ...
2
votes
1answer
946 views

Need help converting a string from a file into a date

I'm trying to read a string from a file and then convert it into a date but for some reason it's failing. I'm actually modifying a GeekTool Geeklet that's not working at the moment. It reads a file ...
8
votes
1answer
3k views

Is there a way to adjust the formatting of the date/time in the GNOME 3 login screen and desktop?

I'm specifically looking to change the formatting in two places: On the desktop, the date/time reads "Sat 21:05". I would like it to read "23-Jul-11 21:05" or "23 Jul 11 21:05". In other words, I ...
3
votes
1answer
437 views

bash: cd to the most recently modified child directory

Wondering if there's an easy and/or portable way to say "change to the most recently modified child directory." I can use ls and awk but there's probably a better way. cd $( ls -ltrd */ | tail -1 | ...
9
votes
2answers
1k views

How can I delete all files in a folder that haven't been accessed in a certain amount of time?

I'd like to run a nightly cron job that deletes all the files in a folder that haven't been accessed in a week or more. What is the most efficient way to do this in bash?
-1
votes
1answer
2k views

Sum of grep results

I need to output the sum of a grep results for a certain time, for now i hard coded the time grep but any help will be very much appreciated, my problem is i cant output the results on the script. If ...
3
votes
1answer
1k views

using system command in awk script

In an AWK script I am using a command system(date) to print the current date in a file but after this command is executed next line is also added implicitly. Is there any way in AWK to print ...
8
votes
4answers
617 views

Forcing an 'added' alias to every command

Is it possible to forcibly add a timing alias (for lack of a better way to phrase it) to every command in bash? For example, I would like to have a specific user who whenever a command is run, it is ...
4
votes
3answers
367 views

Setting linux time

$ date 042612492005 $ hwclock -w The code above shows how to set the system time, but how's the timestamp string generated in the first place?
1
vote
3answers
1k views

Highlight the current date in cal

I would like to highlight today's date in the output of the cal command. What is the best way? This is what I have so far: cal -m | grep -C6 --color "$(date +%e)" but it doesn't work for all cases ...
1
vote
3answers
1k views

How many minutes have passed since the Unix Epoch?

Sorry for the lame question How many minutes have passed since the Unix Epoch ? It should be January 1, 1970 ? Let's say approximately until 1 Jan 2011... 5 865 696 000 minutes ?
12
votes
4answers
14k views

How to list files sorted by modification date recursively (no stat command available!)

How can I get the list of all files under current directory along with their modification date and sorted by that date? Now I know how to achieve that with find, stat and sort, but for some weird ...
15
votes
4answers
15k views

last time file opened

Is it possible to get the time when file was opened last time and sort all files in a directory by those times?
6
votes
3answers
15k views

Getting all files that have been modified on a specific date

Is it possible to find all php files within a certain directory that have been modified on a certain date I'm using find /var/www/html/dir/ -mtime -28 | grep '\.php' to get files modified within ...
13
votes
4answers
6k views

How can I avoid “Run fsck manually” messages while allowing experimenting with system time changes?

I'm working with a system where we want to allow users to play around with the date and time if they want, and where reboots may happen arbitrarily. This is fine, except for one thing: if there's a ...
5
votes
3answers
1k views

Fast way to build a test file with every second listed in YYYY-mm-dd HH:MM:SS format

I want to create a large test file with lines containg dates listed by the second, but my method is taking inordinately long... (or at least, that's how it feels :) ... 43 minutes to create only ...
8
votes
6answers
7k views

date, get current 15 minute interval

Is there any way I can get the current 15 minute interval using the date command or similar ? e.g. something like date %Y.%m.%d %H:%M will give me 2011.02.22 10:19 , I need something that yields ...
8
votes
2answers
711 views

date - years prior to 1901 are treated as invalid

I have date (GNU coreutils) 7.1 installed on my system. If I try to check dates prior to 14-Dec-1901, I get an "invalid date" error. For example, $ date -d 1901-12-13 date: invalid date ...
4
votes
2answers
5k views

How to get elapsed time from two “text based” dates

I would like to know if there is a way to calculate the difference between two times in bash. I have two fields that are extracted from a log file: Start time: Feb 12 10:02:10 End time: Feb 12 ...
5
votes
3answers
2k views

Installation date of Ubuntu

How can I determine when Ubuntu was installed in my computer? There was a different question posted here, but none of them is helpful.
6
votes
1answer
3k views

Calculate the date from 1125 days ago on non-GNU systems?

On the Unix Bash commandline, I want to calculate the date from 1125 days ago using the base operating system (e.g. No Perl or Python). On systems running GNU Date, I can do something like this: ...
21
votes
5answers
24k views

How do I convert an epoch timestamp to a human readable format on the cli?

How do I convert an epoch timestamp to a human readable format on the cli? I think there's a way to do it with date but the syntax eludes me (other ways welcome).
16
votes
9answers
9k views

Tool in UNIX to subtract dates

Is there any tool in Solaris UNIX (so no GNU tool available) to subtract dates? I know that in Linux we have gawk that can subtract one date from another. But in Solaris the maximum we have is nawk ...
23
votes
10answers
3k views

Year 2038 problem

What is the likelihood of the Year 2038 issue being very problematic?
3
votes
1answer
1k views

rsync time comparison - what's the precision of the Modified times comparison

I'm doing some synching with rsync using: rsync --rLvv --times --size-only For my initial sync. My idea, now is to use: rsync --rLvv --times To synch files that have a new modified time. ...