• Home
  • Docker
  • Kubernetes
  • LLMs
  • Java
  • Ubuntu
  • Maven
  • Big Data
  • Archived
Big Data | Spark Interactive Shell (Scala): spark-shell
  1. spark-shell command line options
  2. Start spark-shell
  3. spark-shell commands help
  4. spark-shell default import
  5. spark-shell default variables
  6. Running Linux commands

  1. spark-shell command line options

    • Scala REPL options:
    • Generic options:
    • Cluster deploy mode only:
    • Spark standalone or Mesos with cluster deploy mode only:
    • Spark standalone and Mesos only:
    • Spark standalone and YARN only:
    • YARN only:
  2. Start spark-shell
    Spark’s shell provides an interactive shell to learn the Spark API. It is available in either Scala (spark-shell) or Python (pyspark).


    Default Spark Session configuration:
  3. spark-shell commands help
  4. spark-shell default import
    spark-shell will automatically import some packages.
    To list the imported packages use the command :imports:

  5. spark-shell default variables
    spark-shell will create automatically an instance of Spark Session (accessible using spark variable) and an instance of Spark Context (accessible using sc variable).
    ► Spark Session available as "spark".
    ► Spark Context available as "sc".

    Spark Session variable:
    Spark Context variable:
    You can use auto-completion (tab key) to get available options:
  6. Running Linux commands
    First start by by importing the package sys.process._.
    To run a Linux command, just wrap it in double quotes followed by a dot and exclamation characters .!

© 2025  mtitek