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.
» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10
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:
Notes:
* Adjust the find command to your own filters.
* The -P flag forces to keep absolute paths in the tarball, so that you can be sure that the exact same file hierarchy will be created on the second machine.
copies all files from the source disk / (skipping boundaries of mouted -in volumes) to /mnt/mydisk. Logical links are being preserved as well as devices, pipes etc. This can copy a MacOS X or Linux volume and keep it bootable. Note: its not suited to copy files with MacOS 9 style resources.
Will search recursively and output the searchResult.txt in the same folder you are located.
Find files that are older than x days in the working directory and list them. This will recurse all the sub-directories inside the working directory.
By changing the value for -mtime, you can adjust the time and by replacing the ls command with, say, rm, you can remove those files if you wish to.
This command is somewhat similar to 'nice', but constrains I/O usage rather than CPU usage. In particular, the '-c3' flag tells the OS to only allow the process to do I/O when nothing else is pending. This dramatically increases the responsiveness of the rest of the system if the process is doing heavy I/O.
There's also a '-p' flag, to set the priority of an already-running process.
If your CVS server has moved, here's a way to update your CVS Root files throughout your code tree without checking out a new copy of your files.
Found here: http://xentek.net/xentek/315/recursively-delete-svn-folders/
This is fast and efficient because rm is only run once.
unsets variables used by the one-liner
sets up the IFS bash variable to not be affected by whitespace and disables extra glob expansion
uses read to slurp the results of the find command into an array
selects an element of the array at random to be passed as an argument to mplayer
Locate broken symlinks in the current directory. Also useful, to remove broken links:
find . -type l ! -exec test -e {} \; -print0 | xargs -0 rm
WARNING! This command may set an invalid permission under your current directory.
This command will set the 0755 permissions to all directories under your current directory. An alternative version of this command is: find ~/.ssh -type d -exec chmod 0700 {} \;
WARNING! This command may set an invalid permission under your current directory.
This command will set the 0644 permissions to all files under your current directory. An alternative version of this command is: find ~/.ssh -type f -exec chmod 0600 {} \;
This command will erase all bytecode versions of Python modules under the current directory.
Adds a newline to the end of all cpp files in the directory to avoid warnings from gcc compiler.
This command deletes all files in all subfolders if their name or path contains "deleteme".
To dry-run the command without actually deleting files run:
find . | grep deleteme | while read line; do echo rm $line; done
If you need to delete all redundant ".svn" directories from a given path and all its subdirectories, use this command !
Particulary useful if you want to upload to an ftp server, but don't use svn or if you need to update/backup some source code to another directory.
You can also try "svn export . /new/path/without/svn/dirs" (also from the CLI)