Everything in Unix is a file - including the devices. It was just the philosophy when they created it.
The first character of the file type in the long listing tells you what kind of file it is:
>drwxr-xr-x 4 root other 512 Jan 9 2004 backup
lrwxrwxrwx 1 root root 9 Nov 19 2002 bin -> ./usr/bin
-rw-r--r-- 1 root root 6 Dec 6 2004 bpstart
-rw------- 1 root root 13115272 Jul 17 07:37 core
drwxr-xr-x 4 bin lp 512 Jan 31 2005 cron.p30
drwxr-xr-x 19 root sys 12800 Jul 17 07:15 dev
The “d” in the first position indicates a “directory” (don’t use the word “folder” - makes you sound like a (ugh!) Windows user). A directory is just a file of filenames (and other supporting information). It’s just a convenience in how you and the OS organize files - there’s no real folders/directories on a hard drive of course - no actual structure on the disk surface.
A “-” in the first position indicates a regular file, just a bunch of data blocks with a name attached. It could be a executable file, a script (like a .bat) file, or a flat file with a recipe for rice pudding - just a file.
An “l” (lower-case “L”) indicates a symbolic link (often called a “soft” link). This is a pointer to another file like the Windows “shortcuts”. Technically it’s an inode pointing to another inode but were getting pretty deep with that.
Devices come in one of two types, “c” and “b”, “character” and “block” devices respectively. The simple explanation is that these two types differ in how the OS buffers data to and from them. Character devices are usually serial ports, tty’s, pty’s, etc. Block devices tend to be disk drives, tape drives, and other bulk transfer devices.
brw-rw---- 1 root disk 8, 6 Jul 18 08:48 sda6
brw-rw---- 1 root disk 8, 7 Jul 18 08:48 sda7
crw------- 1 root root 4, 2 Jul 18 14:50 tty2
crw-rw---- 1 root tty 4, 20 Jul 18 08:48 tty20
If you notice, it’s very different from the file types above. Field 5, the “size” field for any of the regular file types is now two numbers separated by a comma. These are the major and minor numbers. A major number usually describes a specific kind of device, the minor number often controls the behavior of that device.
For example, a tape drive can have many different modes of operation, different densities, different compression factors, etc. This’ll usually reflect in using the same major number for the device and having different minor numbers.
Messing around, deleting devices and writing/reading to devices under /dev can have an affect on your running system - it’s only by the grace of the programmers that some of it is rebuilt when the box boots. It didn’t used to do this on older systems (I once deleted /dev/null and had a bear of a time getting it back).
Wanna see live memory? “cat /dev/mem”
Write to it and you can crash your system.
/proc is a view into the running kernel, too. Some of it is read-only but other things under there can be modified. You can alter the running kernel process and cause bad things[sup]tm[/sup] to happen if you’re not careful.
Unix has very few controls to keep you from shooting yourself in the foot. If Linux asks you “are you sure”, it’s because some programmer someplace knew that Linux is where a lot of newbies start. Traditional Unixes just let you merrily delete the entire file tree and don’t say “boo” until they refuse to boot later.