A few days ago I was stuck in a situation while working on a development project on my Ubuntu machine. I didn’t have access to an IDE and was supposed to verify that all the source code files (spread across various directories) in the project had a particular header comment. There were over fifty such files, and due to lack of time, I ended up opening each of them separately in Gedit, exhausting myself in the process.
If you think carefully, this problem is not limited to developers – any task that involves taking a look at multiple files one after the other is bound to take time if you do it the conventional way. So, with that in mind, I made it a point to find a solution to this problem – basically a way that makes sure that I spend as less time as possible in such scenarios.
I am glad to share that I finally found a solution – a way to quickly preview files in Ubuntu without the need to open them first. To give you an idea beforehand, it’s basically similar to the Quick Look feature that Mac OS X provides. Before I go ahead and explain the whole process, keep in mind that all the commands and instructions mentioned in this article have only been tested on Ubuntu 16.04 LTS.
How to quickly preview files in Ubuntu
Needless to say, you’ll have to install a tool for the quick preview feature to work, and the tool in question is GNOME Sushi, which according to the project’s GitHub page is a quick previewer compatible with Nautilus, the GNOME desktop file manager.
Downloading and installing the tool is pretty easy. All you have to do is to open Software Center, search for “gnome-sushi” and install it. If you prefer the command line, you can install gnome-sushi with the the following command:
sudo apt-get install gnome-sushi
Once the tool is successfully installed, the quick preview feature will be enabled for your system. To test it, just single-click on any file icon and then press the Tab key on your keyboard, and the preview window will launch. The following screenshot should give you an idea about the feature:
If you have multiple files, you can quickly select them one after the other and keep on clicking the Tab key to preview them. In case you want to make some changes, clicking the black, square-shaped box that contains a folder icon (see image above) will open the file in the default editor. Hit the Esc key to close a preview window.
Aside from normal text files, you can also quickly preview other types of files, including HTMLs and PDFs. For directories, however, the quick preview functionality only displays metadata information such as size of the directory, number of items it contains, and last modified date and time.
It’s worth mentioning that using this feature, you can quickly preview media files as well.
Needless to say, it’s not difficult to get the “quick preview” functionality up and running on Ubuntu as well as other Nautilus-enabled Linux distributions presumably. The feature has the potential to save you a lot of time, especially if your daily work involves playing with a lot of files. Go ahead and give this solution a try.