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.
List the busiest scripts/files running on a cPanel server with domain showing (column $12).
IP addresses and number of connections connected to port 80.
Easiest way to obtain the busiest website list (sorted by number of process running).
Choose the /var/log/sa/saXX log based on what day you want to view. You can use ifconfig to find the name of the interface.
You can use the -s flag to specify a certain time period, e.g. -s 12:00:00 -e 14:00:00
for redhat systems works sometimes :S tested on dell poweredge r7+ systems
show off how big your disks are
on some distro's you have to replace "BogoMIPS" with "bogomips".
Very quick! Based only on the content sizes and the character counts of filenames. If both numbers are equal then two (or more) directories seem to be most likely identical.
if in doubt apply:
diff -rq path_to_dir1 path_to_dir2
AWK function taken from here:
If you creates a virtualenv just for a test, and at the end, wants remove all installed packages. This is the lever.
Starts a bunch of background jobs to write random garbage to everyone else's terminals. The "\n" in IFS should be an actual newline, but I can't put that in the command.
recurse through all files, get the message hash, flip the output as filename, hash value
With this command, you can check the difference between the volumes mounted and the volume in /etc/fstab.
Using find's internal stat to get the file size is about 50 times faster than using -exec stat.
Find files and calculate size with stat of result in shell
Pass the files path to finfo(), can be unix path, dos path, relative or absolute. The file is converted into an absolute nix path, then checked to see if it is in-fact a regular/existing file. Then converted into an absolute windows path and sent to "wmic". Then magic, you have windows file details right in the terminal. Uses: cygwin, cygpath, sed, and awk. Needs Windows WMI "wmic.exe" to be operational. The output is corrected for easy...
finfo "/cygdrive/c/Program Files/notepad.exe"
Fetches latest stable release version from first entry between tags