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.
If you have a new feature suggestion or find a bug, please get in touch via http://commandlinefu.uservoice.com/
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:
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
More recent versions of the date command finally have the ability to decode the unix epoch time into a human readable date. This function makes it simple to utilize this feature quickly.