This script compares the modification date of /var/lib/dpkg/info/${package}.list and all the files mentioned there. It could be wrong on noatime partitions. Here is non-oneliner: #!/bin/sh package=$1; list=/var/lib/dpkg/info/${package}.list; inst=$(stat "$list" -c %X); cat $list | ( while read file; do if [ -f "$file" ]; then acc=$(stat "$file" -c %X); if [ $inst -lt $acc ]; then echo used $file exit 0 fi; fi; done exit 1 ) Show Sample Output
Work out last months value Show Sample Output
Increase the modification date for the files selected with the find command.
* Replace USERNAME with the desired svn username * Replace the first YYYY-MM-DD with the date you want to get the log (this starts at the midnight event that starts this date) * Replace the second YYYY-MM-DD with the date after you want to get the log (this will end the log scan on midnight of the previous day) Example, if I want the log for December 10, 2010, I would put {2010-12-10}:{2010-12-11} Show Sample Output
Line can be modified as needed. This considers weekdays to be Mon-Fri. If run any working day it'll provide a parameters for the next working day for "at". "beep" provided as a sample command. This can be modified easily to include wait time. If you need something to run "D" days after today: # D=4;if [ $(date +%u --date="${D} days") -lt 5 ];then AT="+${D} days";else AT="next monday";fi; echo "beep" | at noon ${AT}
Convert readable date/time with `date` command Show Sample Output
Gets any date since today. Other examples of recognized expressions are "2 years 4 days ago", "7 months" (in the future), "next Sunday", "yesterday", "tomorrow", etc.
The command renames all files in a certain directory. Renaming them to their date of creation using EXIF. If you're working with JPG that contains EXIF data (ie. from digital camera), then you can use following to get the creation date instead of stat. * Since not every file has exif data, we want to check that dst is valid before doing the rest of commands. * The output from exif has a space, which is a PITA for filenames. Use sed to replace with '-'. * Note that I use 'echo' before the mv to test out my scripts. When you're confident that it's doing the right thing, then you can remove the 'echo'... you don't want to end up like the guy that got all the files blown away. Credits: http://stackoverflow.com/questions/4710753/rename-files-according-to-date-created Show Sample Output
Fake system time before running any command. Show Sample Output
Appends the input file with the date format YYYY-MM-DD.bak. Also runs silently if you remove the -v on the cp at the end of the function.
bash brace expansion, sequence expression Show Sample Output
Calculate the date of Sysadmin day (last Friday of July) of any given year Show Sample Output
Mac have direct conversion of seconds (Epoch time) Show Sample Output
Simply change the years listed in the first seq, and it will print out all the months in that span of years that have Friday the 13ths in them. Show Sample Output
Alter the years in the first brace expansion to select your year range. Modify date format to your liking but leave " %w" at the end. Show Sample Output
Sony's Xperia camera app creates files without time-stamped names. Thus, after deleting files on the phone, the same names will be reused. When uploading the photos to a cloud storage, this means that files will be overwritten. Running this command after every sync of uploaded photos with the computer prevents this. Show Sample Output
Echos the number of seconds from the current time till the specified time (Example in command is (2**31-1)) aka the Unix epoch. Just replace that number with the specified date (in seconds past Jan. 1st 1970) and it will return the seconds. NOTE: Only works in bash Show Sample Output
this works on Solaris, so not better than the "only-GNU"-tool :-( I think, there is no one-liner for this, that will work on all *nix-es Show Sample Output
Requires the date command. This also works with some other comics. Here's a bash script that displays daily Garfield, Id, and Andy Capp: http://putnamhill.net/cgi-bin/yahoo-comics.sh?ga,crwiz,crcap
Good when firewalled and only in need of a reasonable accurate time. Use a fast responding web server.
A command to find out what the day ends in. Can be edited slightly to find out what "any" output ends in. NB: I haven't tested with weird and wonderful output. Show Sample Output
commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.
Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.
» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10
Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):
Subscribe to the feed for: