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:
Many users have a personal ~/bin folder for user scripts and other miscellaneous applications they can't or don't want to add to /usr/bin. But this folder can get large and unwieldy. The above command adds ~/bin and all its subdirectories to the PATH environment variable so the scripts can be organized without changing .bashrc.
This uses the ability of find (at least the one from GNU findutils that is shiped with most linux distros) to display change time as part of its output. No xargs needed.
This has saved me many times while debugging timeout issues to "too many open files" issues. A high number of the order of thousand, indicates that somewhere connection is not being closed properly.
Required : information_schema
** Only replace the "DB-NAME" and "PREFIX" with your DB-name and wildcard prefix match.
** Also replace with your own username and password for mysql server.
This command uses the information_schema to wildcard match tables that we donot need from a database and than pipes the remaining tables out through "xargs" command to the mysqldump utility which than dumps those remaining tables into a sql dump file.
That is useful to discover the start time of process older than 1 day.
You can also run:
ls -ld /proc/PID
That's returning the creation date of the proc files from the process. Some users reported that this way might show you a wrong date since any other process like cron, for example, could change this date.
Count your source and header file's line numbers. This ignores blank lines, C++ style comments, single line C style comments.
This will not ignore blank lines with tabs or multiline C style comments.
one of the solutions from this stackexchange: http://unix.stackexchange.com/questions/71585/convert-ls-l-output-format-to-chmod-format
Good because it doesn't use Sed.
If you are a regular user of Google Chrome and Gmail Offline, you'll find that Gmail Offline stops working after a while due to corruption of its local storage in your browser. Worse, trying to use Google Chrome's "Clear Browsing Data" menu command to remove all the local storage is (1) overkill, because it deletes non-Google page local storage, and (2) ineffective, because once the storage is corrupt, Google Chrome doesn't know how to delete it either. Fortunately, it's all stored in obviously named files in your home directory; this command deletes the files directly, after which restarting Google Chrome will let you reinstall Gmail Offline correctly.
https://github.com/apenwarr/sshuttle disassembles TCP packets, sends them over SSH, assembles and forwards on the server side, and vice versa.
I used this to get all the remote connection ip addresses connected to my server... I had to start storing and tracking this data so thats why i built this out... probably not optimal as far as the egrep regex but it works ;)
Returns true (0) if the string is into $var, or false (1) if not.
Found it on:
http://stackoverflow.com/questions/318789/whats-the-best-way-to-open-and-read-a-file-in-perl
The yet most simple way to read all the contents of a file to a variable. I used it in a perl script to replace $text="`cat /sys/...`", and stipping down 9 secs of runtime due less forks
This makes GNU info output menu items recursively and pipe its contents to less, allowing one to use GNU info in a manner similar to 'man'.