• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

expect: command not found

by Deepika

expect is a powerful scripting language and program that is used to automate interactions with other programs that require user input. It is particularly useful for automating tasks that are interactive in nature, such as running a command-line program and providing input when prompted, or logging into a remote server and running commands on it.

The expect program works by running a script that contains a set of instructions on how to interact with the other program. These instructions include things like sending input to the program, waiting for specific text to appear on the screen, and responding to that text in a specific way. For example, a script might send a command to a remote server and then wait for a prompt asking for a password. Once the password prompt appears, the script would automatically send the correct password and then continue with the next set of instructions.

expect scripts are often used in conjunction with other scripting languages such as bash, in order to automate complex tasks and workflows. It can also be used to automate repetitive tasks, such as running a series of commands on a remote server, and can also be used to automate testing and validation of software.

Overall, expect is a powerful and flexible tool that can be used to automate a wide range of interactive tasks, making them faster and more reliable.

If you encounter the below error while running the command expect:

expect: command not found

you may try installing the below package as per your choice of distribution:

Distribution Command
Debian apt-get install expect
Ubuntu apt-get install expect
Alpine apk add expect
Arch Linux pacman -S expect
Kali Linux apt-get install expect
CentOS yum install expect
Fedora dnf install expect
OS X brew install expect
Raspbian apt-get install expect

expect Command Examples

1. Execute an expect script from a file:

# expect path/to/file

2. Execute a specified expect script:

# expect -c "commands"

3. Enter an interactive REPL (use `exit` or Ctrl + D to exit):

# expect -i

Filed Under: Linux

Some more articles you might also be interested in …

  1. How to Check if a Service Restart or Server Reboot is required After RPM Package Update (CentOS/RHEL/Fedora)
  2. CentOS / RHEL 6,7 : How to disable or delete virbr0 interface
  3. locate Command Examples in Linux
  4. CentOS / RHEL : How to allow or deny Users to login to VSFTP Server
  5. CentOS / RHEL 5 : How to configure Interface bonding (NIC teaming)
  6. How to install and configure VNC Server on CentOS/RHEL 8
  7. How to cancel or pause live migrations using virsh
  8. Time to live exceeded ping error
  9. groupmod Command Examples in Linux
  10. What are SELinux Users and how to Map Linux Users to SELinux Users

You May Also Like

Primary Sidebar

Recent Posts

  • fprintd-delete Command Examples in Linux
  • fprintd-delete: command not found
  • foreman: command not found
  • foreman Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright