You are currently viewing How do you exit or quit Spark Shell & PySpark?

To exit or quit the PySpark shell, you can use the exit(), quit() functions or Ctrl+z, these commands will close the PySpark shell and return you to the terminal or environment where you launched it.

To exit or quit from the Spark shell (spark-shell), you can use the :quit, :q or Ctrl+z, these commands will close the Spark shell and return you to the terminal or environment where you launched it.

1. Exit or Quit from Spark Shell

Like any other shell, spark-shell also provides a way to exit from the shell. When you are in spark shell type :quit to come out of the shell prompt.

spark shell exit

Alternatively, you can also use Ctrl+z to exit from the shell.

2. Exit or Quit from PySpark Shell

Similarly, to exit or quit from pyspark shell, you can use either quit() or exit() from shell prompt. Let’s launch the shell, run some examples, and exit from it.

pyspark shell exit

Alternatively, you can also try Ctrl+z to exit from the pyspark shell.

Conclusion

In summary, exiting the PySpark shell involves using the exit() or quit() functions, or pressing Ctrl+z. Similarly, in the Spark shell (spark-shell), you can exit by employing :quit, :q, or Ctrl+z. Executing any of these commands effectively shuts down the shell, returning you to the initial terminal or environment.

Happy Learning !!