Text Editing via secure FTP (sFTP)
Introduction
Rather than edit files using command line programs directly on the server, another option is to connect to the server using a secure FTP program. You can then open the file with programs in your windowed environment (i.e. Windows or MacOS) and can edit there, save changes and then compile on the server.
NOTE: if you're not already an expert at using the command line, I recommend against doing this. You'll learn more about the command line if you're working directly with it rather than relying on sFTP. Additionally, you may have issues with line break format which you'll have to know how to deal with. Instructions for configuring Notepad++ linebreaks are below. You must do something similar for any other editor you wish to use.
You will still need a Putty window open and must work from the shell to compile the program and observe its output, but your file editing can use more familiar programs.
For Windows, I recommend the free program WinSCP as an SFTP client and the free editor Notepad++. Here is a quick summary of useful steps to get started.
Notepad++
- Download and install the 64 bit version of Notepad++.
- Open Notepad++ then go to Settings -> Preferences -> New Document
- Look for the setting box titled "Format (Line ending)".
- Change the setting to "Unix (LF)" and click Close
- This must be done before you create new files.
WinSCP
- Make sure to login with Putty and set your password before using WinSCP
- Download and install WinSCP
- Start WinSCP
- The the file protocol and port number should default to SFTP and 22
- Enter the host name: classes.csc.lsu.edu
- Enter your username and password.
WinSCP basics and changing the default editor to Notepad++
- After login, right-click and create a new directory. Give it a name and click "ok"
- Double click to enter the directory (double click the ".." to exit a directory).
- Inside the directory, right-click and create a new file named test.c
- WinSCP automatically opens it in the internal text editor. Enter at least one character then save and close the file.
- Right click the file in the interface and choose "Edit -> Edit with ..."
- Click the browse button and choose "C:\Program Files\Notepad++\notepad++.exe"
- Check "remember this editor" then click OK
- This opens the editor. Close it again so we can make it the default.
- Right click your file in the interface again and choose "Edit -> Configure"
- Click "Notepad++" in the list then click "Up" button a until its at the top of the list.
- Click OK and test opening your file with a double click. It should open in Notepad++.
- In WinSCP if you save the file from your text editor (even without closing it) changes are saved to the server. The general usage strategy is to edit your code, press Ctrl+S to save, then switch to your Putty window to compile.