New to Linux world.


 
Thread Tools Search this Thread
Operating Systems Linux New to Linux world.
# 1  
Old 09-29-2005
Computer New to Linux world.

Hello~ I recently got a class of Linux. Im running Red Hat Linux. Can you guys help me out on the file extensions, and what they mean. Well the most common ones.

Also, how the file system works. I know the '/' is like the beginning of everything. This sounds a little stupid, but i wanna try to understand as much as i can and the most of it. Thanks!!
# 2  
Old 09-29-2005
# 3  
Old 09-29-2005
A little start...

I'll try to address your questions directly:

1. File extensions don't actually mean much in Linux. What matters more is the type of data in the file. The "geeky" way to find out what kind of data is in a file, is to pop open a command prompt and then use the 'file' command:

file <name of file here>

For example:
Code:
[snooter@squarebox snooter]$ file Out*mpg
Out West - New Mexico - Alien Country.mpg:  MPEG system stream data

That doesn't mean you shouldn't still use file extensions though. Many GUI application still rely on the file extensions to filter the list of files in an Open File dialog box. Depending on which platform you are coming from, it's likely you're pretty familiar with standard file extensions like .doc .txt .mp3 .mpg, etc... Those same file extensions still work in Linux as long as you have an application to use them with. The GNOME and KDE projects attempt to make this something you don't have to think about by having the environment automatically recognize file <--> application association.

2. The filesystem layout is a bit tricky if you're totally new to *nix and *nix-like OSes. You are correct that / is the root of the filesystem. It's actually a pretty well thought out approach vs the drive letter mentality of the Windows world. The reason being that your filesystem is NOT dictated by your storage devices. / can all be on one drive or partition, or it can contain multiple drives under it. For the most part it doesn't matter how you set it up as long as you know what you're doing. When starting off, it's best to just let the installer handle it. RedHat, if you have a single drive tends to default to something like this:

/dev/hda1 (Partition 1 on Hard Drive 1) ---> / (Usually the remaining space not used by /boot and swap below)
/dev/hda2 (Partition 2 on Hard Drive 1) ---> /boot (Usually 100 Megs)
/dev/hda3 (Partition 3 on Hard Drive 1) ---> swap (Sort of like virutal memory. Probably twice your physical RAM or more)

Under / you have:

/bin - This is where the basic system programs are stored. Stuff that is needed to run the system at a basic level

/boot - Where the kernel and possibly Grub boot loader configuration is stored. Not usually used when the system is up and running, but essential during boot or when compiling your own kernel

/dev - These are special files that represent most of your system's hardware. /dev/fd0 is your floppy for example, but you can't access it directly. It takes a while to get familiar with the ones you need most. Don't worry to much about it at the beginning.

/etc - System configuration files for various programs and services of the base OS distribution go here. This is a very important directory.

/home - This is where each regular user account gets a directory that only they and root have access to. This is also a very important directory and should get backed up. If you are logged in as a regular user (not root) when you double click on your "Home" folder, this is where you are looking at.

/initrd - This is a mountpoint for the initrd. I am fuzzy on the details, so maybe someone can help out here. All I know is that initrd is a special filesystem that the kernel, in some cases may load into RAM before it can mount / during the boot process. It's usually a stripped down temporary / that contains kernel modules and programs that are needed to complete a boot.

/lib - This is where basic system libraries that come with the distribution are stored. It's an essential directory.

/lost+found - This is where the ext2 filesystem stores orphaned files that were recovered during a filesystem check after an improper shutdown or some kind of corruption. It can be useful.

/misc - This appears to be used in RedHat by the autofs daemon. autofs allows automatic mounting of a filesystem (can be a floppy, CD-Rom, Windows share, NFS export, FTP site, etc...) when a user attempts to access it's mount point. Typically if nothing is mounted and you look in /misc, it's empty. But if you try to access, for example, /misc/my_nfs_share, there will suddenly be a folder called /misc/my_nfs_share that is mapped to that specific NFS exported directorty on another system. Look at the /etc/auto.master and /etc/auto.misc files. That should explain a little more about /misc

/mnt - Another empty directory that is historically used for mounting filesystems. Older RedHat systems used to use it for /mnt/floppy and /mnt/cdrom. Again, those two are empty directories. But if used like this:

Code:
mount -t iso9660 /dev/cdrom /mnt/cdrom

Then you would be able to access your CD-ROM by opening /mnt/cdrom in your file manager or at the shell.

/opt - Some applications will install here. They are typically programs that are not essential to the system's operation. Recently I installed one of the OpenOffice betas and it installed in /opt/openoffice.org1.9.125. When I've installed the shell based cd burning application 'cdrecord', it tends to install by default in /opt/schilly. KDE from source also tends to install there by default. I've never seen anything that is essential to normal shell level system operation installed in here.

/proc - This isn't really a normal filesystem. It's a place where the kernel places a lot of information about the system. Counters typically. Try these for some interesting info:

cat /proc/cpuinfo - Tells you the speed and capabilities of your CPU
cat /proc/swaps - Tells you if you have swap space and how much is in use right now
cat /proc/pci - Lists the PCI devices in your system

/root - This is the root user's home directory. It's kept separate from /home so that if something goes wrong with the /home filesystem (assuming it's on a separate disk, which is can be if you want it to) root can still log in and work on the system.

/sbin - This is where system binaries are stored. These are commands that root may use or that the system needs in order to run properly. Most of the time normal users don't need to use these programs. It is another essential directory.

/tmp - This is a location where any user can write a file and retain their own permissions on it. Other users can look at the file that the above mentioned user created, but they can't delete it or modify it, only the original creator can. It's also used by many programs for temporary files and many system services for special files like sockets and fifos.

/usr - This one is actually complex enough to warrant a few subdirs:
/usr/bin - This is where programs that normal users will use the most (text editors, much of the GNOME system or applications that RedHat bundled in for their distro) are located. They aren't apps that are needed for normal low level operation, so it isn't essential, but it is typicaly where most of the programs you'll interact with on a day-to-day basis as a normal user live.
/usr/etc - This is where config files for '/usr/bin' and '/usr/sbin' programs are stored It's exactly like '/etc', except it's specifically for the two above mentioned directories.
/usr/games - Just what it sounds like. The non-essential games apps should be stored here. Not a golden rule, but it gets used by stuff like Quake or UT.
/usr/include - This is where include header files are stored. These are essential to compiling and running apps. Much like the /lib directory above.
/usr/lib - This is exactly like the '/lib' directory, except that it specifically applies to the '/usr/bin' and '/usr/sbin' directories.
/usr/libexec - Not totally clear on this, but these appear to be executable libraries. Suffice it to say that there are some important but non-essential executables in this directory.
/usr/local - Hehehe... more complexity. Under '/usr/local' there are 'bin' 'etc' 'include' 'lib' 'libexec' 'sbin' directories and possibly more. This set of directories is typically used by software that YOU compile from source code. It completely duplicates the same functionality as the directories in / and '/usr'. The reasoning behind this is that you don't want your own compiled apps stomping over or getting mixed in with the '/usr/bin' or '/usr/sbin' or '/usr/etc' files asn this could create problems. It also makes it easy for you to know that the stuff you compiled is in one predictable place.
/usr/man - This is the set of directories that contain the manual or 'man' pages. These are basically help files for use in the shell. There can be man pages for GUI apps as well, but it's less common practice. Usually man pages apply to command line apps. To find out what command line app to use for a particular function type the following:

Code:
man -k <your topic>

/usr/sbin - Just like '/sbin' except it is again populated with non-essential programs for basic system operation.
/usr/src - Where most people tend to stash source code for applications they are compiling. Historically where the Linux kernel source code goes, usually under '/usr/src/linux'. You probably won't be using this until you get to compiling your own stuff. which many people never seem to get to...
/usr/tmp - Just a symbolic link (like a Windows shortcut only better) to '/tmp'. It exists for programs that look for '/usr/tmp' instead of '/tmp'.
/usr/var - Just like 'var' which I'll explain later on.
/usr/X11R6 - Contains another tree of 'bin' 'lib' 'include' and so on... This is specifically the X Window system location for X binaries, libraries, headers etc... Keep in mind that X Window does not mean GNOME or KDE. Those are layers that sit on top of X. X Window system can be thought of as a virutal video monitor with a ton of inputs and KDE, GNOME, Firefox, or other GUI applications are like DVD players, VCRs and satellite recievers that have content to display on X. This is all that sits in X is the subsystems for X Window system.

/var - This is where various bits of system and user data get written that are constantly changing. The '/var/log/messages' file is a text file that contains system log information and is constantly updated. '/var/spool/cron' contains the scheduled jobs for each user on the system should they choose to schedule any jobs. '/var/spool/mail' contains a file for each user that keeps mail for them from the system or other users on the system. '/var/lock' contains lock files for various applications that are sort of like placeholders to prevent certain things from happening to a file until a process using that file is completed. There's a ton more in '/var' but it should be pretty obvious that this is where dynamic data for system and user processes is placed. '/usr/var' is the same only for the '/usr/bin' and '/usr/sbin' programs.

That's as generalized as I can get, and I'm sure I'll get some correction here and there. Hope this gets you started. Good luck.
# 4  
Old 09-29-2005
MySQL Deckard knows... :)

Wow, i cant say how much i appreciate what you just wrote. I wasnt expecting such a detailed well put response. Thanks alot! That info was so good, it actually covered atleast 2-3 chapters of my books. Haha, thanks! I'm going to print this. Once again, thanks! Smilie Smilie Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

2 More Discussions You Might Find Interesting

1. What is on Your Mind?

Mad World Remix of Moby Video (Are You Lost In The World Like Me)

This is an excellent video comment on modern society and the remix is good too: https://www.youtube.com/watch?v=5DU1B_XkyIk 5DU1B_XkyIk Watch the video above and post your comments. (3 Replies)
Discussion started by: Neo
3 Replies

2. UNIX for Dummies Questions & Answers

a world of suse linux problems

1) how do i disable the graphic login in suse linux? 2) how do i disable the graphic boot-up in suse linux? 3) how do i disable the graphic console in suse linux? i think disabling graphic console will disable graphic booting, but what do i know, eh? 4) where is the dhcpcd directory and... (2 Replies)
Discussion started by: nydel
2 Replies
Login or Register to Ask a Question