How to view files in a remote machine without downloading locally?

Tutorial

Many times the results generated by the bioinformatics programs are either simple text files (tab/comma seperated), pdf files or in some rare cases png/jpeg files. Here we will show you how to view these files without having to download them locally to your machine.

Text files

The text files are the easiest. You can use any of the standard UNIX commands to view them. There are many commands for this purpose such as:

CommandPurposeExampleUse cases
lessview file pagewise with more optionsless filenameuse -S to avoid line wrapping, you can use arrow keys to scroll
moreview file pagewisemore filenameuse less instead
catcatalogs the contents of a filecat filenameyou can send the contenst of a file to clipboard or to another file using this command
tacreverse of cat, reverses the order of linestac filenamepipe this to less commad to scroll through the file in reverse
headview first few lines of a filehead filenameuse -n option to change the number of lines displayed. -n 20 displays 20 lines
tailview last few lines of a filetail filenameuse  -n option to change the number of lines displayed. -n 20 displays 20 lines
odoctal dump of a file od filenameuse -c options and pipe it through less. You can see non printable characters with this option (like tab, whitespace, newline etc)

PDF files

Most HPC's allows X11 forwarding. You can enable this when you are logging in to the remote host using the -X option. For eg.,

ssh -X arnstrm@condodtn.its.iastate.edu

Once logged in, you can now open any GUI interface programs on the remote-host and it appears as a new window in your local machine. Although, there are plenty of program options to open a pdf file, you can almost always find the firefox browser in every machine. This should be sufficient to open a PDF file. To get started, type:

firefox

A new window will open, then go to file >> open file >> select the pdf file you want to open . If you don't find the menu tab, pressing alt + f should bring up the file menu

PNG files

Again, you need X11 forwarding enabled to do this. If your machine has imagemagick module installed, load it:

module load imagemagick

To open any picture files, you can just do:

display filename.png

If you don't have this program installed, you can try the firefox method. Although, to view png files, you may have to install the addon before you open the file. Addons are easy to add, once the firefox is opened, press ctrl + shift + A, that will open add-ons page (you can also just type about:addons to open this). Search for Perfect View add-on, and add it to your firefox. Now you can open the file normally as you opened the pdf files.