Jason Sares is a Giant Dork

Archive for the 'Linux Quick Tip' Category

Bash One Liner – Human Readable Sorted du

du -s * 2>/dev/null | sort -n | cut -f2 | xargs du -sh 2>/dev/null

6 comments

Linux Quick Tip – Linux RAID Driver

If you buy a RAID Adapter often you’ll have to create a driver disk for your OS. Most of these are 1.44MB floppy images and since modern systems often lack a floppy drive I needed some way of creating the disk.

I used a USB stick and dd for Windows (I’m sure dd for Linux would work just as well)

From the Windows Comand Prompt:

C:\>dd if=mini.img od=x: (Where X is the drive letter of the USB stick)

Then just insert the USB stick before loading your Linux Installation Media.

No comments

Linux Quick Tip – Benchmark Disk Performance

A very quick way to benchmark your disk performance is hdparm -t /dev/Xda (hda or sda):

you should get results like this:

[root@esx-mars root]# hdparm -t /dev/sda

/dev/sda:
Timing buffered disk reads:  358 MB in  3.00 seconds = 119.33 MB/sec

This is from a Dell PowerEdge 2900 with the PERC 5i SATA RAID Controller.

Roughly you want to see 50 MB+ per disk, if you have a RAID 0 of two disks you should get 100 MB+.

What numbers are your getting?

5 comments

Little Quick Tip – Rename Multiple Files

I used to use mv in a for loop or with exec, or xargs until I found a very useful command that’s included in almost every distro

rename

Usage

$ rename oldfilename newfilename *filepattern

Example

To rename all the files in the current directory ending with .htm to .html

$ rename .htm .html *.htm

You can use RegEx and for more sophisticated selections and use -n to test your changes before you commit them.

No comments

Linux Quick Tip – Find What Distro You’re On

I was just setting up some services on the giantdorks server and I forgot which distro (doh) we’re running. uname -a wasn’t very helpful so I looked at /etc/issue and found it was openSUSE 10.2 (i586). Anyone know which distros this works for, or any other ways to find which distro you’re logged on to?

Edit:

I found an additional way is to use lsb_ release -a

4 comments