Linux commands
From WikiPaul - Paul Swanson's wiki
fuser -vm /media/drive- Show what processes are using the drive
cat /proc/*/*/*/temperature- Prints out cpu temperature, if available
ls -d */- list only directories in current directory
source .bashrc- reload .bashrc, etc.
!!- Does last command (useful for `sudo !!`)
convert -resize 800x600 *.jpg new.jpg- A batch Imagemagick command that resizes every image in a directory to 800x600, and names them new-0.jpg, new-1.jpg... etc.
sudo smbmount //servername/share /media/mountpoint/ -o rw,credentials=.smbpasswd,workgroup=domain- Mounts a Windows share
lpr -P HPpsc textfile.txt- Prints the text file from the printer named HPpsc
sudo rdate ntp.alaska.edu- Sets and prints the current time
acpi -V- Prints thermal and battery charge info, if any
mencoder infile.wmv -ofps 23.976 -ovc lavc -oac copy -o outfile.avi- Convert a wmv to avi (or whatever you want)
grep 'something' * | grep -v grep | awk -F\: '{print $1}' | xargs rm- Search for 'something' in all the files in the directory, grab the first part of the result separated by colons (the filename), and pass that on to remove
find . -type f -exec /bin/ls -l {} \; | awk '{print $5 " " $8}' | sort -n- find all files in a directory, and sort them by size.
ps aux | awk '{print $3 " " $11}' | sort -nr | head- Print the 10 most cpu-heavy processes.
egrep '(string1|hurrblah|wazzup)' * | awk -F\: '{print $1}' | xargs rm- Deletes all files in the current directory containing the strings 'string1', 'hurrblah', or 'wazzup'
Disk-based commands
dd if=/dev/hda | gzip > /media/drive_image.img.gz- Creates a gzip-compressed image of the hard drive
gzip -dc /media/drive_image.img.gz | dd of=/dev/hda- Uncompresses image and copies it back to the hard drive
dd if=/dev/hda | tee /dev/hdb /dev/hdc /dev/hdd /dev/hde 1>/dev/null- Copies every byte of hda to hdb, hdc, hdd, and hde, and pipes stdout to null. Not parallel.
dd if=/dev/urandom of=/dev/hda- Overwrites the first hard drive with random bytes
NTFS fun
sudo bash- Makes all the following commands root
fdisk -l- Look for NTFS on the right side, and remember its block location (/dev/sda1, /dev/hda2, etc)
mkdir /media/ntfs- Make a directory in which to mount the partition
mount -t ntfs-3g /dev/hda2 /media/ntfs -o force,rw- Mounts the partition to the directory
If that fails:
ntfsfix /dev/hda2- Will reset the NTFS journal, so you can mount it, then run the
mountcommand again
BlogMarks
del.icio.us
digg
Fark
Furl
Newsvine
reddit
Segnalo
Simpy
Slashdot
smarking
Spurl
Wists