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:
Recent hardware may or may not enumerate *both of* these values
Function that searchs a process by its name and shows in the terminal.
* Shows the Header for reference
* Hides the process 'grep' from the list
* Case sensitive
This will list all the files that are a gigabyte or larger in the current working directory. Change the G in the regex to be a M and you'll find all files that are a megabyte up to but not including a gigabyte.
To check the total number of mounts, maximum number of mounts before performing the fsck and last time when the fsck was performed.
Using egrep to search multiple patterns.
This is the most straightforward approach: first regexp limits dictionary file to words with thirteen or more characters, second regexp discards any words that have a letter repeated. (Bonus challenge: Try doing it in a single regexp!)
Its possible to user a simple regex to extract de username from the finger command.
The final echo its optional, just for remove the initial space
Thx Mass1 for the sharing
A grep against ethtool to look for common errors and packet loss statistics which network drivers report in their private data, which is queried with ethool -S. This is the current grep used in xsos (https://github.com/ryran/xsos), which I originally contributed and has been improved by the community over time.
Filter entries in OpenSuse /var/log/messages like:
timestamp servername kernel: [83242.108090] btrfs: checksum error at logical 1592344576 on dev /dev/sda5, sector 5223584, root 5, inode 2652, offset 282624, length 4096, links 1 (path: log/warn)
Puts a splash of color in your access logs. IP addresses are gray, 200 and 304 are green, all 4xx errors are red. Works well with e.g. "colorize access_log | less -R" if you want to see your colors while paging.
Use as inspiration for other things you might be tailing, like syslog or vmstat
tail -f access.log | colorize
Is the better option on a Open SuSE Box
This will strip out the relivent disk information from kvm. I'm using it to find disks on a SAN which are no longer in use.
Backs up all databases, excluding test, mysql, performance_schema, information_schema.
Requires parallel to work, install parallel on Ubuntu by running: sudo aptitude install parallel
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 ;)
UBNT iwlist command
This one has a better performance, as it is a one pass count with awk. For this script it might not matter, but for others it is a good optiomization.
make usable on OSX with filenames containing spaces. note: will still break if filenames contain newlines... possible, but who does that?!