A Linux User Reference

Search tips
  • search ignores words that are less than 4 characters in length
  • searches are case insensitve
  • if a search does not return anything try it in Boolean mode then Query expansion mode by checking the appropriate radio button e.g. searching for 'cron' in just the Administration category returns nothing - presumably because the 50% threshold is reached. Boolean mode ignores this threshold so a search for 'cron' returns several hits
  • in Boolean mode preceding a word with a '+' means the result must include that word, a '-' means it must not
  • in Boolean mode '+crontab -anacron' means match articles about crontab that DO NOT mention anacron
  • to match a phrase e.g. 'manage system' check the Boolean mode radio button and enclose the phrase in quotes "some phrase ..."
  • in Query expansion mode the search context is expanded beyond the keywords you entered - relevancy of hits may well be degraded



  • Serial devices

    Linux serial devices

    • IP-packets over a serial link.
    • /dev/cua* for dialling out is obsolete since kernel > 2.2.

    There are the 4 serial devices corresponding to COM1 - COM4.

    /dev/ttyS0  (COM1) address 0x3f8 IRQ 4
    /dev/ttyS1  (COM2) address 0x2f8 IRQ 3
    /dev/ttyS2  (COM3) address 0x3e8 IRQ 4
    /dev/ttyS3  (COM4) address 0x2e8 IRQ 3

    ttyS[0-3] are character devices for the serial terminal lines

    In many distributions special files come pre made, if not then 'mknod' or the script 'MAKEDEV' can be used to create them.

  • Make block or character special files

    Command usage

    Some options
     -m | --mode=MODE             Set file permission bits to MODE, not a=rw - umask
     --help                       Display this help and exit
     --version                    Output version information and exit
    b             Create a block (buffered) special file
    c, u          Create a character (unbuffered) special file
    p             Create a FIFO
    • Both MAJOR and MINOR must be specified when TYPE is b, c, or u and they must be omitted when TYPE is p.
    • If MAJOR or MINOR begins with

      • 0x or 0X it is interpreted as hexadecimal
      • 0 as octal
      • else as decimal

    Create serial character devices

    mknod -m 660 /dev/ttyS0 c 4 64            # base address 0x3f8
    mknod -m 660 /dev/ttyS1 c 4 65            # base address 0x2f8
    mknod -m 660 /dev/ttyS2 c 4 66            # base address 0x3e8
    mknod -m 660 /dev/ttyS3 c 4 67            # base address 0x2e8
    chown root:tty /dev/ttyS[0-3]

    These are nearly always pre-made. Need to have root privileges.

    Create a serial device MAKEDEV script

    $ cd /dev; sudo MAKEDEV ttyS0

    Creating serial device for multiport boards

    $ sudo mknod -m 666 /dev/ttyS17 c 4 81
    $ cd /dev
    $ sudo MAKEDEV ttyS17

    Add 64 to the port/minor number e.g. 64+17=81 when using 'mknod'.

  • Login program
    /sbin/getty, agetty

    Program that handles the login process - /sbin/getty, agetty

    • Opens a tty port, prompts for a login name and invokes the '/bin/login' command.
    • It is normally invoked by 'init' via /etc/inittab entry(s) or /etc/init.d/<script>.
    Program Description
    agetty Is the third variation of getty - alternative linux getty
    getty_ps Two getties. getty is used for console, and terminal devices - uugetty is used for modems
    mgetty In addition to allowing logins, mgetty also provides class 2 FAX support through sendfax

    Command usage

    agetty [options] port baud_rate ...  [term]
    agetty [options] baud_rate ...  port [term]
    Some options:
     -8              Assume that the tty is 8-bit clean, hence disable parity 
     -h              Enable hardware (RTS/CTS) flow control. It is left up to 
                     the application to disable software (XON/XOFF) flow protocol
                     where appropriate.
     -i              Do not display the contents of /etc/issue (or other) before 
                     writing the login prompt.  Some hardware may become confused
                     if a lot of text is received at the wrong baud rate. Dial-up
                     scripts may fail if the login prompt is preceded by too much text.
     -m              Try to extract the baud rate the CONNECT status message produced
                     by Hayes(tm)-compatible modems.
     -n              Do not prompt the user for a login name. This can be used in 
                     connection with -l option to invoke a non-standard login process
                     such as a BBS system.

    See man page for more options and explanations.

    Man pages /etc/inittab entry examples

    # For a hard-wired line or a console tty
    /sbin/agetty 9600 ttyS1
    # For a directly connected terminal without proper carriage detect wiring:
    # (try if your terminal just sleeps instead of giving you a password: prompt.)
    /sbin/agetty -L 9600 ttyS1 vt100
    # For a old style dial-in line with a 9600/2400/1200 baud modem:
    /sbin/agetty -mt60 ttyS1 9600,2400,1200
    # For a Hayes modem with a fixed 115200 bps interface to the machine
    # (the example init string turns off modem echo and result codes, makes 
    # modem/computer DCD track modem/modem DCD, makes a DTR drop cause a 
    # disconnection and turn on auto-answer after 1 ring.)
    /sbin/agetty -w -I ATE0Q1&amp;D2&amp;C1S0=1\015 115200 ttyS1
  • View and set serial device configuration

    Probably need to install

    $ apt-cache search setserial
    setserial - controls configuration of serial ports

    Determine current serial device and UART settings

    $ dmesg | grep ttyS
    [    1.047616] serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
    [    1.068838] 00:0a: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
    $ sudo grep -v unknown  /proc/tty/driver/serial 
    serinfo:1.0 driver revision:
    0: uart:16550A port:000003F8 irq:4 tx:0 rx:0
    # setserial -G /dev/ttyS0
    /dev/ttyS0 uart 16550A port 0x03f8 irq 4 baud_base 115200 spd_normal skip_test

    Use output from previous setserial command, modified if required, to configure device

    # setserial /dev/ttyS0 uart 16550A port 0x03f8 irq 4 baud_base 115200 spd_normal skip_test
    # setserial /dev/ttyS0 port 0x03f8 irq 4 autoconfig

    Check that a symlink exists - common practice

    # ls -al /dev/modem
    lrwxrwxrwx 1 root root 7 2009-01-19 12:58 /dev/modem -> ttyS0

    Check to see settings are as intended

    # setserial -a /dev/ttyS0
    /dev/ttyS0, Line 0, UART: 16550A, Port: 0x03f8, IRQ: 4
    Baud_base: 115200, close_delay: 50, divisor: 0
    closing_wait: 3000
    Flags: spd_normal skip_test