Slashdot Mirror


How To Manage Your Home Directory?

gustgr writes "There are times I got surprised after running ls in my $HOME directory. It is filled with trash, test files, directories that were supposed to be only temporary, ascii files with quick notes and all sort of stuff. In other words, it is a complete mess. Then I remove the trash, clean up the directories, run the mv command a few times and everything looks good and normal again. Two weeks later the disorder is back and I have to handle it again. How do you manage your home directory in order to keep it clean? Are your homes a mess too?" I usually keep folders labeled "audible," "visible," "legible," and "work," and subfolders within these that are at least mostly consistent between computers / drives; every day or so I sweep loose files into these, then open each folder, sort, repeat. How do you sort your data?

6 of 176 comments (clear)

  1. mkdir subdirectory by SpaceLifeForm · · Score: 4, Informative

    Always make a directory and put the files you are dealing with in it immediately. Don't wait.

    --
    You are being MICROattacked, from various angles, in a SOFT manner.
  2. My layout by debaere · · Score: 3, Informative

    My home directory ussually looks like the following:

    ~/download - for all downloaded files. If I am downloading many related files I put them in appropriately named sub dirs
    ~/library - for any documentation downloaded from the net, and a copy of my O'Reilly CD Bookshelves
    ~/temp - for a temp directory
    ~/test - for temp files from tarballs and installations
    ~/bin - for locally installed apps
    ~/work - for a temporary work space when working on projects
    ~/devel - all personal programming projects
    ~/locker - any other files I wish to keep
    ~/Document - any office or other personal documentation.

    The only files I purposely keep in the root of my home directory (aside from the dot-files) is a running todo list of notes and tasks, all of which is contained in one file.

    --

    DOS is dead, and no one cares...
    If there's a Bourne Shell, I'll see you there
  3. Check early, check often by ctr2sprt · · Score: 3, Informative
    The only real way to handle it is to get in the habit of checking your home directory for cruft on a regular basis. Do what you can to save longer-term things directly to where they will be saved, but that will only mitigate the problem. If you can't remember to check, write a cron job which emails you if your home directory gets more than a certain number of files. Something very simple like:

    0 0 * * * if [ `ls -d $HOME/* | wc -l` -gt 20]; then echo 'Too much stuff!'; fi
    One problem which I have is the creation of temporary directories for archives. Most tar files, as you know, extract to a directory. So if I get package-1.2.3.tar.gz, I also usually have a package-1.2.3 directory lying around. Even if I want to save the original .tar.gz file it's pointless to have the directory there too. You might want to write a script which looks for those stale directories. Don't run it automatically, of course: just keep it in ~/bin or someplace so you can run it as step 1 of the cleanup process.

    Something like this might work:

    #!/bin/sh

    find "$1" -type f -name '*.tar.gz' | (
    while read tarfile; do
    basedir=`dirname "$tarfile"`
    tarbasedir=`tar tzf "$tarfile" | head -1`
    tardir="$basedir/$tarbasedir"
    if [ -d "$tardir" ]; then
    spaceused=`du -s $tardir | cut -f1`
    echo "$spaceused $tardir $tarfile"
    fi
    done
    )
    Then you run it as follows:

    % ./sm .
    3201 ./psybnc/ ./psyBNC2.3.1.tar.gz
    904320 ./download/BitTorrent-3.4.2/ ./download/BitTorrent-3.4.2.tar.gz
    14742 ./download/eggdrop1.6.16/ ./download/eggdrop1.6.16.tar.gz
    130583&nbsp ; ./download/mysql-4.1.3-beta/ ./download/mysql-4.1.3-beta.tar.gz
    29350 ./BitchX/ ./ircii-pana-1.1-final.tar.gz
    The output is in three fields: space used by the directory, the directory name, and the tar.gz file where we found the original. You can be asked to delete anything it finds with:
    % ./sm . | awk '{print $2}' | xargs rm -i
    If you want to be a little safer you can just delete the original .tar.gz files. Substitute $3 in the awk expression in that case. And finally, again using awk, you can delete only directories which use up more than a certain amount of space with something like '{if($1 > 5000) print $2}'.

    You can also whip something up using find to look for files which haven't been accessed in more than a certain number of days. Reading a file updates its atime, so that's a pretty secure way to find stale temporary files.

    % find ~ -type f -atime +60
    For real zaniness, add xargs basename, sort, uniq -c, and sort -n. That'll get you a breakdown of how many applicable files found in each directory and sort it for you.

    Ain't Unix awesome?

  4. Pedantic. by fuzzybunny · · Score: 2, Informative

    - ~/bin -- my own executables and scripts
    - ~/tmp -- gets nuked every time I log out
    - ~/public_html -- obvious
    - ~/Graphics -- pics 'n crap
    - ~/Funny -- obvious
    - ~/Mail -- imap folders
    - ~/Work -- anything work-related
    - ~/Docs -- well, docs
    - ~/Tunes -- mp3s and the likes
    - ~/Misc -- depending on the account

    I try to keep the "standard" folders and those containing my personal junk separated by capitalizing the first letter of the ones I tend to dump stuff into manually. I know it's utterly anal, but it's worked for me for > 13 years.

    --
    Cole's Law: Thinly sliced cabbage
  5. My $HOME by JabberWokky · · Score: 3, Informative
    I have the following:

    bin - contains a set of script files that do personal things, plus a handful of binaries.

    doc - contains documents that I've created. Broken down quite carefully:
    doc/coding - personal projects
    doc/fandom - various groups and activities I do
    doc/karma - a large software project I work on
    doc/life - real world things: maps and notes about camp sites and dating ideas, family things
    doc/photo - photos I have taken organized by date (doc/photo/year/month/day)
    doc/photo/found - photos of friends I have found
    doc/projects - various projects I work on, the cast I direct, etc.
    doc/songs - songs I have written and notes on covers I perform
    doc/system - notes on hardware, software and my network
    doc/text - essays, stories, etc. that I have written
    doc/work - memos and invoices (actual work files are below

    ks - my primary work project, a large source tree

    pub - data files I've downloaded or ripped/encoded.
    pub/games - roms for emulators
    pub/image - very organized images from all over the place, from 10th century tapestries to scans of Manning's fetish lineart.
    pub/music - organized by genre
    pub/text - ebooks (first level is erotica, fiction, nonfiction, reference, rpg and scripts).
    pub/video - very very organized and quite deep. I've been encoding my extensive DVDs and VHS collection for quite awhile now.

    usr - contains system settings, in $HOME so I can sync (more info later)
    usr/etc/cron - network wide cronfiles, these sync everything and are symlinked.
    usr/etc/dot - all my dot files ($HOME/.*). rc files and config directories. I sync my settings and back them up.
    usr/etc/fileindex - index of pub (since pub doesn't exist on my laptop when I'm not NFSed to it).
    usr/etc - also contains hosts and ssh info.
    usr/install - tarballs and rpms to install everything the way I like it.
    usr/log - chat logs and the like
    usr/palm - my palm apps and backup/sync directories. I can drop text files in here and they appear as ebooks on my palm. Go KPilot!
    usr/share - contains various media and configuration files. Top level under this are ( desktop fonts icons kde kde.betty kde.riffraff ksubtle menu.betty music people sound wallpaper ). The kde.hostname directories are my configs for my laptop and desktop, and $HOME/.kde/share symlinks to them. Thus my kde config is backed up and synced. music here are startup/shutdown and alert music. people are face shots of individuals for use in PIM apps. icons is a personal set of icons.

    work - contains a directory for each client.

    www - contains a mirror for each of the sites I maintain (my personal ones - the professional ones are way too big).

    In addition to the above, I have a directory named pool on my laptop - that's media files (a few movies, tv shows, some talk radio programs) that I know I can delete without worry since they are in pub on the home file server. Stuff to watch when I'm waiting or bored.

    I also have a tmp, which on my laptop NFS mounts to tmp on my home server. It contains inbound and unsorted items. I get about four gigs, burn, index the disc and then move them into pub. I can recreate pub with my spindles and index.

    Finally I have a $HOME/betty on my laptop. My laptop's name is betty, and it contains anything that I downloaded directly to the laptop and I want to keep... sort of the opposite of $HOME/pool. Things here go to $HOME/tmp, and then go through the "burn/index/move to pub" cycle.

    As a result, I can find any file I want in nearly a terabyte of data that goes back 25 years, some of it Apple ][ files BBS logs. I am not done indexing my offline media - I need to get a high quality turntable for some virgin vinyl that has content that has never been released on CD. Plus some VHS tapes that have never been (and is unlikely to be) released on DVD. I also have a small collection of 16mm and 35mm trailers for various odd and cult films.

    For awhile I ou

    --
    "$30 for the One True Ring. $10 each additional ring!" -- JRR "Bob" Tolkien
  6. Re:recompile everything by hand by Lord+Bitman · · Score: 2, Informative

    oh, yes, tradition is definatly the most tried and tested excuse for doing something which makes no sense at all.

    I use linux to avoid stupid things like "Desktop Folders". Isnt this article supposed to be about /eliminating/ clutter?

    As for those who modded my other post "Troll", you know you actually CAN re-compile everything by hand, and if you do this kind of thing because of tradition you really should just fucking die already, no troll about it.

    --
    -- 'The' Lord and Master Bitman On High, Master Of All