连接远程Linux的几类工具
有时候,我们需要操作linux,而且通常linux都是作为远程服务器存在的。那么我们在自己的机子上如何远程操作服务器端的linux呢?这里介绍几个我常用的相关工具。
我用的是mac系统,因此以下的几种都是支持mac系统的,当然大部分也支持windows。
SecureCRT
先来看看远程终端工具,推荐SecureCRT,一款很好用的工具。

那么如何连接我们的远程服务器呢?选择connect下拉菜单中的Quick Connect:

然后填写hostname,可以直接填ip,端口就默认22,然后点击连接:

输入后即可连接成功:

接着就可以在终端中进行相关指令操作了。
FileZilla
接下来的一个工具是FileZilla,这个工具主要方便我们将本机上的文件传输到服务器端。FileZilla使用起来也十分容易。

同样的,只需在上面输入相应的主机名、用户名和密码就行了,端口还是输入22,使用sftp。(21为ftp)。然后点击快速连接:

需要传某些文件的时候,在左边本机找到相关文件,拖拽到右边指定目录里就搞定了,相当方便。
Sublime Text
Sublime Text在程序界也是一个大名鼎鼎的文本编辑器了,它众多的插件使之成为一个强有力的工作利器。因此,它在我们需要远程编辑linux中的文件时也发挥着相当的作用哦。而且颜值也很不错呢:

作为一款文本编辑器,在这里面扮演的最重要的角色就是修改远程的文本文件内容。怎么做呢?首先需要安装一个SFTP的插件。
在sublime里,使用Package Control插件(Package Control的安装网上很多)进行安装。使用快捷键shift+command+p(windows为:shift+control+p):

输入install后选择install Package,回车,等待一下,会出现另一个框框:

在这里面输入sftp,选中STFP进行安装就可以了。
接着需要进行相关配置,选菜单栏中的File->SFTP/FTP->Setup Server,然后出现一个配置窗口如下:

一般就设置几个值:
type:连接方式,一般就用sftp;
host:主机名或ip;
user:用户名;
password:密码;
remote_path:要操作的文件的路径;
设置好后,然后保存。这时sublime就可以连接进远程linux了。我们先看看远程linux上/home/hadoop下的文件:

有个test.txt文件,那么就用sublime查看修改该文件。选菜单栏中的File->SFTP/FTP->Browse Server:

选择刚才设置的hadoop那个连接:

出现该路径下目录:

在下拉菜单中可以找到我们的test.txt文件,回车后:

这里选择Edit编辑,就可以进行相关编辑了:

保存后,就会直接上传到服务器了。这样编辑会让不习惯用vim的轻松一些了。
查看远程文件,确实被编辑了:

mac终端iTerm
当然,mac上还有个很不错的iTerm,这个终端工具也是屌屌的(首先因为颜值高)。在我们安装了XQuartz后,来试试使用iTerm终端ssh连接我的centOS的效果(其实使用自带的终端工具也行的)。在终端中输入命令:
ssh -X hadoop@10.211.55.8
输入密码,进入后和使用SecureCRT看到的是一样的,不过这里面可以显示中文哦。

接下来看看比较屌的功能了,我的centOS中安装了eclipse,我想在本机上启动远程的eclipse来用,怎么做呢?和在这台linux机器上一样,在终端中输入eclipse:

然后本地启动的就是远程上的eclipse哦!
