You are here:About>Computing & Technology>Focus on Linux
About.comFocus on Linux
Linux Newbie Administrator FAQ: Basic Configurations

Part 4 of the Linux Newbie Administrator Guide

4.4.5 What are all the device files?
(continued after the ads...)

Related Resources
Linux Newbie Administrator Guide
0. Linux Benefit
1. Before Installation
2. Linux Resources/Help
3. Basic Operations FAQ
4. Newbie Admin FAQ
~ 4.1 Lilo
~ 4.2 Drives
~ 4.3 X-Windows
~ 4.4 Configurations
~ 4.5 Networking
5. Shortcuts / Commands
6. Linux Applications
7. Learn Linux Commands
A. How to Upgrade Kernel?

Devices appear as files in the directory /dev. They can be read, or written to, if you have the permission to do so. The listing of the file reveals some important details about the device, for example:

ls -l /dev/ttyS3

on my system produces the following output:

crwxr-xr-x 1 root tty 4, 67 Mar 13 22:59 ttyS3

The initial "c" indicates a character device. "b" would mean "block device", "p"=FIFO device, "u"=unbuffered character device, "d"=directory, "l"=symbolic link. The numbers "4, 67" mean that the device major number is 4 and the minor number is 67. To make some devices usable to all users on your system, you may need to set the proper permissions. For example:
ls -l /dev/usb/scanner0
chmod 666 /dev/usb/scanner0

Here is a list of some common devices:

/dev/ttyS0 - the first serial port. The mouse is typically connected here.
/dev/ttyS1 - the second serial port. This may well be the device to which your modem is connected.
/dev/ttyS2 and /dev/ttyS3 the third and fourth serial port (typically not present, but your internal modem may well be configured as one of these).
/dev/modem - the serial modem. In the typical case, a symbolic link to /dev/ttyS1, /dev/ttyS2, /dev/ttyS3 or /dev/ttyS0, depending to which serial port your modem is connected.
/dev/mouse - mouse. In the typical case, a symbolic link to /dev/ttyS0 or similar (see above), depending to which serial port your mouse is connected.
/dev/lp0 - printer on the first parallel port. That's where normally printers are connected.
/dev/lp1 - printer on the second parallel port (typically not present).
/dev/fd0 - first floppy disk drive (almost always present).
/dev/fd0H1440 - driver for the first floppy drive in the high-density mode (1440 kB). Generally, this (or a driver with a device with a similar descriptive name) is invoked when formatting a floppy drive to a particular density. Slackware also comes with drivers that allow for formatting a 3.5" diskette with up to 1.7MB of space. Red Hat and Mandrake do not contain these device drivers files by default.
/dev/fd1 - second floppy disk drive.
/dev/hda - first IDE hard drive (whole drive). Most hard drives on IBM-compatibile PCs are IDE.
/dev/hdb - second IDE hard drive (whole drive). On many computers, the IDE cdrom drive is attached here.
/dev/hdc - third IDE drive (whole drive). On many computers, the IDE cdrom drive is attached here.
/dev/cdrom - a symbolic link to the appropriate drive interface, typically /dev/hdc or /dev/hdb (a CDROM) or /dev/scd0 (a CD-R/RW writer).
/dev/hda1 - the first partition on the first IDE hard drive. /dev/hda2 is the second partion on the first IDE hard drive. As one could guess, /dev/hdd8 would be the eight partition on the fourth IDE hard drive.
/dev/tty1 - the first text console. /dev/tty2 is the second text console, etc.
/dev/dsp - digital audio, i.e., the sound card. "dsp" stands for "digital signal processing".
/dev/sndstat - do cat /dev/sndstat to learn about the status of your sound devices.
/dev/null - used when you want to send output into oblivion.
/dev/random - used to read pseudo-random numbers. Do cat /dev/random to display garbage-looking characters on your screen. There is also /dev/urandom to generate lower-quality random sequences.
/dev/sda -the first SCSI drive (whole drive). On a home machine, you are unlikely to have any SCSI drives (expensive).
/dev/sdb - the second scsi drive ("sdc" is the third scsi drive, etc. There can be many scsi drive on a system).
/dev/sda1 - the first partition on the first scsi drive.
/dev/sr0 - the first scsi CD drive (sometimes called /dev/scd0). If you have an ATAPI CD writer, it will also be likely here.
/dev/sr1-is the second scsi CD drive (sometimes called /dev/scd1), (/dev/sr2 is the third scsi CD drive, etc. There can be many scsi CD drives on the system).
/dev/usb/scanner0 - a usb scanner. Try: less /usr/src/linux/Documentation/usb/scanner.txt for an info on scanner configuration from scratch.

For more info try:
less /usr/src/linux/Documentation/devices.txt
man MAKEDEV

As explained in /usr/src/linux/Documentation/devices.txt, I may need to create some symbolic links to device files locally to configure my system. This is merely a tabulation of existing practice, and does not constitute a recommendation. However, if the links exist, they should have the following uses:

/dev/mouse Current mouse port***
/dev/tape Current tape device
/dev/cdrom Current CD-ROM device***
/dev/cdwriter Current CD-writer device (but my RedHat have /dev/cdrecorder)
/dev/scanner Current scanner device
/dev/modem Current dialout (modem) port***
/dev/root Current root filesystem
/dev/swap Current swap device

The *** mark the symbolic links that are surely present on my Mandrake system. For example, if having problems with mouse I would do something like (as root):
ls -l /dev/mouse
[see if the mouse device is present and where it points]
ln -s /dev/ttyS0 /dev/mouse
[create a symbolic link so that /dev/mouse point to the first serial port]

For SCSI (and ATAPI) devices, /dev/tape and /dev/cdrom should point to the ``cooked'' devices (/dev/st* and /dev/sr*, respectively), whereas /dev/cdwriter and /dev/scanner should point to the appropriate generic SCSI devices (/dev/sg*).

Non-transient sockets and named pipes may exist in /dev. Common entries are:
/dev/printer socket lpd local socket
/dev/log socket syslog local socket
/dev/gpmdata socket gpm mouse multiplexer

Some Linux daemons

Daemons are "resident"programs that periodically wake up, check your system and may perform certain functions. They do not take any input and don't normally produce any output. Your Linux system is likely set to run quite a number of daemons. Most of them can be (dis)selected by running the program ntsysv (RedHat) as root and checking the appropriate box. The short description of each daemon is available under netsysv by pressing . If the daemon you need is not listed in ntsysv, you need to insert your RedHat/Mandrake installation CD and install the appropriate package. The alternative to ntsysv may be tksysv (type as root, in X terminal), which is perhaps more flexible, but way more complicated (it lets you set up the list of daemons to run in each runlevel). Another, simpler and even more powerful+flexible+difficult-to-use tool is /sbin/chkconfig.

Here is a short list of popular daemons with a brief description:

anacron - checks 'cron' jobs that were left out due to down time and executes them. Useful if you have cron jobs scheduled but don't run your machine all the time--anacron will detect that during bootup.
amd - automount daemon (automatically mounts removable media).
apmd - Advanced Power Management BIOS daemon. For use on machines, especially laptops, that support apm.
arpwatch - keeps watch for ethernet/ip address pairings.
atd - runs jobs queued by the "at" command.
autofs - control the operation of automount daemons (competition to amd).
bootparamd - server process that provides information to diskless clients necessary for booting.
crond - automatic task scheduler. Manages the execution of tasks that are executed at regular but infrequent intervals, such as rotating log files, cleaning up /tmp directories, etc.
cupsd - the Common UNIX Printing System (CUPS) daemon. CUPS is an advanced printer spooling system which allows setting of printer options and automatic availability of a printer configured on one server in the whole network. The default printing system of Linux Mandrake.
dhcpd - implements the Dynamic Host Configuration Protocol (DHCP) and the Internet Bootstrap Protocol (BOOTP).
gated - routing daemon that handles multiple routing protocols and replaces routed and egpup.
gpm - useful mouse server for applications running on the Linux text console.
httpd - daemon for the Apache webserver.
inetd - listens for service requests on network connections, particularly dial-in services. This daemon can automatically load and unload other daemons (ftpd, telnetd, etc.), thereby economizing on system resources. Newer systems use xinetd instead.
isdn4linux - for users of ISDN cards.
kerneld - automatically loads and unloads kernel modules.
klogd - the daemon that intercepts and displays/logs the kernel messages depending on the priority level of the messages. The priority is (copied from /usr/include/linux/kernel.h ):
KERN_EMERG "<0>" system is unusable
KERN_ALERT "<1>" action must be taken immediately
KERN_CRIT "<2>" critical conditions
KERN_ERR "<3>" error conditions
KERN_WARNING "<4>" warning condition
KERN_NOTICE "<5>" normal but significant condition
KERN_INFO "<6>" informational
KERN_DEBUG "<7>" debug-level messages
The messages typically go to the appropriately named files in the directory /var/log/kernel.

kudzu - detects and configures new or changed hardware during boot.
keytable - loads selected keyboard map.
linuxconf - the linuxconf configuration tool. The automated part is run if you want linuxconf to perform various tasks at boottime to maintain the system configuration.
lpd - printing daemon.
mcserv - server program for the Midnight Commander networking file system. It provides access to the host file system to clients running the Midnight file system (currently, only the Midnight Commander file manager). If the program is run as root the program will try to get a reserved port otherwise it will use 9876 as the port. If the system has a portmapper running, then the port will be registered with the portmapper and thus clients will automatically connect to the right port. If the system does not have a portmapper, then a port should be manually specified with the -p option (see below).
named - the Internet Domain Name Server (DNS) daemon.
netfs - network filesystem mounter. Used for mounting nfs, smb and ncp shares on boot.
network -activates all network interfaces at boot time by calling scripts in /etc/sysconfig/network-scripts .
nfsd - used for exporting nfs shares when requested by remote systems.
nfslock - starts and stops nfs file locking service.
numlock - locks numlock key at init runlevel change.
pcmcia - generic services for pcmcia cards in laptops.
portmap - needed for Remote Procedure Calls. Most likely, you need it for running network.
postfix - mail transport agent which is a replacement for sendmail. Now the default on desktop installations of Mandrake (RedHat uses sendmail instead).
random - saves and restores the "entropy" pool for higher quality random number generation.
routed - daemon that manages routing tables.
rstatd - kernel statistics server.
rusersd, rwalld - identification of users and "wall" messaging services for remote users.
rwhod - server which maintains the database used by the rwho(1) and ruptime(1) programs. Its operation depends on the ability to broadcast messages on a network.
sendmail - mail transfer agent. This is the agent that comes with Red Hat.
smbd - the SAMBA (or smb) daemon, a network connectivity services to MS Windows computers on your network (hard drive sharing, printers, etc).
squid - An http proxy with caching. Proxies relay requests from clients to the outside world, and return the results. You would use this particular proxy if you wanted to use your linux computer as a gateway to the Internet for other computer on your network. Another (and probably safer at home) way to do it, is to set up masquarading.
syslogd - manages system activity logging. The configuration file is /etc/syslog.conf .
smtpd - Simple Mail Transfer Protocol, designed for the exchange of electronic mail messages. Several daemons that support SMTP are available, including sendmail, smtpd, rsmtpd, qmail, zmail, etc.
usb - daemon for devices on Universal Serial Bus.
xfs - X font server.
xntpd - finds the server for a NIS domain and stores the information about it in a binding file.
ypbind - NIS binder. Needed if computer is part of Network Information Service domain.

Next > Part 4.5: Networking

Can't find what you are looking for?
Search the

Stay up-to-date!
Subscribe to the Linux free newsletter.

From Juergen Haas,
Your Guide to Focus on Linux.
FREE Newsletter. Sign Up Now!
Newsletters & RSSEmail to a friendSubmit to Digg
 All Topics | Email Article | | |
Advertising Info | News & Events | Work at About | SiteMap | Reprints | HelpOur Story | Be a Guide
User Agreement | Ethics Policy | Patent Info. | Privacy Policy©2008 About, Inc., A part of The New York Times Company. All rights reserved.