Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
There are less than 24 hours left to vote in the 2011 LinuxQuestions.org Members Choice Awards. Click here to go to the polls. Vote now and make sure your voice is heard!
I'm confused about some of the basic root directories. I'm posting what I think they do, please correct me where I am wrong. (Using slack10)
/etc
Some config files are found here
/usr
I think this is where you install user wide programs. For example, I compile programs into /usr/local/src/app and then install to /usr/local/bin /usr/local/lib etc...
/var
What is this directories purpose?
/opt
What is this directories purpose? It only KDE uses this dir.
/sys
This is empty, does/did it have some purpose?
/tmp
I'm assuming it's a temperary dir, that it's contents eventually get deleted, but I don't know how it works.
1) What's sticky for? I do
Code:
$ file /tmp/
/tmp/: sticky directory
Reading man chmod, I think this is so everyone can write to /tmp, but can't overwrite/delete other user's files?
2) Does the /tmp dir get cleaned up itself, or should I write a script to delete it every once in a while?
3) Do you ever use the /tmp dir? For example if I did "$ find / -name foo 2>/dev/null 1>results", would you perhaps save the results on /tmp because it will get erased automatically?
Distribution: At home: Arch, OpenBSD, Solaris. At work: CentOS, Debian, Ubuntu
Posts: 3,558
Rep:
1) You got the purpose of the sticky bit exactly right (it's called the sticky bit because in the days of yore, it was used on commonly-accessed executables to keep their text segments in memory, making them "sticky". When Unix got proper demand paging of memory back in the '70s, this was no longer needed, so the bit was re-used to provide an extra level of acces permissions to directories).
2) Depends on the distro -- some have scripts that clean up /tmp on reboot, and some don't. Writing a script to clean out files from /tmp that haven't been accessed in 3 days or more is a good newbie shell scripting project.
3) Yes, I use /tmp quite a bit. Mozilla and Firefox also download stuff to /tmp (like when you open a PDF from a Web page, the PDF is actually saved in /tmp).
I use /tmp frequently when I know I am going to create a mess of files that I will never miss. Basically, if I am testing a script... I will usually testbed it in a directory I make in /tmp (this is techically rude on multi-user systems as filling up /tmp with your junk might cause it to become full if it is on a seperate partition... but this is my personal computer so bah). I do that because I do have a cron script which removes all files which haven't been touched in three days. So, I can safely forget about it after I am done.
It is like being a kid again. I never have to clean up after myself... I just leave my toys laying about and my mother (the OS) cleans them up for me.
The /var directory is traditionally for things that change size dynamically. For example print spool files, mysql db files, apache, lock files and log files, etc etc ad nauseum :-)
Originally posted by frob23 /sys should be a link into the kernel sources. If it is empty then you might not have installed the source. [/B]
I haven't compiled a new kernel yet, so maybe it changes, but for me /usr/src/linux is a symbolic link to /usr/src/linux-2.4.26/ which is my kernel source. /sys is a regular directory. (That's empty)
2) When writing a shell script to remove files older than X days, what should I do to special files? I noticed at least a socket, and a symbolic link files. Would I just "rm /tmp/oldFile" regardless if they are normal files? Or should I test for that and only remove files/dirs that are normal?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.