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:
hide your ass, buddy.
Use 'ctrl-@' to set a mark. See the first comment for a better explanation.
Super fast way to ftp/telnet/netcat/ssh/ping your loopback address for testing. The default route 0.0.0.0 is simply reduced to 0.
Cleaned up and silent with &>/dev/null at the end.
Execute commands serially on a list of hosts. Each ssh connection is made in the background so that if, after five seconds, it hasn't closed, it will be killed and the script will go on to the next system.
Maybe there's an easier way to set a timeout in the ssh options...
Generate a 18 character password from character set a-zA-Z0-9 from /dev/urandom, pipe the output to Python which prints the password on standard out and in crypt sha512 form.
This will check if a user is logged in using ssh and will log out the user automatically after the specified time in seconds without data retrieval on the server side.
Will work with bash and zsh so put it into your sourced shell file on the server side.
Be aware that users can change this themselves as it's just a envoronment variable.
Put this in your zshrc, source it, then run 'pkill -usr1 zsh' to source it in all open terminals. Also works with bash. More info: http://www.reddit.com/r/commandline/comments/12g76v/how_to_automatically_source_zshrc_in_all_open/
There is no need to use the shell or construct. Screen offers varius ways of detaching and reattaching. man screen and look for -[rRdD].
to create a named session: sdr moo
resume: sdr moo
Tries to avoid the fragile nature of scrapers by looking for user-input in the output as opposed to markup or headers on the web site.
Tries to reattach to screen, if it's not available, creates one.
created an alias "irc" for it, since sometimes i forget if there already is a screen session running with irssi, this way I avoid creating a new one by mistake.
Renames all files ending in "_test.rb" to "_spec.rb"
I doubt this works with other than bash, but then again, I havent tried.
The 'yes' utility is very simple, it outputs a hell of a lot of 'y's to standard input.
The '!!' command means 'the last command'. So this one-lines inputs a lot of y's into the last command, aggressively agreeing to everything. For instance, when doing apt-get.
You may want to just use the shortcut "." instead of "source"
Any changes to BASH shell made in .bashrc will be active in the current terminal window from the moment you execute this command, ie. aliases, prompt settings etc. No need to restart terminal.
(In BASH 'source' simile to 'eval' lets you generally execute any bunch of commands stacked in a text file).
Add this line to your ~/.gitconfig for a git alias "git brd" (i.e., brd = (br)anch+(d)ate) which sorts branches by date. Allows you to pass in limited "git branch" options such as "-r" (remote) or "-a" (all). (Note: forum added "$" prefix to command; obviously in gitconfig there is no "$" prefix.)
Use meaningful exit codes
change "source" to "cat" to view output instead of assigning
typeset command gives to stdout all the functions defined in a bash session, -f and -F switches are for: all functions names with body (-f) and all functions names only (-F).
Had trouble with the other function, because of missing semicolons. (According to my bash on OS X)
This makes your commandlinefu.com's favorites appear as most recent commands in your history.
Helps when I'm editing a script and want to double check some commands without having to exit out of vi multiple times or having to use another terminal session.