Easily Manage Remote Files on Linux with Konqueror and Kate
One of the great things about Linux, especially for web developers or server administrators, is that all of the basic tools you need to get set with your remote server and files tend to be included and well integrated into the system from the get go. You don't necessarily need to install an FTP client, a code editor or a special terminal emulator.
If you have Ubuntu, or a GNOME based distribution, you'll likely have Nautilus as the default file manager and Gedit as the default text editor. Nautilus comes with support for connecting to remote locations, and you can then edit remote files directly using Gedit just as you would any local file. KDE based distributions come with an even better pair: konqueror or dolphin, and kate. This combination has in my experience been the most powerful. Konqueror is effectively a swiss knife of file managers that's actually simultaneously a web browser, and dolphin is basically a mini version of konqueror developed to focus on excellent file management alone, but with same remote locations support still included.
Konqueror supports connecting to a remote system via FTP or SSH or both (SFTP, FTP via SSH), as well as WebDav and Windows network drives (SMB). You can simply type in a given address into the address bar and it will load up the remote location immediately after you provide it your user password for the remote system.
For example, if you want to connect to a remote computer located on domain.com via FTP, you would type the following in your konqueror address bar:
"Username" is your user name on that remote system. After hitting enter konqueror will ask you for the password associated with the "username" on domain.com. Once you enter the correct password you can browse the remote system just as you would browse your local one.
If the remote system has SSH support running, you can also connect to it via SSH, in which case konqueror will use the FISH protocol:
:22 part indicates a port 22, which is an SSH port on the remote system.
You can also use SFTP, a more secure version of FTP in that it uses SSH (Secure Shell):
In all of above cases you will end up in your user "home" directory, that is
/home/username/ of the remote system, although in case of SSH, if you have the proper permissions you will be able to surf through the entire system.
You can also specify which directory to load up right after logging in. Simply append
/path/to/directory. For example:
If you are accessing a certain remote location often you might want to create and save a shortcut to it so you don't have to type the above every time. In konqueror these are known as "network folders", and can be called up by typing in
To create a new network folder, click on "Add Network Folder" icon in remote:/ to bring up a wizard which will guide you through the process of creating a link to your remote directory. In the first screen you have to choose the protocol that you will be using, which in this example is SSH.
The next screen will ask you for:
- The name of your link (will appear only in remote:/ for you to be able to identify it)
- Username on your remote system (username in above examples)
- Server address (which is only your hostname, like domain.com in above examples)
- Port (already filled out by the default port, like 22 for SSH)
- The folder, which is a directory path where you want to end up after logging in
Once you fill out this info correctly you can save and connect immediately. Make sure to have the "Create an icon for this file folder" tick box ticked in order to have the link saved for future use.
Editing Remote Files with Kate
Once connected to your remote location you can download, upload and manage your remote files and folders. A lot of times you will want to edit some files, and as a default text editor in KDE, Kate works beautifully in combination with Konqueror (and Dolphin).
Just right click on a file in Konqueror, and choose to open with Kate. Or open Kate first, click Open, and use the dialog to browse to your network folder and choose a file to open. The Open File dialog sees everything Konqueror and Dolphin see so network folders created in Konqueror are available here as well.
It all works very seamlessly and glitch-free. You can easily open as many files as you want this way, and switch between them using the Documents tab. As you're editing you can save changes directly back to the file on the server by pressing Ctrl-S.
Besides excellent integration with remote file management Kate is also an excellent editor. It has syntax highlighting for a great number of programming and scripting languages and in multiple color schemes. It has an excellent search and replace tool, useful shortcut tools for code commenting, joining lines, and making selection uppercase and lowercase. Then there is a number of built in scripts, plugins, support for saving snippets of code, and bookmarking certain lines of code. It's a powerful text and code editor for sure.
While I do believe that Konqueror/Dolphin + Kate represent probably the best combination for managing and editing remote files there are decent alternatives.
Perhaps the obvious alternative is the Nautilus + Gedit combo, both of which are installed by default on Ubuntu. They work basically much the same way as Konqueror and Kate, but Nautilus is functionally much more minimalistic compared to Konqueror, and Gedit also doesn't offer quite as much power as Kate although it is still a pretty decent editor. They also seem to be a little bit slower. But if you've got Ubuntu they're extremely quick to try, and if you don't like it, just install Konqueror and Kate and they will work beautifully even under Ubuntu's Unity (or GNOME, Xfce etc.) desktop environment.
A third option might be to use smaller file managers like PCMan and Thunar, which support connecting to remote locations like Nautilus, but don't offer as easy a way to connect and save connections as Nautilus and Konqueror. You have to type the addresses in as shown at the beginning of this article. You can, however, use Gigolo to manage those remote connections more easily, and then browse them with these file managers.
Note that you need to have gvfs-fuse and gvfs-backends packages installed, if you don't have them already, for this to work.
Finally, you could if you prefer turn to dedicated FTP clients such as FileZilla to connect to servers and manage files. Nothing wrong with that!
The same goes for text editors as they will pretty much all work with all of the above methods of connecting, but with varying degrees of convenience, functionality, and convenience.