file_to_backup{,-$(date +%F)} expands to the following two items: file_to_backup file_to_backup-$(date +%F) Show Sample Output
From a local node, retrieve the date from server A and set that time on server B. When ntpd is not an option and you need to get closest clock sync between two nodes Replace SRC_SRV with yout source server and DST_SRV with your destination server. You must have ssh access to both and sudo access to the the destination to set the date. Show Sample Output
Removed grep and simplified if statement. -- Friday is the 5th day of the week, monday is the 1st. Output may be affected by locale. Show Sample Output
I needed to get a feel for how "old" different websites were, based on their directories. Show Sample Output
The shell has perfectly adequate pattern matching for simple expressions. Show Sample Output
date MMDDhhmmYYYY date MMDDhhmm # example 27.12.1975 08:00 date 122708001975 Show Sample Output
Just added view with the eog viewer.
Simple Compressed Backup of the /etc Linux compatible
I liked vaporub's suggestion, here a little simplification of the sed command.
This uses curl to find out the access times of a web service Show Sample Output
I find the other timers are inaccurate. It takes some microseconds to perform the date function. Therefore, using date/time math to calculate the time for us results in millisecond accuracy. This is tailored to the BusyBox date function. May need to change things around for GNU date function. Show Sample Output
Tres lineas en un shell script para copiar la base de datos diaramente
Change HH:MM with your target time. This is for a Debian/Ubuntu GNU system. You need bash (package bash), date (package coreutils) and toilet (package toilet). Install with: # apt-get install bash coreutils toilet toilet-fonts
Number of days back: change/append arbitrary amount of '\|'$[$(date +%Y%j)-x] expressions or specify any n-th day before today for a single day (you have to replace x with 3, 4, 5, whatever ... above I replaced it with 1 and 2 to get listing for yesterday and day before yesterday and 0 for today was not necessary, so left out).
Q: How to narrow to *.pdf , *.png, *.jpg, *.txt, *.doc, *.sh or any type of files only?
A: Pipe to grep at the end of command.
Even shorter:
cd && day=3;for a in $(seq $day -1 0);do tree -aicfnF --timefmt %Y%j-%d-%b-%y|grep $[$(date +%Y%j)-$a];done
Here it's only needed to change amount of variable day to list period of days back - here is set to three days back (the seq command is adjusted for listing the oldest stuff first).
Show Sample Output
This backup function preserve the file suffix allowing zsh suffix aliases and desktop default actions to work with the backup file too. Show Sample Output
Take a picture from your webcam and save it to a jpeg. A very slightly modified version of MarxBro's command.
This produces a parseable output of the last day of the month in future or past. Change the '-v-0m' to be a month plus or minus from the current system time. Show Sample Output
uses the -u switch for UTC
Another way could be
echo $(($(date -ud "00:29:36" +%s)%86400))
The end of unix time and the 32bit era will be Tue Jan 19 03:14:07 UTC 2038
.
date -ud @$[2**31]
date: invalid date `@2147483648'
.
In 64bit you have much longer, at least to:
date -ud @$[2**55]
Sun Jun 13 06:26:08 UTC 1141709097
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: