commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
This command will use the fdisk utility to find all block devices on your system, and overwrite them with data from the /dev/urandom non-blocking random number generator.
CAUTION: This will irrevocably erase EVERY SINGLE physical block storage device visible to the fdisk utility, including plugged USB devices, RAID sets, LVM, etc.
entering this command as root may give more complete results, creating a tmp file, and immediately opening the file might be more useful
sudo gedit /etc/default/grub
This would open the Grub configuration file. In this file we have to edit the line
Creates a temporary ram partition
to make a 3gb partition (Defaults to 1gb)
Replace KEY with GPG key. This command will load GPG key and add it to your system so you can use software from third party repos etc.
Kills all processes with a certain string. This was done to kill all ssh sessions openned by zenoss which look like: usr/bin/ssh /opt/zenoss/bin/zenmodeler
If you run dpkg --clear-selections or have otherwise selected installed packages for deinstall, but want to undo it, run this. It will set all installed packages back to installed status so that they won't be removed by commands like "dpkg -Pa"
Install all build dependencies for a given package
Back up /etc directory with a name based on the current date and the hostname of the machine, then chown the file for the current user for use.
bit of a contrived example and playing to my OCD but nice for quick scripted output of listening ports which is sorted by port, ip address and protocol.
..not guaranteed to always be accurate but fun to see how old you Linux installation is based on the root partitions file system creation date.
Assumes XP/2000/2003. For Server 2008+ try offset=105,906,176 You can find this number in the System Information utility under Partition Starting Offset. UEFI based boxes you want partition 2 since the first is just the boot files (and FAT). This works with (storage side) snapshots which is handy for single file restores on NFS mounted VMware systems
If you are an unlucky soul behind a corporate firewall you will likely find that downloading gpg keys is blocked. This is because the hkp protocol uses port 11371 by default to transfer the key.
By adding "hkp://" to the beginning of the hostname and ":80" to the end you are asking gpg to try using port 80 to connect (less likely to be blocked by a firewall). This relies on the remote server answering to requests over port 80.
Counts of messages by recipient, with frozen messages excluded.