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.
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:
Wow, didn't really expect you to read this far down. The latest iteration of the site is in open beta. It's a gentle open beta-- not in prime-time just yet. It's being hosted over at UpGuard (link) and you are more than welcome to give it a shot. Couple things:
Transfer files with rsync over ssh on a non-standard port, showing a progress bar and resuming partial transfers.
An example config file is placed in the sample output along with the command line call to use it.
The rsync daemon here is setup on the destination, thus requiring the read only = false flag. Also it uses uid and gid of root, change as required.
-r for recursive (if you want to copy entire directories)
src for the source file (or wildcards)
dst for the destination
--progress to show a progress bar
Applying filter rules is what makes this a really useful command. It's usually a pain to figure out how to sync ONLY files matching a particular pattern, and often one reverts to goofy stuff like find .. -exec rsync ..
The filter hides all folders from the transfer, so that only the matching folders that store the filename are left for the sync.
The command copies a file from remote SSH host on port 8322 with bandwidth limit 100KB/sec;
--progress shows a progress bar
--partial turns partial download on; thus, you can resume the process if something goes wrong
--bwlimit limits bandwidth by specified KB/sec
--ipv4 selects IPv4 as preferred
I find it useful to create the following alias:
alias myscp='rsync --progress --partial --rsh="ssh -p 8322" --bwlimit=100 --ipv4'
in ~/.bash_aliases, ~/.bash_profile, ~/.bash_login or ~/.bashrc where appropriate.
'-mtime -10' syncs only files newer 10 days (-mtime is just one example, use whatever find expressions you need)
printf %P: File's name with the name of the command line argument under which it was found removed.
this way, you can use any src directory, no need to cd into your src directory first.
using \\0 in printf and a corresponding --from0 in rsync ensures that even filenames with newline characters work (thanks syssyphus for #3808).
both, #1481 and #3808 just work if you either copy the current directory (.) , or the filesystem root (/), otherwise the output from find and the source dir from rsync just don't match. #7685 works with an arbitrary source directory.
Using the double dash before the source and target makes the command work fine with weird filenames.
'data' is the directory to backup, 'backup' is directory to store snapshots.
Backup files on a regular basis using hard links. Very efficient, quick. Backup data is directly available.
Same as explained here :
in one line.
Using du to check the size of your backups, the first backup counts for all the space, and other backups only files that have changed.
Zsync is an implementation of rsync over HTTP that allows updating of files from a remote Web server without requiring a full download. For example, if you already have a Debian alpha, beta or RC copy downloaded, zsync can just download the updated bits of the new release of the file from the server.
This requires the distributor of the file to have created a zsync build control file (using zsyncmake).
traverses e.g. "/data/myhost1.com/myrsyncshare"; logs stderr and stdout. useful with cron.
With this cron, rsync begins to sinchronize the contents of the local directory on /[VIPdirectory] with the directory /backup/[VIPdirectory] on the remote server X.X.X.X. Previously we need working on public/private-keys ssh to guarantee the acces to the remote server on X.X.X.X
Check the ssh_config file and set the variable:
Copying only wmv and mpg files recursively from to
This will backup the _contents_ of /media/SOURCE to /media/TARGET where TARGET is formatted with ntfs. The --modify-window lets rsync ignore the less accurate timestamps of NTFS.
connect to a remote server using ftp protocol over FUSE file system, then rsync the remote folder to a local one and then unmount the remote ftp server (FUSE FS)
it can be divided to 3 different commands and you should have curlftpfs and rsync installed
If your user has sudo on the remote box, you can rsync data as root without needing to login as root. This is very helpful if the remote box does not allow root to login over SSH (which is a common security restriction).