Running Shell Commands in Zeppelin

This section shows you how to access files in your local file system and MapR-FS by using shell commands in your Apache Zeppelin notebook.

To use POSIX shell commands to access MapR-FS, you must have a MapR-FS mount point in your container. The FUSE-Based POSIX Client provides this functionality.
In the following example, your MapR-FS mount point is in /mapr and your cluster name is my.cluster.com. You can find the name of your cluster in the file /opt/mapr/conf/mapr-clusters.conf on your MapR cluster.
  1. Create a file of test data in /tmp:
    %sh
    cat > /tmp/test.data << EOF
    John,Smith
    Brian,May
    Rodger,Taylor
    John,Deacon
    Max,Plank
    Freddie,Mercury
    Albert,Einstein
    Fedor,Dostoevsky
    Lev,Tolstoy
    Niccolo,Paganini
    EOF
  2. Copy the file to your home directory in MapR-FS (/user/mapruser1) and display the contents of the file:
    %sh
    cp /tmp/test.data /mapr/my.cluster.com/user/mapruser1
    cat /mapr/my.cluster.com/user/mapruser1/test.data
    %sh
    hadoop fs -put /tmp/test.data /user/mapruser1
    hadoop fs -cat /user/mapruser1/test.data