Tips on working on remote linux computers

Remote Linux environments often require a different set of tools compared to local desktop environments, especially when it comes to file management and navigation. Here are some utilities that can enhance your remote file browsing and editing experience:

tmux Link to heading

tmux is a convenient tool that allows you to split your terminal window into multiple panes, making it easier to manage multiple sessions or tasks simultaneously. This is especially useful when working remotely, as you can have a file browser open in one pane while editing files or running commands in another. tmux sessions are also persistent, which means you can disconnect and reconnect without losing your work.

Demo of using tmux on server:

tmux demo

vifm Link to heading

vifm is a file manager for the command line that offers a two-pane interface, making it similar in feel to traditional graphical file managers like Midnight Commander. It’s lightweight and can be easily installed on most Linux distributions. vifm supports various file operations, custom commands, and even has a vim-like keybinding system, making it a powerful tool for vim enthusiasts and those accustomed to keyboard-centric navigation.

iTerm2 and imgcat for image previewing in command line Link to heading

Previewing images is an essential task in many workflows, even when working on a remote Linux computer. While traditional graphical interfaces offer straightforward solutions, doing this in a command-line environment requires a bit of creativity. Here are some methods to consider:

  • imgcat on iTerm2: For macOS users, iTerm2 is a terminal emulator that supports displaying images directly in the terminal window with the imgcat script. This can be incredibly useful for quickly viewing images without leaving your terminal session. You can install imgcat on any platform with pip install imgcat and view an image in iTerm2 terminal emulator with imgcat img.jpg.
  • Integrating vifm with imgcat to achieve a ‘File browser/Finder’ experience in terminal. This combination allows for a seamless navigation and image previewing experience right from the command line. Many guides exist on the internet on how to enable image previews within vifm, but I find the following configuration particularly effective: fileviewer *.bmp,*.jpg,*.jpeg,*.png,*.gif,*.xpm /path/to/imgcat --width %pw --height %ph %c:p %pd . By applying this configuration, you can effortlessly browse through files and folders using the intuitive h, j, k, l keybindings, reminiscent of vim’s navigation controls, and preview high-resolution images instantly with just a press of the w key. Previewing PDF images is also possible with a simple trick: fileviewer *.pdf convert %c /tmp/tmpfile.jpg > /dev/null && /path/to/imgcat --width %pw --height %ph /tmp/tmpfile.jpg %pd.

Demo of previewing files and images with vifm on server:

vifm and imgcat demo

VSCode Link to heading

Use the Remote Explorer plugin with Visual Studio Code to seamlessly edit files on your remote Linux machine as if they were local. This plugin connects to your remote environment over SSH, allowing you to browse files, run your code, preview images, and even debug applications directly within VSCode. It’s an excellent option for developers looking for an integrated development environment (IDE) experience while working remotely.

{{ partial “posts/disqus.html” . }}