In [1]:
from jupyter_scp import JupyterSCP
Assuming that you have a secure.py
in the current directory. The contents of secure.py
should be as follows.
sshdata = {
"hostname": "misokatsu.tebasaki.nagoya-u.ac.jp",
"username": "hitsumabushi",
"key_file": "/Users/kishimen/.ssh/id_rsa",
"key_pass": "0123"
}
In [2]:
import secure
In [3]:
scp = JupyterSCP(**secure.sshdata)
In [4]:
scp.exe("date")
In [5]:
scp.ls()
In [6]:
scp.ls(All=True)
In [7]:
scp.ls(All=True, Sort=True)
In [8]:
scp.cd("unagi")
In [9]:
scp.cd("wget")
In [10]:
scp.pwd()
In [11]:
scp.cd("..") # Go to the parent directory
In [12]:
scp.pwd()
In [13]:
scp.cd("-") # Go to the ex-directory
In [14]:
scp.pwd()
In [15]:
scp.cd() # Go to the home directory
In [16]:
scp.pwd()
In [17]:
scp.mkdir("testJupyterSCP")
In [18]:
scp.cd("testJupyterSCP")
In [19]:
cmd = """cat <<'__EOT__'>> test.txt
This is a test for JupyterSCP.
__EOT__
"""
scp.exe(cmd)
In [20]:
scp.cat("test.txt")
In [21]:
scp.mv("test.txt", "test_renamed.txt")
In [22]:
scp.chmod("test_renamed.txt", mode=744)
In [23]:
scp.ls()
In [24]:
scp.cd("..")
In [25]:
scp.rm("testJupyterSCP")
In [26]:
scp.ls()
In [4]:
scp.mkdir("testJupyterSCP")
In [4]:
scp.cd("testJupyterSCP")
In [5]:
f_a = scp.edit("myFileA.txt")
In [7]:
f_a.save()
In [8]:
scp.cat("myFileA.txt")
In [7]:
f_a.reopen()
In [8]:
f_a.save()
In [9]:
scp.cat("myFileA.txt")
In [10]:
scp.cd("..")
In [11]:
scp.rm("testJupyterSCP")
In [ ]: