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 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!)
Monitoring system in one line :
DISK : disk space
MEM: memory ( mem , swap, Total)
CPU : all information about cpu activity
LOAD : load average
Top 30 History Command line with histogram display
Useful, when you need to backup/copy/sync a folder over ssh with a non standard port number
capture 2000 packets and print the top 10 talkers
This does not require you to know the partition offset, kpartx will find all partitions in the image and create loopback devices for them automatically. This works for all types of images (dd of hard drives, img, etc) not just vmkd. You can also activate LVM volumes in the image by running
vgchange -a y
and then you can mount the LV inside the image.
To unmount the image, umount the partition/LV, deactivate the VG for the image
vgchange -a n <volume_group>
kpartx -dv <image-flad.vmdk>
to remove the partition mappings.
When booting a VM through OpenStack and managed through cloudinit, the hosts file gets to write a line simiar to
127.0.1.1 ns0.novalocal ns0
This command proven useful while installing a configuration manager such as Salt Stack (or Puppet, or Ansible) and getting node name
I used this (along with a modified one replacing `mkv` with `srt`) to remove the slight differences in who the provider of the video / matching subtitle was (as they are the same contents and the subs match anyway).
So now VLC (and other video players) can easily guess the subtitle file.
A nice way to interrupt a sleep with a signal.
This commands compresses the "tmp" directory into an initrd file.
this command extracts an initrd files into the "tmp" directory
this command can be added to crontab so as to execute a nightly backup of directories and store only the 10 last backup files.
Mac have direct conversion of seconds (Epoch time)
credit shall fall to this for non-gzipped version:
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
Creates a 2 second video clip from an image.
Caution: distructive overwrite of filenames
Useful for concatenating pdfs in date order using pdftk
Works great on Mac OSX.
Reduced to only one command. :)
Autocomplete from .ssh/config