Commands by arthurwayne (1)

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

vimdiff to remotehost
vimdiff to remotehost

print contents of file from line 1 until we match regex
Start printing the contents of filename to stdout, until a matching line to regex is found, then stop.

Check if a string is into a variable
Returns true (0) if the string is into $var, or false (1) if not.

When was your OS installed?
shows also time if its the same year or shows year if installed before actual year and also works if /etc is a link (mac os)

Find directories under home directory with 777 permissions, change to 755, and list them on console

umount all nfs mounts on machine

Find all files of a type and copy them elsewhere while keeping intact their full directory structure using find and cpio
.flac is the filetype. /Volumes/Music/FLAC is the destination.

Copy a MySQL Database to a new Server via SSH with one command
Dumps a MySQL database over a compressed SSH tunnel and uses it as input to mysql - i think that is the fastest and best way to migrate a DB to a new server!

Display standard information about device
Queries the specified ethernet device for associated driver information

apt-get via sudo
An apt-get wrapper function which will run the command via sudo, but will run it normally if you're only downloading source files. This was a bit of an excuse to show off the framework of $ cmd && echo true || echo false ...but as you can see, you must be careful about what is in the "true" block to make sure it executes without error, otherwise the "false" block will be executed. To allow the apt-get return code to pass through, you need to use a more normal if/else block: $ apt-get () { if [ "$1" = source ]; then command apt-get "[email protected]"; else sudo apt-get "[email protected]"; fi }


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: