Freeing up space

Discussion in 'General Mac Discussion' started by sparrow, Jul 26, 2004.

  1. sparrow macrumors newbie

    Joined:
    Jul 21, 2004
    #1
    I just installed panther and it swamped my hard drive. I have hardly any space left, so I am trying to get rid of things that I don't need.

    For example, if I never plan on running any os 9 programs can I get rid of the os 9 system folder somehow?

    Are there any other files that are unusually big and useless that normally get installed with os 10.3?

    Is there any way to search files on the computer by size? For example if I want to see a list of the 10 largest files on my hard drive how would I do that?
     
  2. zimv20 macrumors 601

    zimv20

    Joined:
    Jul 18, 2002
    Location:
    toronto
    #2
    here's a start:
    % (cd /; du | sort -nr | head)


    that'll include directories. whack the | head part if you want to see the whole thing.

    to just get the files, that'd probably require use of the find command.
     
  3. jsw Moderator emeritus

    jsw

    Joined:
    Mar 16, 2004
    Location:
    Andover, MA
    #3
    Someone recommended this in another post.

    Also, do not delete the OS 9 folder unless you never want to run anything in Classic mode. It's not a big folder, anyway.
     
  4. jsw Moderator emeritus

    jsw

    Joined:
    Mar 16, 2004
    Location:
    Andover, MA
    #4
    Slight modification:


    cd /Volumes/"Macintosh HD"
    sudo du | sort -nr | head


    where you can replace "Macintosh HD" with your drive name, if it's different. The 'sudo' part lets you find more stuff than just a regular check. Still, I'd look into using DiskSweeper. This way doesn't list individual files.

    Also, if you upgraded to Panther, there might be system archive files you don't need sitting around....

    Big, easy way to get rid of excess space: get rid of iDVD.
     
  5. yellow Moderator emeritus

    yellow

    Joined:
    Oct 21, 2003
    Location:
    Portland, OR
    #5
    If you prefer a more GUIfied way to look at your machine and file size, you should get OmniDiskSweeper.
     
  6. zimv20 macrumors 601

    zimv20

    Joined:
    Jul 18, 2002
    Location:
    toronto
    #6
    yes, good changes
     
  7. zimv20 macrumors 601

    zimv20

    Joined:
    Jul 18, 2002
    Location:
    toronto
    #7
    okay, it was hard as hell trying to come up w/ one line's worth of unix commands to do this, so i wrote a script instead:

    Code:
    #!/bin/sh
    #-----------------------------------------------------------------
    #
    # %Z%%M% %I% %G%
    #
    # biggest -
    #       find the biggest files on the drive or given directory
    #
    #       -n how many to find (default is 10)
    #       -d start dir (default is /)
    #       -r run as root (requires superuser password)
    #       -h help message
    #
    # sxz 7/26/04
    #
    #-----------------------------------------------------------------
    
    PROGRAM=`basename $0`
    USAGE="usage: $PROGRAM [-n <number of files to show>] [-d <start directory>] [-r] [-h]"
    
    exit_prog()
    {
            exit $1
    }
    
    init_prog()
    {
            TMPFILE1=/tmp/biggest1_$$
            TMPFILE2=/tmp/biggest2_$$
            TMPFILE3=/tmp/biggest3_$$
    }
    
    size_all_files()
    {
            cd $STARTDIR
            $SUPERUSER du -a > $TMPFILE1
    }
    
    remove_directories()
    {
            while read SIZE FILENAME
            do
                    # this particular style of cut leaves a
                    # space in front of the result...
    
                    FILETYPE=`file "$FILENAME" | cut -f2 -d":"`
    
                    # ...so we take the space into account when
                    # looking for 'directory', and only write
                    # non-directories to the temp file
    
                    if [ ! "$FILETYPE" = " directory" ]
                    then
                            echo $SIZE $FILENAME  >> $TMPFILE2
                    fi
            done < $TMPFILE1
    }
    
    sort_files()
    {
            sort -nr $TMPFILE2 > $TMPFILE3
    }
    
    display_results()
    {
            head -n $FILECOUNT $TMPFILE3
    }
    
    cleanup()
    {
            \rm -f $TMPFILE1 $TMPFILE2 $TMPFILE3
    }
    
    #
    # main routine
    #
    
    FILECOUNT=10
    STARTDIR="/"
    SUPERUSER=""
    
    while getopts rhn:d: ARG
    do
            case $ARG in
                    n) FILECOUNT="$OPTARG";;
                    d) STARTDIR="$OPTARG";;
                    r) SUPERUSER="sudo ";;
                    [h\?])  echo $USAGE; exit_prog 0;;
            esac
    done
    
    shift `expr $OPTIND - 1`
    
    init_prog
    size_all_files
    remove_directories
    sort_files
    display_results
    cleanup
    
    cut/paste this into a text file and call it 'biggest'. some usage:

    to get help:
    % biggest -h

    to run it from the current directory:
    % biggest -d .

    to show the 50 biggest files in your home:
    % biggest -d ~ -n 50

    to show the 10 (default) biggest on your main drive, but as root (access all files, you'll be prompted for a superuser password):
    % biggest -r

    enjoy!
     
  8. jsw Moderator emeritus

    jsw

    Joined:
    Mar 16, 2004
    Location:
    Andover, MA
  9. iShater macrumors 604

    iShater

    Joined:
    Aug 13, 2002
    Location:
    Chicagoland
    #9
    Ok, I am definitely impressed. You made me miss my UNIX admin days! :)
     
  10. zimv20 macrumors 601

    zimv20

    Joined:
    Jul 18, 2002
    Location:
    toronto
    #10
    :)

    once upon a time, i got paid to do this stuff. i can't believe how much i've forgotten!
     
  11. Duff-Man macrumors 68030

    Duff-Man

    Joined:
    Dec 26, 2002
    Location:
    Albuquerque, NM
    #11
    Duff-Man says....when you installed, did you install all the extra printer drivers? That'd be a good place to start cleaning out if you did. Another trick - and one you should use with a bit caution - is to remove all the "localizations" you don't need. Even though you maybe only chose "U.S. English" during your install, many programs still have lots of the other language packs installed. Something like DeLocalizer can help get rid of a lot of it...oh yeah!
     
  12. iShater macrumors 604

    iShater

    Joined:
    Aug 13, 2002
    Location:
    Chicagoland
    #12
    Ditto... except that I got student minimum wage to do it (in school) and I obviously forgot waaaaaaay more than you have!

    Actually once of the reasons I switched to the Mac is to get back into it. My Linux box has not been booted in over a year!

    Back on topic:
    What I realized when I ran out of space is the amount of JUNK I have stored. Downloads I don't need, projects that I started and never finished, etc. We should all start archiving things that we know we won't need on the system that often.
     

Share This Page