# man > expect_autoexpect(1)

---
type: CommandReference
command: autoexpect
mode: man
section: 1
source: man-pages
---

## Quick Reference

- `autoexpect` — spawn a shell and generate `script.exp`
- `autoexpect ftp ftp.cme.nist.gov` — spawn ftp and generate `script.exp`
- `autoexpect -f nist ftp ftp.cme.nist.gov` — specify output file name
- `autoexpect -c` — conservative mode (pause 0.1s before each character)
- `autoexpect -C ^L` — toggle conservative mode with Ctrl-L
- `autoexpect -p` — prompt mode (only match last line of output)
- `autoexpect -P ^P` — toggle prompt mode with Ctrl-P
- `autoexpect -quiet` — suppress informational messages

## Name

autoexpect — generate an Expect script from watching a session

## Synopsis

`autoexpect [args] [program args...]`

## Options

- `-f <file>` — write script to `<file>` instead of default `script.exp`
- `-c` — start in conservative mode (pause 0.1s before sending each character)
- `-C <key>` — define a key to toggle conservative mode (e.g., `^L` for Ctrl-L)
- `-p` — start in prompt mode (only look for the last line of program output, usually the prompt)
- `-P <key>` — define a key to toggle prompt mode (e.g., `^P` for Ctrl-P)
- `-quiet` — disable informational messages
- `-Q <char>` — define a quote character to enter toggle keys literally

## Examples

shell
# Default: spawn a shell, generate script.exp
autoexpect

# Spawn ftp, write script to nist
autoexpect -f nist ftp ftp.cme.nist.gov

# Conservative mode to avoid timing issues
autoexpect -c

# Toggle conservative mode with Ctrl-L
autoexpect -C ^L

# Prompt mode for programs with variable output (e.g., date)
autoexpect -p

# Combine quote and toggle keys
autoexpect -P ^P -C ^L -Q ^Q
## See Also

- [AUTOEXPECT(1) man page](https://www.chedong.com/phpMan.php/man/AUTOEXPECT/1/markdown)
- "Exploring Expect: A Tcl-Based Toolkit for Automating Interactive Programs" by Don Libes, O'Reilly and Associates, January 1995.
- `expect` (1)