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 very similar to the first example except that it employs the 'exec' argument of the find command rather than piping the result to xargs. The second example is nice and tidy but different *NIXs may not have as capable a grep command.
first 10 big file
Make sure that find does not touch anything other than regular files, and handles non-standard characters in filenames while passing to xargs.
doesn't seem to work with pear
Output: Version 3.2-0 (for example if you type # aptitude show bash | grep Vers
Depends on the language of your distribution, because the name of the word "Version" in other languages may be different.
splits a postscript file into multiple postscript files. for each page of the input file one output file will be generated. The files will be numbered for example 1_orig.ps 2_orig.ps ...
The psselect commad is part of the psutils package
This command shows a high level overview of system memory and usage refreshed in seconds. Change -n 10 to you desired refresh interval.
Uses the pid to get the full path of the process. Useful when you do not which command got picked from the path
This got a bit complicated, because I had to introduce an additional dot at the end that has to be removed again later.
Combines a few repetitive tasks when compiling source code. Especially useful when a hypen in a file-name breaks tab completion.
1.) wget source.tar.gz
2.) tar xzvf source.tar.gz
3.) cd source
From there you can run ./configure, make and etc.
This is just a little snippit to split a large file into smaller chunks (4mb in this example) and then send the chunks off to (e)mail for archival using mutt.
I usually encrypt the file before splitting it using openssl:
openssl des3 -salt -k <password> -in file.tgz -out file.tgz.des3
To restore, simply save attachments and rejoin them using:
cat file.tgz.* > output_name.tgz
and if encrypted, decrypt using:
openssl des3 -d -salt -k <password> -in file.tgz.des3 -out file.tgz
edit: (changed "g" to "e" for political correctness)
Transfer files with rsync over ssh on a non-standard port, showing a progress bar and resuming partial transfers.
Mac install ssh-copy-id
From there on out, you would upload keys to a server like this:
(make sure to double quote the full path to your key)
ssh-copy-id -i "/PATH/TO/YOUR/PRIVATE/KEY" [email protected]
or, if your SSH server uses a different port (often, they will require that the port be '2222' or some other nonsense:
(note the double quotes on *both* the "/path/to/key" and "[email protected] -pXXXX"):
ssh-copy-id -i "/PATH/TO/YOUR/PRIVATE/KEY" "[email protected] -pXXXX"
...where XXXX is the ssh port on that server
It will parse the unique_id stanza in ODM database to get the DMX id.
zsh has a powerful correction mechanism. If you type a command in the wrong way it suggests corrections. What happend here is that dir is an unknown command and zsh suggests gdir, while maybe ls was what you wanted.
If you want to execute gdir hit y (yes)
If you want to try to execute dir anyway hit n (no)
If you want to execute completely different spelt command like ls hit a (abort) and type your command
If you want to execute a similar spelt commant like udir hit e (edit) and edit your command.