Basic file editing
‼️ To begin, make sure you have a user account at CSC that is a member of a project which has access to the Puhti service.
☝🏻 You should also have already logged in to Puhti with SSH.
☝🏻 Note: For graphical output to work you need to log in with
ssh -X cscusername@puhti.csc.fi
. On Windows/macOS you also need to have an X server installed and running. See details in the previous tutorial. Another option is to use the Puhti web interface.
In the previous tutorial we downloaded a file called my-first-file.txt
, made a copy of it named YourName-first-file.txt
, and now we practice how to edit it!
💬 These exercises are done with the nano
editor, but you can use your favorite editor too.
💡 Here’s a nano cheat sheet
Processing text files
- Open the file with
nano
:
nano YourName-first-file.txt # replace YourName
- Edit the file. Type something there!
- Exit
nano
withCtrl+X
, typeY
to confirm saving and press enter to accept the filename. - Check that the modifications are actually there:
less YourName-first-file.txt # replace YourName
- Exit the preview with
q
.
Processing images and pdf files
☝🏻 Note! In case you are using the Puhti web interface, you need to open the files below from the file browser.
- Download an image and a pdf:
wget https://raw.githubusercontent.com/csc-training/csc-env-eff/master/_slides/img/terminal_icon.png
wget https://raw.githubusercontent.com/csc-training/csc-env-eff/master/_slides/img/schrodingerscat.pdf
- Open the image with
eog
or using the file browser of the Puhti web interface.
eog terminal_icon.png
- Close the preview window.
- Open the pdf with
evince
or using the file browser of the Puhti web interface.
evince schrodingerscat.pdf
- Close the preview window with your mouse or by pressing
Ctrl+C
when the Terminal window is selected.
Create text files
- You can also create files with
nano
. Try simply:
nano YourName-markdown-file.md
- In the text file, write something (e.g. instructions for others how to replicate your file creation process), then save and close.
- May I interest you with the basic Markdown guide?
- Use
pwd
and copy the path of your current working directory - Copy the text file to your personal computer for example with
scp
‼️ Note: The following has to be typed in your personal computer’s terminal (not Puhti):
scp cscusername@puhti.csc.fi:/path/to/your/filename.md /path/to/local/folder
- Look for the file on your personal computer and check that the contents match.
More information
💡 You can read more about scp
and moving files from Docs CSC: Copying files using scp
💬 One way to display html
files on Puhti is to go through the Allas object storage service. After configuring Allas there’s a-commands
which enable publishing files on the internet. This is instructed in the Allas tutorial.