Editing Text Files

Editing Text Files

There are a number of options for editing files at TACC. These fall into three categories with different pros and cons:

  • Text editors that run on your local computer but have an SFTP (secure FTP) interface that lets you connect to a remote computer (Notepad++ orTextWrangler). Once you connect to the remote host, you can navigate its directory structure and edit files. When you open a file, its contents are brought over the network into the text editor's edit window, then saved back when you save the file.
  • Linux text editors installed at TACC (nano, vi, emacs). These run in your terminal window. vi and emacs are extremely powerful but also quite complex, so nano may be the best choice as a first local text editor. After the learning curve is over, remote editing is as good as (and sometimes better than) any other option.
  • Software that will allow you to mount your home directory on TACC as if it were a normal disk (MacFuse/MacFusion). Then, you can use any text editor to open files and copy them to your computer with the usual drag-drop.

If you are an experienced user, use your method of choice. For new users, we highly recommend using Notepad++ (for Windows), TextWrangler (for Mac), or some other software with the same capability. You can get through the class material using nano, but a more full-featured option is better for day-to-day work.

Pick Your Text Editor

Expand the sections below for tips and instructions on getting started with your text editor of choice: 

 nano on Lonestar via ssh

nano on Lonestar via ssh

nano is a very simple editor available on most Linux systems. If you are able to use ssh, you can use nano.

To invoke it, just type:

How to start the nano text editor
nano

You'll see a short menu of operations at the bottom of the terminal window. The most important are:

  • ctl-o - write out the file
  • ctl-x - exit nano
    You can just type in text, and navigate around using arrow keys. A couple of other navigation shortcuts:
  • ctl-a - go to start of line
  • ctl-e - go to end of line

Be careful with long lines – sometimes nano will split long lines into more than one line, which can cause problems in our commands files, as you will see.

 Notepad++ for Windows

Notepad++ for Windows

Notepad++ is an open source, full-featured text editor for Windows PCs (not Macs). It has syntax coloring for many programming languages (Python, Perl, shell), and a remote file editing interface.

If you're on a Windows PC download the installer here.

Once it has been installed, start Notepad++ and follow these steps to configure it:

  • Configure the default line separator for Unix
    • In the Settings menu, select Preferences
    • In the Preferences dialog, select the New Document/Default Directory tab.
    • Select Unix in the Format section
    • Close
  • Configure a connection to TACC
    • In the Plugins menu, select NppFTP, then select Focus NppFTP Window. The top bar of the NppFTP panel should become blue.
    • Click the Settings icon (looks like a gear), then select Profile Settings
    • In the Profile settings dialog click Add new
    • Call the new profile lonestar
    • Fill in Hostname (lonestar.tacc.utexas.edu) and your TACC user ID
    • Connection type must be SFTP
    • Close

To open the connection, click the blue (Dis)connect icon then select lonestar connection. It should prompt for your password. Once you've authenticated, a directory tree ending in your home directory will be visible in the NppFTP window. You can click the the (Dis)connect icon again to Disconnect when you're done.

Since much of the editing we'll do will be in your SCRATCH area at TACC, rather than having to navigate around TACC's complex file system tree, let's just create a symbolic link to your SCRATCH directory in your home directory. Then you'll be able to get there just by clicking on the scratch folder in the Notepad++ Remote directory tree.

Creating a shortcut to the main Lonestar working directories
ln -s $SCRATCH scratch
ln -s $WORK work
 TextWrangler for Mac

Editing Text Files on TACC: TextWrangler

TextWrangler is a recommended FreeWare text editor for MacOS X. (It even keeps with the theme TACC has going with naming its clusters!) You can use it to directly edit text files on Lonestar with OSXFuse/MacFusion using a nice GUI. It is a much more powerful text editor than TextEdit, and won't trip you up by wrapping lines etc., if you learn to use it.

Even if you cannot install OSXFuse/MacFusion, TextWrangler allows you to edit a remote file via SSH. To do this:

  1. Select *File > Open from FTP/SFTP Server...
  2. Type lonestar.tacc.utexas.edu, your username, and your password into the appropriate boxes.
  3. Check the You need to check the SFTP box.
  4. Click connect.
  5. You will now have a file browser window. You can create new files and edit existing files on lonsetar, but won't be able to drag-and-drop copy files.
 Komodo Edit for Mac and Windows

Komodo Edit for Mac and Windows

Komodo Edit is another free, full-featured text editor for both Macintosh and Windows that will let you edit files over ssh. Download the appropriate install image here.

Once installed, select "Preferences", then "Servers" and SFTP for Server type; then enter your hostname and username and save this profile as "Lonestar". Don't enter anything for port or default path. When you want to open a file at Lonestar, select File -> Open -> Remote file and the top drop-down menu will have "Lonestar". Select that, and it should show you all the files in your lonestar home directory.

 MacFuse/MacFusion/TextWrangler for Mac

MacFuse/MacFusion/TextWrangler for Mac

Want your Lonestar files to appear like any other place on your hard drive? You can do this using MacFuse/MacFusion on a Mac. Want to edit files on TACC without having to use nano? You might want to use TextWrangler, a text editor that can edit files over ssh.

Connecting to TACC Like a Hard Drive: MacFuse/MacFusion

Here are the steps for an installation:

  1. Download and install FUSE for OS X.
    • Check the option to install the "compatibility layer"
  2. Download MacFusion.
    • Move the app that gets downloaded to your Applications folder
  3. Restart your computer.
  4. Open the MacFusion application.
  5. Click the + menu in the window and select SSHFS. Enter your login information for lonestar. Choose connect. The remote file system will appear in Finder (depending on your settings it may be on the desktop or inside the computer shortcut in the side of a Finder window). You can also click on the mounted volume within MacFusion and choose "Reveal" from the gear menu.

In order to make remotely navigating to the different file systems on lonestar easier ($SCRATCH and $WORK), you can set up some shortcuts with these commands that create folders that "link" to those locations. (Run the commands when logged into Lonestar with a SSH terminal, from your home directory).

Creating a shortcut to the main Lonestar working directories
ln -s $SCRATCH scratch
ln -s $WORK work

Tip: Files beginning in a dot (.) like (.profile_user) are meant to be "hidden" in Linux and won't show up when you are navigating in Finder on a Mac (if using OSXFuse/MacFusion). There is a way to turn on showing these files in finder, but it can get annoying because they will show up everywhere. If you use the TextWrangler "open" command to open a file, there is a box that you can check to show these files. Notepad++ and several other options show these files. Just leave them there; they are settings files that you don't want to delete.

Copying Files To and From TACC: SFTP Clients

You can transfer files to and from TACC systems on the command line, but SFTP clients can provide a more user friendly way to transfer and manage files.  If you don't choose to use some type of Fuse mount, a client like Cyberduck is a great option.  Here are a few choices: