All commands (14,187)

What's this?

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.

Share Your Commands


Check These Out

Join lines
awk version of 7210. Slightly longer, but expanding it to catch blank lines is easier: $ awk 'BEGIN{RS="\0"}{gsub(/\n+/,"");print}' file.txt

Find usb device
I often use it to find recently added ou removed device, or using find in /dev, or anything similar. Just run the command, plug the device, and wait to see him and only him

A child process which survives the parent's death (for sure)
Test scenario: * Open xterm (or konsole, ...) * Start xeyes with: ( xeyes & ) * Close the xterminal The xeyes process should be still running.

Read choice from user instantaneously
Usage exaple cmd $echo 'Sure to continue ??'; read -n1 choi; if [ "$choi" = 'y' ] || [ "$choi" = 'Y' ]; then echo -e '\nExecuting..'; else echo 'Aborted'; fi

Displays the current time using HTTP
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: http://www.commandlinefu.com/commands/view/668/set-your-computers-clock-using-http-and-htp-http-time-protocol-when-ntpsntp-is-not-available

remote diff with side-by-side ordering.
more information: man sdiff

calculate the total size of files in specified directory (in Megabytes)

Print all git repos from a user
in case you could afford installing jq

Get a docker container's run command line
A good way to build a new container when you don't remember how you did it the first time

Debug redirects between production reloads
Watches the headers of a curl, following any redirects and printing only the HTTP status and the location of the possible redirects.


Stay in the loop…

Follow the Tweets.

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

Subscribe to the feeds.

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: