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:
This is a command to be used inside of MS-DOS batch files to check existence of commands as preconditions before actual batch processing can be started. If the command is found, batch script continues execution. If not, a message is printed on screen, script then waits for user pressing a key and exits.
An error message of the command itself is suppressed for clarity purpose.
Usually the MS-DOS cmd.exe processes in the whole FOR loop as one command and expands each var like %varname% in before (except the loop var of course).
This command enables expansion of other vars than only the loop var during the FOR loop. The syntax of the var to expand is then !varname! inside the FOR loop.
to end the setlocal command.
E.g. (only works from batch files, not from commandline directly):
FOR %%A IN (*) DO (
Loops over array of a system var, splits its values and puts the values into %A, %B, %C, %D, and so on.
Create array before, like
Be sure to replace %A, %B, etc. with %%A, %%B, etc. when using this from inside of batch files.
This command loops over all indexes of the system variable array ARRAY and puts its content into %A.
Create this array before, e.g. by
For using inside of a batch file, write %%A instead of %A.
This is a command template for achiving the following:
* loop over files --> find -name "" | while read file; do ...; done
* output progress --> echo -n .
* execute some command on each file and save output for later usage --> output=$()
* if command failed, open subshell and echo newline --> || (echo;...;...;)
* echo output of command --> echo "$output"
This command dumps all SVN repositories inside of folder "repMainPath" (not recursively) to the folder "dumpPath", where one dump file will be created for each SVN repository.