commandlinefu.com is the place to record those command-line gems that you return to again and again.
Delete that bloated snippets file you've been using and share your personal repository with the world. 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.
You can sign-in using OpenID credentials, or register a traditional username and password.
First-time OpenID users will be automatically assigned a username which can be changed after signing in.
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.
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:
Wow, didn't really expect you to read this far down. The latest iteration of the site is in open beta. It's a gentle open beta-- not in prime-time just yet. It's being hosted over at UpGuard (link) and you are more than welcome to give it a shot. Couple things:
This example is taken from Cygwin running on Win7Ent-64. Device names will vary by platform.
Both commands resulted in identical files per the output of md5sum, and ran in the same time down to the second (2m45s), less than 100ms apart. I timed the commands with 'time', which added before 'dd' or 'readom' gives execution times after the command completes. See 'man time' for more info...it can be found on any Unix or Linux newer than 1973. Yeah, that means everywhere.
readom is supposed to guarantee good reads, and does support flags for bypassing bad blocks where dd will either fail or hang.
readom's verbosity gave more interesting output than dd.
On Cygwin, my attempt with 'readom' from the first answer actually ended up reading my hard drive. Both attempts got to 5GB before I killed them, seeing as that is past any CD or standard DVD.
'bs=1M' says "read 1MB into RAM from source, then write that 1MB to output. I also tested 10MB, which shaved the time down to 2m42s.
'if=/dev/scd0' selects Cygwin's representation of the first CD-ROM drive.
'of=./filename.iso' simply means "create filename.iso in the current directory."
'-v' says "be a little noisy (verbose)." The man page implies more verbosity with more 'v's, e.g. -vvv.
dev='D:' in Cygwin explicitly specifies the D-drive. I tried other entries, like '/dev/scd0' and '2,0', but both read from my hard drive instead of the CD-ROM. I imagine my LUN-foo (2,0) was off for my system, but on Cygwin 'D:' sort of "cut to the chase" and did the job.
f='./filename.iso' specifies the output file.
speed=2 simply sets the speed at which the CD is read. I also tried 4, which ran the exact same 2m45s.
retries=8 simply means try reading a block up to 8 times before giving up. This is useful for damaged media (scratches, glue lines, etc.), allowing you to automatically "get everything that can be copied" so you at least have most of the data.
http://www.joachim-breitner.de/projects#screen-message now also supports reading stdin continuously to update what it shows, different ?slides? separated by a form feed character. Here, we feed the current time into it each second to create a large clock.
Run this within a steady screen session.
You can get the approximate time when the remote server went down or other abnormal behavior.
Format of the response: [-]HH:mm
works where perl works, because the awk version is gnu awk only.
This will save parsing time for operations on very big files.
uses the -u switch for UTC
Another way could be
echo $(($(date -ud "00:29:36" +%s)%86400))
Outputs the real time it takes a Redis ping to run in thousands of a second without any proceeding 0's. Useful for logging or scripted action.
The same with colors
This command will show the current GMT time using HTTP. This might be useful if you just want to know what's the current human-readable and accurate-enough time, without changing the system time, using a simple command that would work regardless of the availability of NTP.
Note: To get a quicker and more accurate response, replace google.com with your local NTP server.
Also can be used as an alternative to the "htpdate" program:
For Solaris to obtain the same as:
date+%s like in linux
Adds the time in 12hr AM/PM format to the beginning of a prompt. Change \@ to \t for 24-hour time or \T for 12hr without AM/PM.
To keep the time the next time you open a terminal, edit ~/.bashrc and stick the command at the bottom.
I've had a horrible time trying to pipe the output of some shell built-ins like 'time' to other programs. The built-in doesn't output to stdout or stderr most of the time but using the above will let you pipe the output to something else.
In a folder with many files and folders, you want to move all files where the date is >= the file olderFilesNameToMove and
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