Articles in the Linux category

  1. Linux: Get a List of Al Disks and Their Size

    November 25, 2012

    To get a list of all disk drives of a Linux system, such as this:

    Disk /dev/md0: 58.0 GB
    Disk /dev/md1: 2015 MB
    Disk /dev/md5: 18002.2 GB
    Disk /dev/sda: 60.0 GB
    Disk /dev/sdb: 60.0 GB
    Disk /dev/sdc: 1000.1 GB
    Disk /dev/sdd: 1000.1 GB
    Disk /dev/sde: 1000.1 GB
    Disk /dev/sdf: 1000.1 GB
    Disk /dev/sdg: 1000.1 GB
    Disk /dev/sdh: 1000.1 GB
    Disk /dev/sdi: 1000.1 GB
    Disk /dev/sdj: 1000.1 GB
    Disk /dev/sdk: 1000.1 GB
    Disk /dev/sdl: 1000.1 GB
    Disk /dev/sdm: 1000.1 GB
    Disk /dev/sdn: 1000.1 GB
    Disk /dev/sdo: 1000.1 GB
    Disk /dev/sdp: 1000.1 GB
    Disk /dev/sdq: 1000.1 GB
    Disk /dev/sdr: 1000.1 GB
    Disk /dev/sds: 1000.2 GB
    Disk /dev/sdt: 1000.2 GB
    Disk /dev/sdu: 1000.2 GB
    Disk /dev/sdv: 1000.2 GB

    You can use the following command:

    for x in `cat /proc/diskstats | grep -o 'sd.\|hd.\|md.' | sort -u`
        fdisk -l /dev/$x 2>/dev/nul| grep 'Disk /' | cut -d "," -f 1 
  2. Script That Deletes Old Files to Keep Disk From Filling Up

    August 19, 2011

    When a disk has no free space left, all kinds of trouble can occur.

    Therefore, I've created a script that monitors the used space of a volume and deletes the oldest file if a certain threshold is reached.

    The script will keep on deleting the oldest file present on disk until used capacity is below the threshold.

    So you can tell the script to monitor volume /storage and delete old files if the used capacity is bigger than 95 percent.

    The script works like this:

    ./ <mount point> <percentage>

    The mount point represents a volume or physical disk. The percentage represents the maxium used capacity threshold.

    The script reads the output of the 'df -h' command to determine 'disk' usage.


    bash-3.2$ ./ /Volumes/usb 92
    Usage of 90% is within limit of 92 percent.

    How let's see what happens when the threshold is exceeded.

    bash-3.2$ sudo ./ /Volumes/usb 92

    Usage of 97% exceeded limit of 92 percent.
    Deleting oldest file /Volumes/usb/a/file02.bin
    Usage of 91% is within limit of 92 percent.

    Here you notice that an old file is deleted and that the script checks again if there is now enough free space. If not, another file would have been deleted.

    If you have a need for it, have fun. It was a fun little scripting exercise.

    The script works under Linux and Mac OS X.

  3. Why I Still Won't Switch to Linux and Keep My Mac

    February 01, 2009

    The current state of Linux is amazing. If we take a look at, for example, Ubuntu Linux, we have to admit that the Linux desktop is really becoming a nice, user-friendly environment. I'm truly starting to like what I see. I considered whiping Mac OS X from my macbook, but there are some reasons why I won't. 

    • I like to mess around in Adobe Photoshop now and then. There is no serious Linux alternative.

    • I've got an iPhone, so now i'm 'stuck' with iTunes. I really like my iPhone btw.

    • I really like iPhoto, it is very easy to use and archive my photo's.

    • My entire music collection is in iTunes -> especially the song ratings are important.

    Maybe those reasons can be overcome. But for day-to-day usage, I still prefer Mac OS X above Linux. Especially software like iPhoto makes life so much easier. The hardware comes at a premium but I think it is worth it.

    Tagged as : Uncategorized
  4. Unattended Automatic Installation of Linux Nvidia Binary Driver

    January 13, 2009

    As part of an unattended installation, it was necessary to install a binary nvidia graphics driver. This is a manual proces by default. However, it can be done fully automatic:

    prerequisite: install xserver-xorg-dev package or similar xorg development package.

    sh -q -a -n -X -s

    That's all there is to it. The -q option means quiet, the -a option means accept licence, the -n action suppresses questions, the -X option updates the xorg.conf file and the -s option disables the ncurses interface.

    Tagged as : Uncategorized

Page 1 / 1