Remote Connections

How to connect to a remote Unix/Linux server? How to exchange files with this remote server? How to download Web content via the command line? How to create backups? This chapter provides you with the proper knowledge.

  • PDF / 144,120 Bytes
  • 5 Pages / 439.37 x 666.142 pts Page_size
  • 38 Downloads / 226 Views

DOWNLOAD

REPORT


Remote Connections

It is not uncommon in computational biology that you have to work on remote computers (servers). They often provide much more computing power than your local computer (client) or serve as web servers or even data storages. This rises several questions such as: how do I execute commands at a remote server and how can I transfer files between my local client and the remote server. There are several solutions with different levels of comfort. In Sect. 4.2.3 on p. 44 I quickly introduced PuTTY as a way to connect to a remote computer from Microsoft Windows. In this chapter I like to go one step further and show you the Linux way. This involves not only execution of commands at the remote server but also transferring files and even setting up a remote desktop at your local client.

6.1 Downloading Data from the Web Let us get started with the easiest remote connection: data download from the internet. There are two standard commands to do so, wget and curl. Here I demonstrate their basic application although both commands can be tuned with dozens of attributes.

6.1.1 wget The command wget (formerly geturl) is installed on most Linux systems. Its function is extremely easy. You only have to give the URL (uniform resource locator) to the web resource you wish to download. Terminal 19 illustrates this. 1 2 3 4 5

Terminal 19: Usage of wget $ wget "ftp://ftp.ncbi.nih.gov/genbank/gbrel.txt" --2012-09-28 14:38:12-- ftp://ftp.ncbi.nih.gov/genbank/gbrel.txt => ‘gbrel.txt’ Resolving ftp.ncbi.nih.gov (ftp.ncbi.nih.gov)... 130.14.250.11 Connecting to ftp.ncbi.nih.gov (ftp.ncbi.nih.gov)|130.14.250.11|:21... connected.

R. Wünschiers, Computational Biology, DOI: 10.1007/978-3-642-34749-8_6, © Springer-Verlag Berlin Heidelberg 2013

71

72 6 7 8 9 10 11

6 Remote Connections Logging in as anonymous ... Logged in! ==> SYST ... done. ==> PWD ... done. ==> TYPE I ... done. ==> CWD (1) /genbank ... done. ==> SIZE gbrel.txt ... 329828 ==> PASV ... done. ==> RETR gbrel.txt ... done. Length: 329828 (322K) (unauthoritative)

12 13

100%[======================================>] 329,828

261K/s

in 1.2s

14 15

2012-09-28 14:38:16 (261 KB/s) - ‘gbrel.txt’ saved [329828]

16 17

$

What is actually happening is that we download the file gbrel.txt from the NCBI server. This file contains information about the most recent release of the GenBank database. In the same way you could download any other file or webpage.

6.1.2 curl curl works similar to wget but is (a) more common on MacOSX systems and (b) prints the downloaded data to stdout, i.e. the screen. Thus, you have either to redirect the output to a file or use the attribute -o and state a filename.

6.2 Secure Copy: scp In order to upload or download files from a remote server securely, the command scp (secure copy) was introduced. It uses a secure network protocol. Terminal 20 shows its usage. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

Terminal 20: Download File with scp $ scp "[email protected]:CompBiol/met-sulfur.pdb" . The authenticity of host ’servername.com’ ca