Nitesh Kumar – Linux Hint https://linuxhint.com Exploring and Master Linux Ecosystem Tue, 09 Mar 2021 05:50:50 +0000 en-US hourly 1 https://wordpress.org/?v=5.6.2 Best Hex Editors for Linux https://linuxhint.com/hex-editors-linux/ Fri, 05 Mar 2021 09:52:14 +0000 https://linuxhint.com/?p=92868 This article will list useful hex editor applications available for Linux. Hex editors allow you to modify pre-compiled binary files whose source code is typically not available to change. They work by browsing binary data present in a file and then presenting the data in hexadecimal notation to users. Hex editors can also show partial or full ASCII data depending on the contents of the file.

These hex editors allow you to change hexadecimal values, thereby allowing users to modify file behavior even if they don’t have access to source code. However, the data represented by a hex editor is not exactly human readable. Reading and interpreting hexadecimal values to infer program logic and behavior is not an easy task by any means and it takes considerable efforts to find values and make even the smallest of change. A hex editor is one of the first tools used while reverse engineering a file.

Xxd

Xxd command allows you to dump hexadecimal data from a binary file. It can also reverse dump the hexadecimal data into a binary file, thus making it a useful command line hex editor. It is available in repositories of almost all major Linux distributions, usually as a part of the Vim text editor package.

To dump hex data from a file, run a command in the following format:

$ xxd binary.file

To convert a hexdump to binary, use “r” switch:

$ xxd -r hexdump.file

You can explore all of its options by running the two commands mentioned below:

$ xxd --help

$ man xxd

Jeex

Jeex is an open source hex editor that can view and edit binary files. It can present data in binary, ASCII, hexadecimal and octal formats. It can be used to find and replace values in a variety of formats, explore data types and parse strings. It can also be used to view differences between two binary files.

You can install Jeex in Ubuntu by using the command mentioned below:

$ sudo apt install jeex

Jeex is available in repositories of all major Linux distributions, so you can install Jeex from the package manager. You can also compile a build from source code available here.

GHex

GHex or “GNOME Hex Editor” is part of the GNOME3 application stack and is available in default repositories of most Linux distributions. It can present data in both hex and ASCII formats and you can edit and save your changes to the original binary file. You can also use it to show a table of values converted into different notations.

You can install GHex in Ubuntu by using the command mentioned below:

$ sudo apt install ghex

GHex is available in repositories of all major Linux distributions, so you can install GHex from the package manager. You can also download it from the Flathub store.

wxHexEditor

wxHexEditor is a hex editor that is specially designed to handle large binary files whose size can run in GBs. Its other features are on par with GHex and Jeex as it can both modify contents of a binary file and save them into the original file.

You can install wxHexEditor in Ubuntu by using the command mentioned below:

$ sudo apt install wxhexeditor

wxHexEditor is available in repositories of all major Linux distributions, so you can install wxHexEditor from the package manager. You can also compile its executable binary file from source code.

Okteta

Okteta is a hex editor written in C++ and Qt libraries. It is part of the KDE application suite and it features a multi-pane layout for better visibility and readability of binary data. Okteta’s main features include multiple data views, dockable panes, numerical and character encodings, tabbed views and so on.

You can install Okteta in Ubuntu by using the command mentioned below:

$ sudo apt install okteta

Okteta is available in repositories of all major Linux distributions, so you can install Okteta from the package manager. You can also download it from the Flathub store.

Hexedit

Hexedit is an open source command line tool that can view and edit binary files by presenting data in hexadecimal and ASCII formats. It supports searching data by values and can show scrollable output. It also accepts numerous keyboard shortcuts to navigate through the hex data. Hexedit also features useful editing shortcuts for copying, pasting and selecting the data.

You can install Hexedit in Ubuntu by using the command mentioned below:

$ sudo apt install hexedit

Hexedit is available in repositories of all major Linux distributions, so you can install Hexedit from the package manager. You can also compile its executable binary file from source code.

To open a binary file in Hexedit, use a command in the following format:

$ hexedit binary.file

To learn more about its usage, run the following two commands:

$ hexedit --help

$ man hexedit

Hexer

Hexer is a command line hex editor that supports vi-like interface and keybindings. It can show multiple buffers and supports auto-completion. It can also use RegEx expressions to search data and allows users to undo their changes.

You can install Hexer in Ubuntu by using the command mentioned below:

$ sudo apt install hexer

Hexer is available in repositories of all major Linux distributions, so you can install Hexer from the package manager. You can also compile its executable binary file from source code.

To open a binary file in Hexer, use a command in the following format:

$ hexer binary.file

To learn more about its usage, run the following two commands:

$ hexer --help

$ man hexer

Conclusion

Hex editors are really useful to view binary data of pre-compiled files whose source code is typically not available. However, viewing hex data, finding right values, understanding patterns and editing data can be an extremely difficult task as often human readable data is not available. In Spite of these challenges, developers often use hex editors to reverse engineer binary data.

]]>
How To Split Strings in Python https://linuxhint.com/split-strings-python/ Mon, 22 Feb 2021 09:11:29 +0000 https://linuxhint.com/?p=90808 This article will explain how to split strings in python using “split()” and “partition()” methods. These methods are especially useful if you want to convert a sentence or a group of words to parsable and iterable Python types. All code samples in this guide are tested with Python version 3.8.6.

Split Method

The “split()” method can be used to split words using a user specified separator. It returns a list of splitted words without including the separator. If no separator is specified by the user, whitespace (one or more) is used as a single separator.

For instance, the code below will return “[‘Linux’, ‘Hint’]” as output:

text = "Linux Hint"
text.split()

The code below will return “[‘LinuxHint’, ‘com’]” as output when “.” is used as separator:

text = "LinuxHint.com"
text.split(“.”)

The separator doesn’t have to be a single character. The split method takes two arguments:

  • sep: separator to be used for splitting
  • maxsplit: number of splits to do

Both these arguments are optional. As mentioned above, if the “sep” argument is not specified, whitespace is used as a separator for splitting. The “maxsplit” argument has a default value of “-1” and it splits all occurrences by default. Consider the code below:

text = "LinuxHint.co.us"
text.split(“.”)

It will return “[‘LinuxHint’, ‘co’, ‘us’]” as output. If you want to stop splitting at the first occurrence of the separator, specify “1” as the “maxsplit” argument.

text = "LinuxHint.co.us"
text.split(“.”, 1)

The code above will return “[‘LinuxHint’, ‘co.us’]” as output. Just specify the number of occurrences where you want the split process to stop as the second argument.

Note that if there are consecutive separators, an empty string will be for returned for the remaining separators after the first split (when “maxsplit” argument is not used):

text = "LinuxHint..com"
text.split(".")

The code above will return “[‘LinuxHint’, ”, ‘com’]” as output. In case you want to remove empty strings from the resulting list, you can use the following list comprehension statement:

text = "LinuxHint..com"
result = text.split(".")
result = [item for item in result if item != ""]
print (result)

You will get “[‘LinuxHint’, ‘com’]” as the output after running the above code sample.

Note that the “split()” method moves from left to right to split strings into words. If you want to split string from right to left direction, use “rsplit()” instead. Its syntax, usage and arguments are exactly the same as the “split()” method.

If no separator is found in the string while using “split()” or “rsplit()” methods, the original string is returned as the sole list element.

Partition Method

The “partition()” method can be used to split strings and it works identical to the “split()” method with some differences. The most notable difference is that it retains the separator and includes it as an item in the resulting tuple containing splitted words. This is especially useful if you want to divide the string into an iterable object (tuple in this case) without removing any original characters. Consider the code below:

text = "LinuxHint.com"
result = text.partition(".")
print (result)

The above code sample will return “(‘LinuxHint’, ‘.’, ‘com’)” as the output. If you want the result to be of list type, use the following code sample instead:

text = "LinuxHint.com"
result = list(text.partition("."))
print (result)

You should get “[‘LinuxHint’, ‘.’, ‘com’]” as output after running the above code sample.

The “partition()” method takes only one argument called “sep”. Users can specify a separator of any length. Unlike the “split()” method, this argument is mandatory, so you can’t omit the separator. However, you can specify whitespace as a separator.

Note that the partition method stops at the first occurrence of the separator. So if your string contains multiple separators, the “partition()” method will ignore all other occurrences. Here is an example illustrating this:

text = "LinuxHint.co.us"
result = list(text.partition("."))
print (result)

The code sample will produce “[‘LinuxHint’, ‘.’, ‘co.us’]” as output. If you want to split at all occurrences of the separator and include the separator in the final list as well, you may have to use a “Regular Expression” or “RegEx” pattern. For the example mentioned above, you can use a RegEx pattern in the following way:

import re
text = "LinuxHint.co.us"
result = re.split("(\.)", text)
print (result)

You will get “[‘LinuxHint’, ‘.’, ‘co’, ‘.’, ‘us’]” as output after executing the above code sample. The dot character has been escaped in the RegEx statement mentioned above. Note that while the example above works with a single dot character, it may not work with complex separators and complex strings. You may have to define your own RegEx pattern depending on your use case. The example is just mentioned here to give you some idea about the process of retaining the separator in the final list using RegEx statements.

The “partition()” method can sometimes leave empty strings, especially when the separator is not found in the string to be splitted. In such cases, you can use list comprehension statements to remove empty strings, as explained in the “split()” method section above.

text = "LinuxHint"
result = list(text.partition("."))
result = [item for item in result if item != ""]
print (result)

After running the above code, you should get “[‘LinuxHint’]” as output.

Conclusion

For simple and straightforward splits, you can use “split()” and “partition()” methods to get iterable types. For complex strings and separators, you will need to use RegEx statements.

]]>
How to Install Custom Fonts in Linux https://linuxhint.com/install-custom-fonts-linux/ Thu, 18 Feb 2021 13:53:22 +0000 https://linuxhint.com/?p=90131 This article will explain how to install custom Fonts in Linux using various graphical and command line tools. You can use these methods to install system-wide fonts that will be automatically available to all major apps installed on your Linux system.

GNOME Font Viewer

GNOME Font Viewer is available by default on all major Linux distributions using GNOME Shell or other GNOME based desktop environments. It allows you to view all fonts installed on your system and browse their properties. It can also be used to install system wide custom fonts.

To install a custom font using GNOME Font Viewer, right click on a “.ttf” or “.otf” file and click on “Open With Fonts” menu entry.

Click on the “Install” button on the top header bar to install the font. GNOME Font Viewer may take a few seconds to install the font and refresh the font cache, so wait for the process to finish.

Once installed, you can use system settings to select a new font or use an app like “GNOME Tweaks” to switch system wide fonts. Installed font will also be available to other system and third party apps.

You can install GNOME Font Viewer in Ubuntu using the command specified below:

$ sudo apt install gnome-font-viewer

GNOME Font Viewer is also available as a Flatpak package that can be installed on all major Linux distributions.

Font Manager

Font Manager, as the name suggests, is a tool for managing and installing custom fonts on Linux. You can use it to preview, enable, disable and compare system wide fonts. It features a multi-pane and tabbed layout that nicely categorizes fonts and their properties under various headings. It also provides a way to directly download fonts from Google Fonts website. Unlike GNOME Font Viewer, Font Manager allows you to directly change system wide fonts from the app itself, so you don’t need any other third party app to switch fonts. It also includes numerous options to customize look and feel of fonts and you can use it to tweak hinting and anti aliasing of fonts.

To install a new font using Font Manager, just click on the “+” (plus) icon on the top header bar.

You can install Font Manager in Ubuntu using the command specified below:

$ sudo apt install font-manager

Font Manager is also available as a Flatpak package that can be installed on all major Linux distributions.

Font Finder

Font Finder is a frontend application for Google Fonts repository available online. Written in Rust and GTK3, it allows you to directly preview, browse, and install fonts from Google Fonts website. It also features some options to sort and filter results and an optional dark theme to preview fonts.

Font Finder is available as a Flatpak package. To install it in Ubuntu, use the following commands in succession:

$ sudo apt install flatpak
$ flatpak remote-add --if-not-exists flathub <a href="https://flathub.org/repo/flathub.flatpakrepo">https://flathub.org/repo/flathub.flatpakrepo</a>
$ flatpak install flathub io.github.mmstick.FontFinder

You can install Font Finder in other other Linux distributions from its Flathub store listing available here.

Command Line Method

To install custom fonts using the command line interface, you will need to copy font files to certain directories. If you want to install fonts for all users, copy font files to the following directory (root access is required):

[cc lang=”text”]
/usr/share/fonts
[/cc]

If you want to install fonts for current user only, use the following location instead (create folder if it doesn’t exist):

[cc lang=”text”]
$HOME/.local/share/fonts
[/cc]

Once the font files are copied to these locations, you need to refresh system wide font cache to complete the installation. To do so, run the following command:

$ sudo fc-cache -f -v

Alternatively, you can just reboot the system to refresh the font cache.

You can also create subdirectories in the two locations mentioned above and add fonts to these folders to neatly categorize them. Font cache will automatically pick them once you refresh it.

Conclusion

It is pretty straightforward to install custom fonts in Ubuntu and other major Linux distributions as both graphical apps and command line methods are available. Custom fonts can be used in a number of different ways and they are especially useful for artists, designers, programmers and writers.

]]>
How to Install Flatpak, Snap and AppImage Apps in Linux https://linuxhint.com/install-flatpak-snap-appimage-apps-linux/ Sun, 14 Feb 2021 04:20:54 +0000 https://linuxhint.com/?p=89863 This article will explain how to install, remove and manage Flatpak, Snap and AppImage packages in Linux. These three packaging formats have been in development for the last few years and they provide distribution agnostic packages that can be installed on all major Linux distributions. A detailed comparison between these packaging formats is available here.

Installing and Managing Flatpak Packages

If you are using Ubuntu, its derivatives or other Linux distributions based on Ubuntu, you can run the following two commands to setup Flatpak packages:

$ sudo apt install flatpak

$ flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

The second command adds the official Flathub repository that can be used to download and install Flatpak apps. It is possible to add other third party repositories by replacing the repository URL in the second command above. However, in general, you should stick to the default repository to avoid installing untested apps that may have security issues.

If you are using any other Linux distribution, follow this quick setup guide that covers installation instructions for over 25 Linux distributions.

Once you have completed Flatpak setup, you can go to the Flathub store to download any app of your choice. For instance, to install the Firefox Flatpak package, you can visit its listing on the Flathub store or search for it using the search bar on the Flathub website. Every listing on the Flathub page includes an installation command at the bottom of the page. You need to run this command in the terminal to install the package. Note that the command is the same for all Linux distributions. For the quoted case, you need to run the following command to install the Firefox flatpak package:

$ flatpak install flathub org.mozilla.firefox

Note that while installing a Flatpak package, you may be asked to install additional packages and dependencies. This is normal as Flatpak packages install necessary packages and libraries as needed.

To remove an installed Flatpak package, you need to run the following command (replace ID of the package):

$ flatpak uninstall org.mozilla.firefox

If you don’t remember the ID of the package, you can get it from the Flathub store listing page. Flatpak will also show you app suggestions if you only supply a partial name or ID. For instance, if you just use “firefox” in the above command, Flatpak will automatically present you with a choice to remove the Firefox package.

To update an installed Flatpak package, you need to run the following command (replace ID of the package):

$ flatpak update org.mozilla.firefox

To list all Flatpak packages installed on your Linux system, use the following command:

$ flatpak list

Many Linux distributions use Flatpak plugin in their software distribution app to facilitate easier installation and automatic updates. For more information on Flatpak usage, run the following two commands:

$ flatpak --help

$ man flatpak

Installing and Managing Snap Packages

Ubuntu, its derivatives and most other Linux distributions based on Ubuntu come with Snap support enabled by default. You can search for snap packages in the GUI software center app as well as install them from the command line. Snap packages can be searched on the Snap Store website as well. Every listing in the snap store shows a command to install the listed app.

To add Snap support to other Linux distributions, you may need to install the “snapd” package first (similar to the Flatpak setup explained above). Follow the snapd setup guide available here for over 25 Linux distributions.

Once you have finished installing snapd, visit any listing on Snap store and run the specified command listed on the page. For instance, to install Android Studio Snap, you will need to run the following command:

$ sudo snap install android-studio --classic

To remove a Snap package, use the following command (replace application name as needed):

$ sudo snap remove android-studio

To list all Snap packages installed on your system, use the following command:

$ snap list

Note that you cannot disable snap updates. They are automatically installed on your system at periodic intervals. You can however, reschedule them or temporarily hold updates. A detailed guide on managing Snap updates is available here.

To learn more about Snap packages, run the following two commands:

$ snap --help

$ man snap

Installing and Managing AppImage Packages

AppImage packages work similar to portable “exe” files you may have used on Windows. All you need to do is download an AppImage file and mark it executable to run the app. To make an AppImage file executable, run a command in the following format:

$ chmod +x file.appimage

Once marked executable, double click on the executable AppImage file to launch the app. To remove an AppImage file, simply delete it from your hard drive storage.

Similar to Flatpak and Snap, an AppImage store is also available. However, unlike Snap and Flatpak, developers who distribute their apps in AppImage format don’t often list them in this centralized store. AppImage files are mostly distributed through source code repositories or from application websites.

In some cases, AppImage files may prompt you to create a launcher that appears in application menus and on desktop as a shortcut. If you have opted to create a launcher, you may want to remove it after deleting an AppImage file. To do so, just visit the location specified below and delete the associated “.desktop” file.

$HOME/.local/share/applications/

Conclusion

Flatpak, Snap and AppImage packages have provided novel ways to distribute applications across all major Linux distributions. They provide better security and make it easier for developers to distribute their apps. These new package formats are the future of Linux application packaging, especially for non-system third party apps.

]]>
Best Media Center Applications for Linux https://linuxhint.com/media-center-applications-linux/ Fri, 12 Feb 2021 09:02:31 +0000 https://linuxhint.com/?p=89761 This article covers a list of open source media center / home theater software installable on Linux. Media centers can play audio, video and other media files, but they are much more advanced than typical video players. They pack numerous additional features like library management, metadata downloading, streaming server and file sharing. Note that this article only lists media center applications that can be installed on Linux distributions either in client or server form. It doesn’t cover dedicated media center operating systems.

KODI

Kodi is one of the most popular and widely used media center / home theater applications available for a number of different devices and operations systems including Linux. It can organize and play both offline and online media files and you can even use third party online streaming services within Kodi itself. It is one stop application suite for all your content consumption needs, and it is backed by a huge community and team of developers. You can extend it using thousands of official and third party add-ons, to the point that it can almost do everything that a basic OS can do.

Kodi supports a multitude of devices including smart TVs, Android phones, embedded devices and other portable hardware. It also features touch optimized themes and user interface layout for improved usability on touch based hardware. Some OEMs that sell home theater devices use Kodi as base. Kodi JeOS (Just enough OS) like LibreELEC are also available that allow you to use Kodi as a standalone operating system based on Linux. In addition to local media consumption, Kodi also allows you to stream Live TV and record live content. Other features of Kodi include support for remote controls and a web interface.

You can install Kodi in Ubuntu by executing the command specified below:

$ sudo apt install kodi

Kodi packages for other Linux distributions can be downloaded from here. You can also search for Kodi in repositories of your Linux distribution and install it directly from there. (Image credits)

Jellyfin

Jellyfin is an open source media streaming platform. Based on the client-server architecture, you can use it to set up a local server on your Linux machine or install it on a remote server. Once the server is running, you can access the media center in any browser of your choice. Apart from audio and video streaming, Jellyfin also supports live TV and footage recording. Since Jellyfin runs in a browser, you can access it on any device that supports a web browser if you have already set up a remote server.

Jellyfin packages and usage instructions for all Linux distributions can be found here.

Gerbera

Gerbera is a media center application based on UPnP technology. You can set up Gerbera as a home streaming solution on any Linux device and then stream content on any UPnP enabled device. It features a web version with a side panel and a tree style user interface for easier access to media files. Gerbera also supports some external content services.

You can install Gerbera in Ubuntu by executing the command specified below:

$ sudo apt install gerbera

Gerbera packages for other Linux distributions can be downloaded from here. You can also search for Gerbera in repositories of your Linux distribution and install it directly from there. (Image credits)

Universal Media Server

Universal Media Server provides a server application and web interface to access your media files in a web browser. It can be used to stream content on any DLNA or UPnP enabled device. You can also use some online streaming services and RSS feeds to consume content. It also features a built-in subtitle downloader that can quickly get subtitles for live streaming content. Universal Media Server is open source and cross-platform and comes with a graphical configuration utility for easy setup.

You can download packages for Universal Media Server for all major Linux distributions from here.

Stremio

Stremio is an open source media center application that can stream local as well as remote content. You can use its library organizer to filter content by metadata and sync your watch progress on multiple devices. It works on a number of devices and an Android version is also available to download. Stremio functionality can be extended through a number of official and unofficial add-ons available on its website.

You can download Stremio for all major Linux distributions from here. (Image credits)

Conclusion

These are some of the most widely used media center / home theater applications available for Linux. Some of these applications have been in development for quite a long time and almost all of them provide a web based interface to stream content from remote servers.

]]>
Best Map Viewers for Linux https://linuxhint.com/map-viewers-linux/ Mon, 08 Feb 2021 06:45:50 +0000 https://linuxhint.com/?p=89345 This article will list useful online and offline navigation and map viewer applications for Linux. These applications use a number of different API service providers to fetch maps and other real time information.

GNOME Maps

GNOME Maps is a map viewer application based on the OpenStreetMap API. You can use it to plan routes and view crowdsourced maps by entering any location around the world. The app also features a dark mode and allows you to export maps to image files. It can automatically detect your current location and you can add your desired locations to the favorites menu for quick access. GNOME Maps also includes an option to toggle satellite view.

GNOME Maps can be installed in Ubuntu by executing the command mentioned below:

$ sudo apt install gnome-maps

You can install GNOME Maps in other major Linux distributions from their official repositories. A flatpak version is also available.

Marble

Marble is an open source map viewer, atlas explorer and globe viewer. Developed by the KDE team, Marble allows you to plan routes and it can search for maps from multiple sources. It supports both online and offline maps and you can calculate route estimates using different modes of travel. Marble can be used to view historical maps and it also allows you to view climate conditions like clouds intensity and sun shadows. You can even use it to view maps of Mars, Moon and other planets. Marble uses OpenStreetMap as one of its backends.

Marble can be installed in Ubuntu by executing the command mentioned below:

$ sudo apt install marble

You can install Marble in other major Linux distributions from their official repositories. A flatpak version is also available.

FoxtrotGPS

FoxtrotGPS is a GPS based navigation tool based on the OpenStreetMap API. You can use it to plan trips and track location in real time. You can also log your planned trips and set waypoints. FoxtrotGPS can download maps for offline browsing and it can connect to a number of external GPS devices. You can also use FoxtrotGPS to geotag photos and monitor heart rate by pairing supported bluetooth devices.

FoxtrotGPS can be installed in Ubuntu by executing the command mentioned below:

$ sudo apt install foxtrotgps

You can install FoxtrotGPS in other major Linux distributions from their official repositories or compile it from source code.

Pure Maps

Pure Maps is an online and offline map viewing utility available for Linux. It can be used to plan your travel routes and get navigation information. Pure Maps is capable of showing both raster and vector maps. Other features of Pure Maps include bookmarks, nearby places browser, automatic day and night modes for maps, support for third party services like MapQuest and Stadia maps, voiced instructions, built-in compass and so on. Pure Maps also features a command line interface.

You can install Pure Maps in all major Linux distributions from the Flathub store.

Cruiser

Cruiser is yet another offline and online map viewing utility based on the OpenStreetMap API. You can use it to view vector maps, set location bookmarks, view 3D buildings, plan routes, import and export maps, view multiple maps simultaneously and so on.

You can download the latest version of Cruiser from here. Extract the archive once downloaded and then run the following command to launch Cruiser:

$ java -jar cruiser.jar

Note that you must have OpenJDK installed on your Linux system for the above command to work. OpenJDK is available in repositories of all major Linux distributions. Cruiser also has an Android version.

MapSCII

MapSCII can show scrollable maps in ASCII and Braille compatible formats in terminal emulators. You can use keyboard shortcuts and mouse to navigate through MapSCII maps in a terminal, though the experience is not as smooth as browsing maps on a GUI app. It can view both online and offline maps, more information is available on its GitHub page.

To view maps using MapSCII, run the following command in Linux terminal:

$ telnet mapscii.me

You can also install it from the Snap store and then simply run the following command to start viewing the maps:

$ mapscii

Conclusion

These are some of the most popular map viewing and navigation apps available for Linux. Not many desktop applications are available these days as people mostly use mobiles and other handheld devices to browse through maps nowadays.

]]>
How to Use GameConqueror Cheat Engine in Linux https://linuxhint.com/use-gameconqueror-cheat-engine-linux/ Sat, 30 Jan 2021 16:59:24 +0000 https://linuxhint.com/?p=88244

The article covers a guide about using the GameConqueror cheat engine in Linux. Many users who play games on Windows often use the “Cheat Engine” application to modify game parameters and player attributes to enhance the gameplay experience, get over unnecessary grinding, complete speedruns and so on. The Cheat Engine application is not available for Linux, however, another application called “GameConqueror” based on the same concept and features is available for Linux distributions. While GameConqueror is not as advanced as Cheat Engine, it gets the job done and it is the only Cheat Engine for Linux with an easy to use interface.

How Cheat Engine Applications Work?

Cheat engine applications (also called “memory scanner” or “memory debugger” apps) can be used to find values assigned to game variables by scanning memory occupied by a running game process. These apps attach themselves to a running game process and continuously scan memory in real time.

You can use these cheat engine apps to locate game variables and their addresses and then change their values to get modified in-game attributes. Since everything is done when the game is running, you will immediately see changed values within the game itself (sometimes a change of frame/scene is required). There can be hundreds of thousands of variables in memory and it can be tricky to find what you are looking for. But with some practice and trial and error methods, you can reduce lookup time. For instance, if you are playing a game with in-game currency and currently holding 1000 gold pieces, you can use cheat engines to find the variable that stores the gold amount and change it to get increased in-game money. Note that in-game save mechanisms can save modified values to save-game files. So if you are modifying some risky variables in a cheat engine that can break save games, it is a good idea to backup save files beforehand.

Should You Use Cheats in a Game?

Some gamers frown upon people who use cheat engines to modify gameplay attributes while others have no problem with it. In my personal opinion, you can use a cheat engine if the game is 100% offline or if cheats don’t ruin the multiplayer experience of other players in any way (more on it below). Using cheats in co-op, PVP and other forms of multiplayer gameplay should be avoided not only because it is wrong but also because you can be banned forever from playing the game you have purchased.

Player Ban Considerations

Using cheat engine or memory scanning applications can lead to temporary or permanent ban in games that extensively require online data connection. Almost all multiplayer PC games come with anti-cheat mechanisms nowadays and any attempt to modify game memory can lead to irrevocable bans. As a rule of thumb, avoid using cheat engines on multiplayer games that regularly connect to game servers (unless you know what you are doing).

About GameConqueror

GameConqueror is a graphical frontend to command line cheat engine / memory scanning app called “scanmem”. It can perform quick memory scans as well as full thorough scans to identity program variables and their values. You can isolate program variables using its “Value” input box and then changing parameters as needed. GameConqueror supports exporting and importing of cheats, though the memory addresses can change each time you launch a program or game.


I have tested GameConqueror extensively. It works with native Linux games, WINE games, SteamPlay (Proton) games and even with game emulators.

Installing GameConqueror

You can install GameConqueror in Ubuntu by executing the command mentioned below:

$ sudo apt install gameconqueror

GameConqueror is available in the repositories of all major Linux distributions. More installation instructions are available on its wiki page. GameConqueror usage can be best explained through an example.

Example: Modify In-game Currency Using GameConqueror

You can’t define one best method to use the GameConqueror cheat engine in every game. Each game is different and occupies a different memory range. Even new instances of a game can have different memory addresses. The example below illustrates how you should proceed to increase in-game currency called “Coins” to 500 from 103 in a native Linux game called SuperTux2. But this exact approach may not work in every game. The example only gives you some idea about the process of finding variables.

The game starts with a fixed amount of coins, as shown on the top right corner (100).


Next, launch the GameConqueror app and select the “supertux2” process by clicking on the little computer icon located at the top row. This is the very first and mandatory step to enable cheats in a game using GameConqueror. You should be careful when selecting the game process as a wrong selection will give you incorrect results. Exe file processes running on SteamPlay (Proton) compatibility layer are usually prefixed with “Z:” drive.

Once the process is selected, put 100 in the “Value” input box as that was the initial number of coins. In the “Data Type” field, select “number” but you can also choose “int” or “float” types explicitly. “Number” data type includes both int and float values. Click on the search icon and wait for the process to finish. On the left pane, you should see matched results. There are 69175 game variables having a value of 100. Yes, you have to find a needle in a haystack. GameConqueror won’t show all 60000+ variables in the left pane. When you have narrowed down the results following the steps below, results will start appearing in the left pane.

Note that “Search Scope” is set to “Normal” which should be sufficient for most games. In case you are struggling to find desired variables, you should move the scope slider to the right to perform a deep scan. Deep scan is only useful if it is performed in the very first step.


Next, play the game and collect another coin to increase the tally to 101 coins.


Now you need to check which of the variables that had a value of 100 previously now have a value of 101. Enter 101 in the “Value” input box and click on the search icon. GameConqueror will now scan 69175 variables found in the previous step to look for variables having a value of 101. When the process is finished, you should now get a reduced number of results. DO NOT click on the “refresh” or “reset” button next to the search button. It will completely remove the results and you will have to start all over again.


Collect another coin to increase the total to 102.


Repeat the previous step but now put 102 in the “Value” input box. You must now have even less results than the total results you got from the first search query. As for this case, there are two remaining results but the result count may vary depending on your game and what you are searching for.


Collect another coin to get the total to 103.


Now even without entering 103 in the “Value” input box, you can see that there are two variables whose value changed to 103 when you collected the third coin in the game. At this point, you can stop or repeat the above step. If only one variable represents coins in the game, you can narrow it down to a single result. However as there are only two results left, you can try each one of them to see impact on the game.

Right click on the first result and click on the “Add to cheat list” option to add a new cheat.


Change the value of the newly added cheat entry to 500 in the bottom pane.


Check the game if coins have increased to 500. If yes, this is the correct variable you need to change to modify the coin counter. Otherwise try the second result or keep on performing nested searches until you get a reduced number of results.


Note that using a cheat engine can crash the running game. For instance, if a game is designed in such a way that your player can only have 255 strength attribute at max, and you set 9999 strength for your player, the game can crash. You have to keep using trial and error methods to find correct variables and their values. This is the only way to use cheats in games through cheat engine applications like GameConqueror.

Note that, on rare occasions, cheat engine cheats can corrupt game save files. You should backup save files before trying any cheats in the cheat engine.

If you hover over the “?” link next to the “Value:” label, you should see a syntax guide. If you are not certain about the current value of an in-game attribute, you can use this syntax guide. For instance, you are not sure about the exact number of coins but suspect that it may be somewhere between 100 and 300 coins, you can enter “100..300” in the “Value” input box. Similarly, if you don’t know the attribute value but are certain that it decreased in the game from its initial value, you can simply enter the “-” (minus) sign in the “Value” input box.

Conclusion

Cheat engine apps like GameConqueror are not only useful for adding cheats in games, but also for adding quality of life modifications to otherwise frustrating games. It is 100% fine to use cheats in offline games as you own the game, and you are not ruining the experience of other players by using cheats.

]]>
Best Game Console Emulators for Linux https://linuxhint.com/best-game-console-emulators-for-linux/ Sun, 24 Jan 2021 11:14:09 +0000 https://linuxhint.com/?p=87465 This article will list popular game console emulation software available for Linux. Emulation is a software compatibility layer that emulates hardware components of game consoles, instruction sets and related APIs. Emulation software can emulate CPUs, GPUs, audio hardware and many other such physical components available in real game consoles. Emulation allows you to play console exclusive games that are otherwise unplayable on PCs. Games running on these emulators see emulated components as if they were parts of a real game console and they cannot see the underlying platform (PC) on which the game is running on.

Developing an accurate game emulator for PC is an extremely difficult task, involves reverse engineering and many times developers have to sacrifice accuracy to improve compatibility. Emulators require original file system dump from game consoles. Some emulators emulate these components as well making it easier to play games. To play games on emulators, you must have game files, typically called ROMs.

ROM files can be ripped or dumped from your game console or from cartridges and discs using third party software. You need to own both game console and game copy to emulate games on PC. Downloading console firmware files and game ROMs from unauthorized sources without owning the actual console and game copy may be illegal and considered piracy. This article just lists emulation software available for Linux and doesn’t encourage piracy of any sort. Not all emulators will be listed in this article, only the most popular ones based on the console popularity and emulator development activity.

Note that emulators need considerable CPU and GPU power to emulate games, much higher than original game console hardware. Even the most modern and powerful PCs can struggle to emulate games, especially games with high resolution 3D graphics. While emulator developers constantly work to improve compatibility and performance, neither they nor the emulation software can be blamed if certain games don’t work on emulators. They have to rely on limited resources and many times public documentation is not available at all. Most of the emulators available today are free and open source and developers don’t get much monetary benefits to work on them.

Most of the emulators listed below are available in default repositories of almost all major Linux distributions. You can also download pre-compiled binaries and get source code from their websites linked below. Some of the emulators listed below have Android versions as well. You can find builds for Android on their official website.

Sony PlayStation

Many emulators have been in development for Sony PlayStation (PS1 / PSX), some for over a decade. The development of some of these emulators like ePSXe and PCSX have ceased as of today while a few are still being actively developed, namely DuckStation and Mednafen. These emulators have pretty good compatibility rates and use some game specific tweaks to make the game playable. You will need original BIOS files from Sony PlayStation console and ripped ISO files to play games on DuckStation and Mednafen.

Sony PlayStation 2

PCSX2 is the most compatible and comprehensive emulator to play Sony PlayStation 2 games on Linux PCs. In development for nearly two decades, PCSX2 can nearly play every game from the entire Sony PlayStation 2 game catalog. Like Sony PlayStation emulators, PCSX2 also needs original BIOS files to work and of course you also need game ROM files. PCSX2 is based on a plugin system and sometimes multiple graphics and sound renders are available based on the operating system you are using. Play! is another Sony PlayStation 2 emulator that is active in development. While it is not as good as PCSX2 as of now, it is catching up fast and can already be used to play numerous Sony PlayStation 2 games with great compatibility. Play! Doesn’t require you to have original BIOS files but you still need game ROM files.

Sony PlayStation 3

RPCS3 is the only Sony PlayStation 3 emulator available at the time of writing this article. It has great compatibility and can use Vulkan renderer to draw game graphics. The developers are quite active and regularly publish development logs to share insights with users. Some games are known to run better, with richer graphics on RPCS3 than on the original Sony PlayStation 3 game consoles. RPCS3 requires firmware files and ROM files to work. Firmware files can be downloaded from the official PlayStation website.

PlayStation Portable (PSP)

PPSSPP is an open source emulator that can be used to play PlayStation Portable (PSP) games on Linux PCs. Its user interface is developed using Qt libraries and it doesn’t require game BIOS or firmware files to work. PPSSPP is the only PSP emulator for PC that can play almost the entire PSP game catalog. PPSSPP also comes with an on-screen gamepad and you can emulate games on Linux based tablet PCs.

Nintendo GameCube / Nintendo Wii

The Dolphin emulator can emulate both Nintendo GameCube and Nintendo Wii games. There are some hardware similarities between these two game consoles, so Dolphin developers developed the emulator to support both game consoles. Dolphin emulator supports classic game controllers on PC as well as Wii Nunchucks and other motion sensitive controllers. Like RPCS3, the Dolphin emulator also comes with a Vulkan renderer.

Nintendo 64

Many emulators have been in development for Ninntendo 64 since the launch of the console. Some of them are defunct now while others have been taken over by new developers. The most active Nintendo 64 emulation project today is Mupen64Plus. Mupen64Plus also features a command line interface if you want to use scripts and need some automation.

Nintendo GameBoy, GameBoy Color and GameBoy Advance

You can use SameBoy and Gambatte to emulate Nintendo GameBoy, GameBoy Color and Super GameBoy console games. Gambatte has been in development for quite a long time and it is one of the most accurate GameBoy Color emulators available out there. SameBoy is relatively newer but it is already very accurate and supports multiple GameBoy consoles.

GameBoy Advance games can be emulated through VisualBoyAdvance-M and mGBA emulators. Both these emulators have been in development for quite a long time and offer high accuracy and good compatibility.

NES and SNES

A number of different emulation software are available for Nintendo Entertainment System (NES) and Super Nintendo Entertainment System (SNES) game consoles. NES emulators don’t require much hardware horsepower and can be run on old and low end PCs. You can use Mesen and PuNES, both offer high compatibility and accuracy on par with real NES consoles.

For SNES, you can use the Higan emulator. It is the most accurate and bug free emulator created for any game console platform. It almost entirely mimics the original game console without any compromises. Developing an highly accurate emulator is an extremely difficult task but talented developers of Higan have achieved almost 100% accuracy and compatibility with all SNES games. You can also use Bsnes and Snes9x as alternatives to Higan.

Nintendo DS and Nintendo 3DS

You can use melonDS and DeSmuME to emulate Nintendo DS games. Both these emulators have support for touch screen input required to play Nintendo DS games. You can even use tablet PCs and your touchscreen taps will be correctly detected by these emulators. For displays without touch support, you can use mouse pointer to emulate touch screen taps.

Nintendo 3DS can be emulated through Citra emulator. Citra is currently actively in development but it has made astonishing progress in a short period of time, thanks to the talented team of developers working on it. It offers decent compatibility and touch screen support and many popular games can already be played using the emulator.

Nintendo Switch

Yuzu and Ryujinx are the two main emulators available today that can emulate some commercial Nintendo Switch games on Linux PCs. Both these emulators are under heavy development and not many games are compatible and playable. However, they are progressing at great speed and some high resolution 3D games can be played from start to finish with some minor tweaks. This kind of progress usually takes years of development in the emulation scene. Yuzu is being developed by the same developers who are working on the Citra emulator.

Sega Dreamcast

Reicast is the only Sega Dreamcast emulator available for Linux that can emulate some games. Accuracy and game compatibility is average, some games fail to boot. However, many popular games can still be played from start to finish with some compromises and caveats.

RetroArch, Mednafen, MAME and Higan

Some emulators can emulate multiple game consoles and can act as a frontend to manage games from these platforms. These emulators provide global settings to manage all emulators as well as platform specific settings to tweak emulation parameters. MAME emulates arcade game machines and other similar vintage gaming devices. RetroArch is an emulation frontend that hooks into game specific emulation cores to play games. It supports over hundred emulation cores, a list of these cores is available here. Mednafen can emulate Sega Saturn, Sega Genesis, Sega Master System, Sega Game Gear, Atari Lynx, PC Engine and many other game consoles. You can find a full list available here. Higan supports over 25 different console systems, you can find a full list here (scroll down).

Conclusion

Almost all major game console emulators available for PCs are free and open source with a few exceptions. These emulators have been supporting Linux as a first class citizen for a Long a time. Some emulators have also embraced Vulkan renderer to improve performance and graphics.

]]>
Best Dictionary Apps for Linux https://linuxhint.com/apps-dictionary-linux/ Sat, 23 Jan 2021 12:01:50 +0000 https://linuxhint.com/?p=87168 This article will cover a list of useful dictionary applications available for Linux. You can use these apps to look up definitions of words and phrases. Some of the applications listed below support English as the primary language while others provide definitions in other languages as well. The list includes apps that need active data connections to fetch meaning from online databases as well as apps that can be run in offline mode.

Dict Command

Dict is one of the most widely used command line dictionaries available for Linux. Based on client server architecture, the dict app allows you to query word definitions from a number of predefined online sources. You can also set up your own local or remote servers and then use the dict command to query definitions.

The process to query a word definition is pretty straightforward, all you have to do is run a command in the following format:

$ dict "word or phrase"

You can install dict app in Ubuntu by executing the command mentioned below:

$ sudo apt install dict

You can search in the package manager to install dict in other Linux distributions. You can also download its source code archive from here.

You can know more about dict’s command line options by running these commands:

$ man dict
$ dict --help

GoldenDict

GoldenDict is a popular GUI dictionary app for Linux that allows you to look up definitions from both offline and online sources. GoldenDict doesn’t provide offline dictionaries by default. However, it supports numerous offline dictionary file formats and you can manually add them to GoldenDict to enable dictionary search. GoldenDict comes with few online sources like Wikipedia and Google dictionary. These sources can be enabled from settings. You can also add remote dictionary servers and define your own custom URL patterns to look up word meanings. GoldenDict comes with WebKit based WebView and it can render online dictionary websites in the app itself.

You can install GoldenDict app in Ubuntu by using the command below:

$ sudo apt install goldendict

You can search in the package manager to install GoldenDict in other Linux distributions. You can also download its source code archive from here. You can read more about offline dictionary file formats and download some of them from the official website of GoldenDict.

GNOME Dictionary

GNOME Dictionary is a minimal and straightforward dictionary app for Linux. GNOME dictionary is one of the official GNOME-3 applications and it is available in almost all major Linux distributions. It can query definitions of words and phrases from a number of online sources. Unfortunately, it doesn’t have any mechanism to download offline dictionary databases.

You can install GNOME Dictionary app in Ubuntu by using the command below:

$ sudo apt install gnome-dictionary

You can search in the package manager to install GNOME Dictionary in other Linux distributions. A download is also available on the Flathub app store.

Artha

Artha is an open source English thesaurus available for Linux and Windows. “Artha” is a Sanskrit / Hindi word which can be defined as “meaning or essence of something”. Artha comes with a built-in offline dictionary based on WordNet. You can invoke Artha by selecting any word from any running app by using <CTRL+ALT+W> keyboard shortcut (can be changed). Artha will automatically capture the highlighted word and show you a brief definition and related synonyms.

You can install Artha app in Ubuntu by using the command below:

$ sudo apt install artha

You can search in the package manager to install Artha in other Linux distributions. Additional instructions are available on its official website.

WordNet Browser

WordNet Browser is a simple dictionary app based on the free and multilingual dictionary database called “WordNet” (developed by Princeton University). The application supports full text search and search history to quickly browse previous lookups.

You can install WordNet Browser app in Ubuntu by executing the command mentioned below:

$ sudo apt install wordnet-gui

You can search in the package manager to install WordNet Browser in other Linux distributions. More download options are also available on its official website.

Xfce4 Dictionary

Xfce4 Dictionary can find word definitions as long as your Linux PC is connected to the Web. It is a part of the Xfce desktop environment and comes with a panel applet compatible with Xfce desktop. Xfce4 Dictionary can also be installed as a standalone dictionary app in other desktop environments as well.

You can install Xfce4 Dictionary app in Ubuntu by executing the command mentioned below:

$ sudo apt install xfce4-dict

You can search in the package manager to install Xfce4 Dictionary in other Linux distributions. More download options are also available on its official website.

Conclusion

These are some of the most popular online and offline dictionary applications available for Linux. If you are connected to the Internet, you can also try Google search to get word definitions by using the “define:word” pattern (e.g. define:banana).

]]>
Best World Clock Applications for Linux https://linuxhint.com/best_world_clock_applications_linux/ Sun, 10 Jan 2021 14:35:35 +0000 https://linuxhint.com/?p=85148

This article covers a list of graphical and command line “world clock” applications that can be used to view current time and date values at different time zones / locations around the world.

GNOME Clocks

GNOME Clocks, as the name suggests, is a clock application that is included in default repositories of almost all major Linux distributions. It is part of the official GNOME-3 application stack and it supports displaying time and date for many different time zones. Other features of GNOME Clocks include support for stopwatch, countdown timers and alarm notifications. If you are looking for an all-in-one, comprehensive clock application for Linux, you won’t have to look beyond the GNOME Clocks application.


GNOME Clocks can be installed in Ubuntu by executing the command specified below:

$ sudo apt install gnome-clocks

In other Linux distributions, you can search for the term “GNOME Clocks” in the package manager to install it. Alternatively, it can be installed from the FlatHub store.

Gworldclock

Gworldclock is a simple clock application that can show current date and time for different regions around the world. Unlike GNOME Clocks, it doesn’t have any extra functionalities. However, you can manually add new time zones, customize the format of date and time string, and add your own remarks to the string format.


Gworldclock can be installed in Ubuntu by executing the command specified below:

$ sudo apt install gworldclock

To install it in other distributions, search for the term “Gworldclock” in the package manager.

Tty-clock

Tty-clock is a command line application that can show a real time, continuously updating clock in any terminal emulator. You can customize it extensively using its numerous command line options.


You can install “tty-clock” from the package manager of your Linux distribution by using the search function. To download it in Ubuntu, use the following command:

$ sudo apt install tty-clock

To view all of its options, run the following command:

$ tty-clock --help

The clock visible in the screenshot above has been created by running the following command:

$ tty-clock -sct -f "%a, %d %b %Y %T %z"

By default, tty-clock shows time for default locale selected on your Linux system. You can show time for a different time zone by prefixing the command with “TZ” environment variable. The command below shows current date and time in New York.

$ TZ='America/New_York' tty-clock -sct -f "%a, %d %b %Y %T %z"

You can refer to all possible values of the “TZ” environment variable here.

Note that tty-clock cannot simultaneously display multiple clocks. You will have to use a different window for each instance of tty-clock. You can also use multi-pane terminal emulators like “Terminator” to view time at multiple places at once.

Undertime

Undertime is a pretty handy command line utility that can be used to find correct meeting times at different time zones around the world. It automatically calculates time and date values according to user needs and presents them in a nice chart. For the purpose of just displaying a world clock, you can hide the chart by using the “grep” command.


You can download Undertime from the package manager of your Linux distribution by using the search function. To download it in Ubuntu, use the following command:

$ sudo apt install undertime

By default, Undertime takes the default locale time set on your Linux system. The command used in the above screenshot is specified below (you can customise it as per your needs):

$ undertime --colors --format plain New_York Los_Angeles | grep -E 'Local|Equivalent'

The “New_York” and “Los_Angeles” parts in the command specify the time zones for which you want to show calculated time. To view names of all possible locations, use the following command:

$ undertime --list-zones

You can continuously watch the output of undertime command by using a command in the following format (“n” stands for interval in seconds):

$ watch -n 1 'undertime --colors --format plain New_York Los_Angeles | grep -E "Local|Equivalent"'

For more help on Undertime, use the following two commands:

$ undertime --help

$ man undertime

Date command

Date command is available by default on most Linux distributions. It shows current system time according to the locale you have set on on your Linux PC.

$ date

To view time for a different locale, you can use “TZ” environment variable (as explained under tty-clock section in this article):

$ TZ='America/New_York' date

You can refer to all possible values of the “TZ” environment variable here. To continuously watch the output of date command, use a command in the following format (“n” stands for interval in seconds):

$ TZ='America/New_York' watch -n 1 date

Osdclock

Osdclock shows current date and time as on OSD (On Screen Display) overlay. It works on all Linux distributions regardless of the desktop environment or panel used. It is especially useful when you are running a full screen app or game and want to know the current time. Below is an example showing the command and how its output looks like on a fullscreen Firefox window. You can customize its font style, size and display position using various command line options it comes with.

$ osd_clock

You can download Osdclock from the package manager of your Linux distribution. To download it in Ubuntu, use the following command:

$ sudo apt install osdclock

To view time for a different locale, you can use “TZ” environment variable (as explained under tty-clock section in this article):

$ TZ='America/New_York' osd_clock

You can refer to all possible values of the “TZ” environment variable here.

Conclusion

There are only a limited number of world clock applications available for Linux. Apps listed in this article get the job done and some of them also come with handy extra features. If you know any command line application in Linux that can show current date and time, you can try prefixing it with the “TZ” environment variable explained in this article.

]]>
How to Use Lambda Functions in Python https://linuxhint.com/lambda-functions-python/ Sat, 09 Jan 2021 11:48:46 +0000 https://linuxhint.com/?p=85079 This article will explain how to use Lambda functions in Python. Lambda functions can be used to write concise one-liners, implement logic and quickly get return values that can be fed to other expressions.

About Lambda Functions

Lambda functions in python are unnamed and anonymous functions that can be used to create expressions that return some kind of value based on the calculations implemented in the expression itself. Logic in these lambda functions can be written in a concise way, usually something that fits easily in one line. Sometimes they can be difficult to read, especially if people are not well versed with Lambda functions. However they do have the benefit of keeping things together within code blocks and they help better in understanding the context.

Syntax of Lambda Functions

The syntax of a Lambda function in Python Looks like this:

multiply = lambda x, y: x * y

The first part of the lambda expression, just before colon (:) symbol, takes parameters as arguments. The second part, after the colon symbol, needs to be a return value. This return value can be an expression with logic as well. In fact, Lambda functions are used almost all the time to implement some logic on supplied arguments and then return the final result.

To test the Lambda function stated above, you can use the following statement:

print (multiply(3, 4))

You should get the following output:

12

The same lambda function would be otherwise written in the following way:

def multiply (x, y):
    return x * y

print (multiply(3, 4))

Both code samples will give the same output. Some more examples of Lambda functions are explained below.

Pass Lambda Functions as Arguments

You can use Lambda functions to do calculations and supply the return value as arguments to other functions. Sort method in Python takes a “key” argument where you can specify a callable function that takes a single argument for sorting purposes. Instead of first defining a separate function that returns a key and then supplying the function’s reference to the argument, you can simply use a Lambda function.

fruits = [(2, 'apples'), (4, 'oranges'), (3, 'bananas')]
fruits.sort(key=lambda element: element[0])
print (fruits)

The code above will produce the following output:

[(2, 'apples'), (3, 'bananas'), (4, 'oranges')]

You can use lambda in any such method that takes a callable function as argument (filter method for instance).

Use Lambda Functions in List Comprehensions

You can use Lambda in list comprehensions and a list will be duly created from the values returned by the Lambda expression.

get_square = lambda a: a * a
squares = [get_square(x) for x in range(5)]
print (squares)

This will produce the following output:

[0, 1, 4, 9, 16]

The code sample above can also be written in the following way where “x” is supplied to the lambda function as a argument:

squares = [(lambda x: x * x)(x) for x in range(5)]
print (squares)

This example just illustrates use of Lambda functions in list comprehensions. You can otherwise easily calculate squares using a minimal list comprehension statement:

print ([x * x for x in range(5)])

Use Lambda Functions in Python Dictionaries

The code sample below illustrates Lambda functions used within key-value pairs in a Python dictionary. Once defined, you can call these functions any time.

calculate = {'sum' : lambda a, b: a + b, 'difference': lambda a, b: a - b}
print (calculate['sum'](4, 5))
print (calculate['difference'](4, 5))

You should get the following output after running the above code:

9
-1

Conclusion

Lambda functions provide an excellent way to write shorthand expressions and keep things neat and organized without unnecessary creating a lot of named functions. However, overusing Lambda functions can make code difficult to read especially when code is being looked upon by more than one person. It is better to have more readable code (even if it is verbose) than having something that may be a bit hard to understand on revisits.

]]>
Best Accounting Software for Linux https://linuxhint.com/best-accounting-software-linux/ Wed, 06 Jan 2021 10:18:27 +0000 https://linuxhint.com/?p=84581 This article covers some of the best open-source accounting software available for Linux. All applications listed in this article can be installed and run offline in Linux without registering for cloud services or setting up a client and server for self-hosted solutions. These apps are mainly suitable for keeping books for personal finances and small to medium business expenses and transactions.

GnuCash

GnuCash is an open-source accounting software available in the default repositories of all popular Linux distributions. GnuCash can keep and manage records that are fully compatible with the double-entry accounting system. With GnuCash, you can create reports, charts, and graphs for data analysis. Other features of GnuCash include scheduled entries, autofill support, automatic reconciliation, multiple currencies support, invoicing, and more. GnuCash can be used to keep accounts for a variety of business types, and it can handle financial records for firms dealing in products, services, and stock market instruments.


GnuCash is available in the default Ubuntu repositories. To install GnuCash, execute the following command:

$ sudo apt install gnucash

GnuCash can be installed in other distributions through the package manager. You can also visit its official webpage for additional download options.

Skrooge

Skrooge is an open-source accounting application that can be used to record and manage personal finances and transactions. This software does not support the double-entry bookkeeping system, so this program may not be ideal for business firms. However, Skrooge is still a very capable software if you just want to keep track of your income and expenses. Some prominent features of Skrooge include support for multiple currencies, charts, reports, graphs, tabbed browsing, budget goals, categories, scheduled transactions, stock market tools, filters, and more. Skrooge is a part of the official KDE applications suite.

Skrooge is available in the default Ubuntu repositories. To install Skrooge, execute the command below:

$ sudo apt install skrooge

Skrooge can be installed in other distributions through the package manager. You can also visit the official Skrooge webpage for additional download options. Skrooge can be installed from the Snap Store and FlatHub, as well.

Money Manager Ex

Money Manager Ex is an accounting solution for your personal finance and budgeting needs. This software does not support the double-entry system that is typically required for business needs. For your personal financing needs, Money Manager Ex is a decent option, having feature parity with Skrooge and some additional unique features of its own. The primary features of Money Manager Ex include support for stock market transactions, custom reminders, budget goals, charts, reports, graphs, categories, autofill, document attachments, and more. A Money Manager Ex build for Android is also available.

Money Manager Ex can be installed in Ubuntu by downloading the .deb packages available here. After downloading the package, run the following command to install Money Manager Ex:

$ sudo apt install ./mmex_1.3.6-1.bionic_amd64.deb

Money Manager Ex can be installed in other distributions by searching for its packages in the package manager. You can also follow more detailed instructions available here to install this software.

KMyMoney

KMyMoney is an open-source accounting program used for recording and managing personal finances. KMyMoney is designed to be easy and intuitive for non-technical users, and it also supports the double-entry bookkeeping system. The main features of KMyMoney include a summary dashboard, scheduled transactions, categories and tags, support for stock market transactions, charts, reports, graphs, filters, advanced search, GPG Encryption, budget goals, and forecasts.

You can download the AppImage executable binary for KMyMoney here. This will work for all major Linux distributions.

HomeBank

HomeBank is an open-source and cross-platform accounting program that has been in development for more than two decades. The main features of HomeBank include categories, budget goals, partial support for double-entry rules, support for multiple currencies, scheduled transactions, charts, reports, graphs, automatic detection for duplicate transactions, multi-window design, and more.


HomeBank is available in the default repositories of Ubuntu. To install HomeBank, execute the following command:

$ sudo apt install homebank

HomeBank can also be installed in other distributions through the package manager. You can visit the official HomeBank webpage for additional download options.

Conclusion

This article covered some of the best offline accounting applications available for Linux. Nearly all these applications support importing and exporting databases in many file formats, and you can have some inter-compatibility between them. If you are looking for more offline solutions, you can search in the LibreOffice add-on repository, as it may have some extensions built specifically for accounting. You can also try scripts and plugins compatible with Microsoft Excel, as they may be compatible with LibreOffice Calc (a spreadsheet software) with some modifications.

]]>
How to Use Termux to Run Command Line Linux Apps in Android https://linuxhint.com/use_termux_android_linux_apps/ Mon, 04 Jan 2021 20:51:41 +0000 https://linuxhint.com/?p=84404

This article covers a guide on the “Termux” Android app that allows you to run command-line programs and scripts on Android devices.

Termux is an open-source terminal emulator application that works on Android devices. It also works as a sort of mini Linux OS, packed with many tools and utilities you commonly see in desktop Linux distributions. You can use Termux to install and run numerous command-line apps through its own package manager. No root access is required to install and run Termux on Android. You can even use a lightweight desktop environment GUIs without hardware acceleration through Termux (via VNC), but they may be slow and not exactly usable on small screen touch devices. Termux is extremely popular among developers and other users who want to access CLI Linux apps on Android. It is the closest thing you get to a Linux OS on Android, and it is a pleasure to use with its touch-optimized interface suitable for small screen devices. Termux features additional keyboard actions making it easy to input symbols, and also features auto-completion through the <TAB> action key located in the top row of the on-screen keyboard.

Use Cases

Some things you can do with Termux:

  • Run Python scripts
  • Run Bash scripts
  • Play command-line games
  • Access Vi editor
  • Make SSH connections
  • Create Python virtualenv
  • Develop apps as long as you don’t need GUI access
  • Install additional packages with pip, npm, cpan, gem, tlmgr, and other such package managers
  • Basically, anything that an installed package allows you to do through its command-line interface

Installing Termux on Android

You can download and install Termux through Google Play or from F-Droid. Launch Termux through the launcher, and you should be greeted with the following screen:

Enabling Storage Access on Termux

To access files in the Termux terminal or to save files from the Termux terminal, you will first need to setup the Termux storage and provide storage access permissions to Termux when prompted. You can do so by executing the following command:

$ termux-setup-storage

Once you are through the storage setup, you will be able to find Termux files stored in the “shared” folder in the internal storage of your Android device. If the “shared” folder doesn’t exist, you can manually create one. Usually, the full path to this “shared” folder is “/storage/emulated/0/shared”.

Installing and Managing Official Termux Packages

Once you have installed Termux, run the command below to update and upgrade repositories:

$ pkg upgrade

Now you can install your desired packages using the following command:

$ pkg install <package_name>

After installation, you will be able to run the command for the installed package in the Termux terminal (just like you would do on a desktop Linux OS):


You can get a list of installable Termux packages from here. You can also search and look for packages in Termux itself. To do so, run a command in the following format:

$ pkg search <search_term>

You can also list all packages using the following command:

$ pkg list-all

Installing Deb Packages in Termux

You can install certain “.deb” packages from Ubuntu or Debian repositories as long as they are made for your mobile’s architecture (these days, mobiles mostly have aarch64 and aarch32 architectures). Note that some packages may refuse to work on Termux. To install a “.deb” package, run a command in the following format:

$ dpkg -i <deb_package_name>

To remove a manually installed “.deb” package in Termux, run a command in the following format:

$ dpkg --remove <deb_package_name>

To list all manually installed “.deb” packages, you will need to run the following command:

$ dpkg -l

Any “.deb” package from any package source can be installed as long as it meets compatibility requirements. As always, you should be careful when picking up third party packages to prevent the installation of suspicious packages.

Enabling Additional Repositories in Termux

You can also enable extra repositories in Termux to enable the installation of additional packages. To find more repositories, visit this page and click on repositories having names ending with “-packages”. You will find the command for enabling these repositories in their “README” files. The command for enabling extra repositories looks like this:

$ pkg install <repository_name>

Below are some examples that have I have tested and found working on Termux:

$ pkg install x11-repo

$ pkg install game-repo

$ pkg install root-repo

$ pkg install unstable-repo

$ pkg install science-repo

Some third-party community repositories can also be enabled. You will find a list of these repositories available here.

Installing Termux Add-ons

Termux provides some useful add-ons that can be installed on an Android device through the Play Store. Some of these extra add-ons are free, while others are paid. You can find a list of these add-ons available here.

Conclusion

Some apps on the Play Store allow you to install and run full Linux environments on Android. However, a few of them require root access, and they are not exactly easy to use. As far as user-friendliness is concerned, there is nothing else like Termux on the Play Store.

]]>
Best Linux Apps for Creating Bootable Live USB Drive https://linuxhint.com/linux-apps-creating-bootable-live-usb-drive/ Tue, 29 Dec 2020 00:36:56 +0000 https://linuxhint.com/?p=83555 This article will list some useful Linux applications that will allow you to create bootable live USB drives by extracting or transferring ISO image files of various Linux distributions. Live mode allows users to run and experience a full Linux desktop along with all of its applications without actually installing the OS. You can also create persistent live bootable USB drives that will allow you to permanently store changes made in a live session. Creating persistent storage for live mode won’t be covered in this article as it is a complex and lengthy topic that needs to be covered in a separate article.

Startup Disk Creator

Startup Disk Creator, as the name suggests, is an application for creating “startup disks” or “bootable disks” that can be run in live mode. This application ships by default in Ubuntu and some of its variants. The process for creating a new bootable drive using Startup Disk Creator is pretty straight forward: you have to launch the application, select the ISO image, select the USB drive and then have to click on the “Make Startup Disk” button. The process may take some to finish, depending on the read / write speeds of the external drive and size of the ISO image. Note that all data on the external drive will be wiped out during creation of the bootable drive.


In case Startup Disk Creator is not installed by default on your Ubuntu system, you can install it by running the command mentioned below:

$ sudo apt install usb-creator-gtk

If you are using Kubuntu or other Ubuntu derivatives using KDE as the default desktop environment, you can use the KDE variant instead:

$ sudo apt install usb-creator-kde

Etcher

Etcher or balenaEtcher is a cross platform and open source application that can be used to flash ISO images of various Linux distributions. Created using technologies like Electron and TypeScript, Etcher can verify contents of external drives after flashing to ensure that these drives work properly on the next boot. Etcher features a minimalistic interface without much clutter.


You can download the Etcher “AppImage” executable file that can be used on all major Linux distributions from here. Other installable packages are also available on the same page.

UNetbootin

UNetbootin is an open source software that allows you to create bootable external drives from ISO images of various Linux distributions. It can also download ISO images directly from the application itself. UNetbootin uses a different approach than other applications mentioned in this article. It extracts the contents of the ISO image to external drives along with some other files needed to make these USB drives bootable. This method is especially useful if you want to copy some files to a USB drive once it has been made bootable. Other apps mentioned in the article may make “read-only” drives from ISO images of certain Linux distributions (Ubuntu for example).


You can download the UNetbootin executable binary that can be used on all Linux distributions from here.

Run the following commands to launch UNetbootin:

$ chmod +x ./unetbootin-linux64-700.bin
$ sudo ./unetbootin-linux64-700.bin

Note that UNetbootin shows an option to reserve space for persistent storage, but it didn’t work in my testing.

DD Command

DD command can copy and convert files on Linux systems. You can use it to transfer files on any connected storage drive, internal or external. DD command is commonly used to copy ISO image files and create bootable USB disks. DD command is available by default on all major Linux distributions.

To create a bootable live USB disk by using DD command, first you have to find out the identifier for your external drive. You can do so by running the command below:

$ lsblk -o NAME,PATH,MODEL,VENDOR,SIZE,FSUSED,FSUSE%,TYPE,MOUNTPOINT,UUID

Once you have the identifier for your external drive, run the command below by replacing “/dev/sdX” with the identifier you found in the step above (also change the path to ISO image file). Be extra careful when supplying the identifier, you don’t want to wipe out a wrong storage drive.

$ sudo dd if=/path/to/image.iso of=/dev/sdX bs=4M status=progress && sync

Wait for the process to finish, then safely remove the drive from the file manager.

Conclusion

These are some of the tried and tested methods to reliably create bootable live USB drives. These methods do not create persistent drives where all changes made in a live session are stored and saved just like on a full installation. Creating persistent drive is a bit complex process and a separate topic altogether.

]]>
Best Data Backup Applications for Linux https://linuxhint.com/data-backup-application-linux/ Thu, 24 Dec 2020 19:10:26 +0000 https://linuxhint.com/?p=82875 This article will cover a list of applications that allow you to periodically take backup of your important files and folder. Some of these tools allow you to clone and take backup of full hard drives while others can be used to sync files online using various cloud storage services.

Déjà Dup

Déjà Dup is an open source, graphical backup tool that is shipped by default in most GNOME based Linux distributions. It is based on a couple of command line utilities called “duplicity” and “rsync”. It can automatically and periodically take backup of your selected files and upload them to Google Drive or on your own server (ftp, sftp etc.). All backups are encrypted and you can restore them anytime. You can also set a periodic schedule to delete backups automatically to free up disk space.

To install Déjà Dup on Ubuntu, you can execute the command mentioned below:

$ sudo apt install deja-dup

In any other Linux based distribution, Déjà Dup can be downloaded and installed from default repositories or can be compiled from its source code repository.

Clonezilla

Clonezilla is an open source backup software that allows you to take full and partial backups of entire hard drives. It supports numerous file systems you typically see on Linux devices and it is capable of creating one-to-one clones or mirror images of existing disk drives to other internal or external drives. It can also restore any images created previously using Clonezilla. Backups can be encrypted and Clonezilla takes backup of only used blocks on a hard disk to improve overall efficiency and reduces resource consumption. Clonezilla also provides bootable live images and it can also restore or reinstall GRUB bootloaders. Thus you can use Clonezilla to fully backup a Linux PC and restore the backup later to get back a fully functional Linux system.

You can install Clonezilla in latest builds of Ubuntu by executing the command mentioned below:

$ sudo apt install clonezilla

In any other Linux based distribution, Clonezilla can be downloaded and installed from default repositories or can be downloaded from its official webpage.

Restic

Restic is a command line backup utility that can be used to backup files and folders on Linux, macOS and Windows. It can backup files on local drives as well as on cloud storage services. You can restore any snapshot at any point of time. All backups are encrypted. Restic saves system resources by backing up only changed parts of files.

You can install Restic in latest builds of Ubuntu by executing the command mentioned below:

$ sudo apt install restic

In any other Linux based distribution, Restic can be downloaded and installed from default repositories or can be downloaded from its documentation.

To backup files using Restic, first you need to create a new repository. To do so, run a command in following format:

$ restic init --repo$HOME/my_repo”

Now you can backup files using a command in following format:

$ restic backup my_file -r$HOME/my_repo”

For further information, view its manual using the command below:

$ man restic

Timeshift

Timeshift is an open source backup tool that can be used to take incremental snapshots of an entire Linux system or user specified folders. It works quite similar to the “system restore” function you may have seen in Windows. By restoring these snapshots, you can revert to a previous state of your Linux system. You can also rollback to previous versions of files by using the same feature. Timeshift supports both RSYNC and BTRFS snapshots.

You can install Timeshift in latest builds of Ubuntu by executing the command mentioned below:

$ sudo apt install timeshift

In any other Linux based distribution, Timeshift can be downloaded and installed from default repositories or can be downloaded from its official source code repository.

Grsync

Grsync is a graphical frontend to command line utility “rsync”. You can synchronize files and directories and make backups at the same time. Grsync doesn’t have any options to automatically synchronize files periodically, so you will have to manually make the backups by launching Grsync application. Grsync can synchronize with cloud services as long as network drive is mounted on the local file system using some external utility.

You can install Grsync in latest builds of Ubuntu by executing the command mentioned below:

$ sudo apt install grsync

In any other Linux based distribution, Grsync can be downloaded and installed from default repositories or can be downloaded from its official webpage.

LuckyBackup

LuckyBackup is yet another frontend to “rsync” command line utility. It can be used to backup, restore, and synchronize files and folders located on your device. LuckyBackup is almost at feature parity with Grsync, with addition of one very useful feature: scheduled backups. You can also use LuckyBackup as a command line application.

You can install LuckyBackup in latest builds of Ubuntu by executing the command mentioned below:

$ sudo apt install luckybackup

In any other Linux based distribution, LuckyBackup can be downloaded and installed from default repositories or can be downloaded from its official webpage.

Back In Time

Back in Time is an open source backup tool that can backup your entire filesystem or specific files and folders. You can schedule backups to periodically save files and restore them later. Like other tools mentioned above, Back in Time is also based upon “rsync” and features a GUI written in Qt.

You can install Back In Time in latest builds of Ubuntu by executing the command mentioned below:

$ sudo apt install backintime-qt

In any other Linux based distribution, Back In Time can be downloaded and installed from default repositories or can be downloaded from its code repository.

GNOME Disks

GNOME Disks is a disk management tool shipped with all major Linux distributions that use GNOME based desktop environments. You can use GNOME Disks to create snapshots of entire disk drives and restore them later. You can create backup images of both internal and plugged-in drives. GNOME Disks doesn’t allow you to take backup of individual files and folders.

You can install GNOME Disks in latest builds of Ubuntu by executing the command mentioned below:

$ sudo apt install gnome-disk-utility

In any other Linux based distribution, GNOME Disks can be downloaded and installed from default repositories or can be downloaded from its code repository.

Conclusion

It is important to take regular backups of your important data. Backup tools these days provide more features and ease of use than simply copying files over to another drive. Various utilities listed in this article should help you in creating periodic backups and save your mission critical work.

]]>
How to Create a Simple Application in Go Language https://linuxhint.com/create_simple_application_go_language/ Tue, 22 Dec 2020 13:20:52 +0000 https://linuxhint.com/?p=82507

This article will cover a tutorial on creating a simple “Hello World” application in Go programming language. All code samples and commands in this article are tested with the Go language version 1.14.7 on Ubuntu 20.10.

About Go Language

Go is a relatively new programming language being developed at Google. It is similar to C and C++ in many ways, with some very useful additions that makes writing code and rapid prototyping much simpler and safer. It is a compiled programming language and features statically typed syntax (like C). It also features automatic garbage collection and code written in Go is much more readable than other similar compiled programming languages. In simplest terms, you can think of it as a programming language created by picking up the best features from both C and Python. Go is faster than Python and its speed is comparable to C, even faster in many cases. Go does not provide object oriented programming structure and classes you may have seen in other programming languages. Though there are ways to make methods behave like classes in Go language.

Installing Go Language in Linux

You can install Go programming language in Ubuntu by running the command mentioned below:

$ sudo apt install golang

Go language has been packaged and included in repositories of all major Linux distributions. You can install Go language packages from the default package manager. You can also directly download binaries from the official Go language webpage. Once you have downloaded the tar archive, run the commands specified below in succession to install Go language. Make sure to replace the name in the first command with the name of the archive you have downloaded from the official Go website.

$ tar -C /usr/local -xzf go1.14.7.linux-amd64.tar.gz

$ echo "export PATH=$PATH:/usr/local/go/bin" >> "$HOME/.bashrc"

$ source$HOME/.bashrc”

To verify that Go has been successfully installed on your system and its compiler working properly, use the following command:

$ go version

You should see some output like this:

go version go1.14.7 linux/amd64

Full Code

Full code for a “Hello World” application in Go language is given below.

package main


import "fmt"


func main() {

    fmt.Println("Hello World !!")

}

The same “Hello World” application can be re-written in Go language emulating object oriented patterns:

package main


import "fmt"


type HandleString struct {

    name string

}


func (newString HandleString) print_string(){

    fmt.Println(newString.name)

}


func main() {

        s := HandleString{"Hello World !!"}

        s.print_string()

}

Assuming that any of the code samples above is saved into a file named “helloworld.go”, you can run the command below to execute the code:

$ go run helloworld.go

After executing the above code samples, you should get output like this:

Hello World !!

Step-by-step Explanation

The first statement “package main” is required to create an executable command or binary in Go language. Go source files under the same directory are put together into packages. All variables and functions in these source files can be shared between the specified packages.

Next, “fmt” package is imported so that you can use functions like “Println” in the main code. “Fmt” is a part of the standard library packages in Go language and it provides numerous useful helper functions. It is not mandatory but it is used in almost all programs written in Go language.

Lastly the “main” function prints “Hello World !!” string. The “main” function is automatically called whenever you execute a Go language program.

In the object oriented example, struct is used to define a new “HandleString” type. A struct is a group of data fields and variables. Functions can be attached to structs to handle these data groups. Thus structs provide a neat way to define classes in Go language. A new field “name” of type “string” is declared in the struct.

Next, the function “print_string” is added to the “HandleString” struct. This function has a “newString” argument that acts as “receiver”. This receiver can be used to access fields of a struct instance. For instance, “newString.name” is used to access the name field from “HandleString” struct.

Finally, a new instance of the “HandleString” struct is created and the function “print_string” is called on it to print the “Hello World !!” string.

Both code samples listed above produce the same output.

Compiling a Go Application

In order to compile “Hello World” Go program, you can use “build” command to generate an executable binary:

$ go build helloworld.go

You should now have a “helloworld” executable binary located in the same directory where your main program file is saved.

You can run the executable binary by using the command specified below:

$ ./helloworld

It will produce the same output as the “go run” command.

Conclusion

This tutorial touches only a few basics to create a “Hello World” program in Go language. It should get you started. To create more advanced programs, refer to official documentation.

]]>
Linux Based Operating Systems for Mobile and Tablet Devices https://linuxhint.com/linux_based_operating_systems_mobile_tablet_devices/ Fri, 18 Dec 2020 16:37:04 +0000 https://linuxhint.com/?p=82116

Development of non-android, touch based, handheld Linux devices (mainly mobile phones and tablets) have seen rapid progress in the last couple of years. This can be mainly attributed to the advent of Linux phones like PinePhone and Purism Librem 5. These devices are mostly based on the mainline Linux kernel, with patches and some configuration changes. Desktop environments shipped in major Linux distributions like Ubuntu and Fedora are currently not optimized for small screen touch based devices. This article will list user interface environments that are optimized for mobile and tablet devices based on Linux. Most of these environments are currently in pre-alpha, alpha, and beta stages of development.

Ubuntu Touch

“Unity8”, a variation of the Unity desktop environment, was in development for quite a few years. Maintained by Ubuntu’s creator Canonical and based on Qt, Unity8 aimed for convergence where the running desktop environment would automatically and seamlessly adapt for small and large screen devices using responsive, mobile first elements. In other words, Unity8 provided such an interface that any Ubuntu device you carry in your pocket could be converted into a full-blown desktop Linux PC as soon as it was connected to a larger display. Canonical also tried to launch a mobile device with Unity8’s convergence model. Unfortunately, Unity8’s development was stopped by Canonical for various reasons and the device was never released. This same project was then picked up by a group of volunteers and open source enthusiasts. Thus Unity8’s development started again and it became a community project named Ubuntu Touch. Ubuntu Touch is primarily a mobile OS, but it supports convergence and desktop mode as well. Recently, Ubuntu Touch was renamed as “Lomiri”.


Ubuntu Touch supports many ARM based devices and x86 support is also being worked on. It also comes with its own app store containing many useful apps and utilities. If you have a supported device or you want to try Ubuntu Touch on an x86 device, you can download installers from its official website. Image courtesy: Ubuntu Touch website.

Phosh

Phosh (PHOne SHell) is a desktop environment for Linux based mobile devices. Based on Wayland and the GNOME 3 application stack, Phosh is being developed by Purism, creators of “Librem 5” Linux phone. It can be installed on numerous other Linux devices as well and it has been included in official repositories of Ubuntu since the 20.10 release. It is also available as an installable user interface environment in postmarketOS, a Linux distribution specially tailored for mobile and tablet devices.


To install Phosh in Ubuntu 20.10, use the command below:

$ sudo apt install phosh

You can also get the source code and compile it for other Linux devices.

Plasma Mobile

Plasma Mobile is KDE’s take on a user interface shell for mobile devices. Numerous mobile friendly applications have been specially designed by KDE developers for the Plasma Mobile project. It combines KWin, Kirigami’s responsive design and Wayland technologies to create a smooth, responsive, and user friendly shell that can be used on mobile and tablet devices alike. Plasma Mobile can run on postmarketOS, Manjaro, Ubuntu and KDE Neon (based on Ubuntu). You can also grab a standalone x86 image based on Neon to run Plasma Mobile as a live session from a bootable USB drive. See all available download options at its official website.

Image courtesy: Official Plasma Mobile website.

Other Operating Systems for Touch Devices based on x86 Architecture

It is quite rare to find flashable, x86 touchscreen phones today. However, x86 tablets, convertibles and other detachable touchscreen devices are regularly released by hardware manufacturers. If you want to try out a touch friendly, Linux based user interface optimized for small screen tablets, there are a few options you can try out.

There is LibreELEC JeOS (Just enough OS) based on Kodi. JeOS provides a minimal set of command line tools, drivers and utilities just enough to run an application as the main user interface (Kodi in this case). It is similar to kiosk operating systems in many ways and provides support for touch displays, wireless hardware, sound cards, bluetooth units and so on. Kodi has excellent support for touch screen devices, with official user interface themes optimized for touch input. If LibreELEC supports your touch device (you can try it in live mode), you can convert your tablet into a pretty good media consumption device. My x86 tablet works great with LibreELEC and everything works out of the box, except for suspend.

You can also try Lakka JeOS that runs RetroArch emulator as the main application. Retroarch fully supports touchscreen devices and includes numerous presets for onscreen gamepads. Lakka can convert your tablet into a handheld gaming console.

Lastly, you can try Android-x86 that is known to work on a wide variety of x86 devices with some compatibility issues.

Conclusion

Open source software and hardware projects like Ubuntu Touch, Plasma Mobile, Phosh, postmarketOS, Purism Librem 5, PinePhone etc. are currently driving the development of Linux based mobile devices. Most of these projects are currently in development, but they are maturing fast enough and we may see a better ecosystem in future for privacy oriented, open source mobile devices based on Linux.

]]>
Best PDF Viewers for Linux https://linuxhint.com/best_pdf_viewers_linux/ Tue, 15 Dec 2020 04:14:13 +0000 https://linuxhint.com/?p=81896

This article lists free and open source PDF viewing applications available for Linux. Some of these applications provide some basic editing capabilities like annotation and highlighting tools while others are mostly PDF viewers intended only for viewing and reading documents.

Evince

Evince is the default document viewer application shipped with GNOME Shell based Linux distributions like Ubuntu and Fedora. It supports multiple file formats, including the PDF file format. Other main features of Evince include night mode, auto-scroll mode, dual mode, continuous scrolling mode, slideshow mode, right-to-left mode and a full-screen mode.

Evince can be directly downloaded from Ubuntu’s repositories using the command mentioned below:

$ sudo apt install evince

You can install Evince directly from the package manager in other Linux distributions. It can be installed from the Flathub store as well.

MuPDF

MuPDF is a minimalistic and lightweight document viewer for Linux. It can view PDF, EPUB, XPS and various other document file formats. It is primarily a command line application and includes basic editing, annotation and conversion support. By default, MuPDF uses optimized settings to display documents imitating real books or real paper as closely as possible.

MuPDF can be directly downloaded from Ubuntu’s repositories using the command mentioned below:

$ sudo apt install mupdf

You can install MuPDF directly from the package manager in other Linux distributions. It can be downloaded from its official website as well.

To view a PDF file using MuPDF, use a command in the following format:

$ mupdf $HOME/Downloads/file.pdf

To view MuPDF manual, use the command below:

$ man mupdf

Atril

Atril is the default document viewer application included in the MATE desktop environment. It can be installed in other desktop environments without installing the entire MATE desktop interface. Its main features include support for PDF, DJVU, PS and other file formats, text search, full screen mode, continuous mode, dual-page mode, inverted colors mode, auto-fit mode, bookmarks, presentation mode and so on.

Atril can be directly downloaded from Ubuntu’s repositories using the command mentioned below:

$ sudo apt install atril

You can install Atril directly from the package manager in other Linux distributions. It can be compiled from source code as well.

Qpdfview

Qpdfview is an open source PDF viewer written in Qt. It is based on the popular “Poppler” library which is mainly used for handling PDF documents. Besides PDF documents, Qpdfview also supports DJVU and PS file formats through plugins. Main features of Qpdfview include fullscreen mode, presentation mode, transformation tools, multi-page mode, continuous scroll mode, annotations and other basic editing tools, text search and so on.

Qpdfview can be directly downloaded from Ubuntu’s repositories using the command mentioned below:

$ sudo apt install qpdfview

You can install Qpdfview directly from the package manager in other Linux distributions. It can be compiled from source code as well.

Okular

Okular is a document viewer shipped by default in most KDE based Linux distributions and it is a part of the official KDE application stack. It supports numerous file formats, much more than any other PDF viewer listed in this article. Other features of Okular include bookmarks support, thumbnail view, annotation tools, full text search, presentation mode, full-screen mode and so on.

Okular can be directly downloaded from Ubuntu’s repositories using the command mentioned below:

$ sudo apt install okular

You can install Okular directly from the package manager in other Linux distributions. It can be downloaded from its official website as well.

Zathura

Zathura is a minimal and lightweight document viewer for Linux. It doesn’t have any user interface elements, except for the window that displays a PDF document. It features “vim-like” commands and keyboard shortcuts. You can also extend it using plugins to improve support for other file formats. Similar to Qpdfview, Zathura’s PDF support is also based on the “Poppler” library. Other main features of Zathura include custom bookmarks, text search and hyperlink support.

Zathura can be directly downloaded from Ubuntu’s repositories using the command mentioned below:

$ sudo apt install zathura

You can install Zathura directly from the package manager in other Linux distributions. It can be downloaded from its official website as well.

To view a PDF file using Zathura, use a command in the following format:

$ zathura $HOME/Downloads/file.pdf

To view Zathura manual, use the command below:

$ man zathura

Firefox, Chrome and Chromium

All major web browsers today have built-in support for viewing PDF files. You can download Firefox and Chromium from the package manager of your Linux distribution. Chrome can be downloaded and installed from its official website. Once you have these browsers installed on your system, you can use any of these three commands to view PDF files. You can also press <CTRL+O> to open PDF files from browser UI, even when you are offline.

$ firefox -private --new-window  ~/path/to/file.pdf

$ chromium-browser --incognito --new-window ~/path/to/file.pdf

$ google-chrome --incognito --new-window ~/path/to/file.pdf

Conclusion

These PDF viewers stated above have been in development for many years. They include all major features you would expect from a PDF viewer, plus some additional features like dark mode and support for viewing other file formats like EPUB, CBZ and DJVU.

]]>
How to Create a Simple Application in Python and GTK3 https://linuxhint.com/create-simple-application-python-and-gtk3/ Mon, 14 Dec 2020 10:25:20 +0000 https://linuxhint.com/?p=81680 This article will explain how to create a graphical “Hello World” application in Linux using Python 3 programming language and GTK3 GUI framework. All code samples in the tutorial are tested with Python 3.8.6 and GTK 3.24.23 on Ubuntu 20.10.

Install Necessary Packages

To create an app using Python 3 and GTK3, you need to install Python bindings for GObject libraries. This can be done by installing the PyGObject package included in repositories of almost all major Linux distributions. To install these dependencies in Ubuntu, you can use the command below:

$ sudo apt install python3 python3-gi

You can also compile PyGObject from source code available here.

Full Code of the Hello World Application

Full code sample of a Hello World application written in Python 3 and GTK3 can be found below. This application sends a “Hello World !!” notification to the desktop on click of a button.

import gi

gi.require_version("Gtk", "3.0")
gi.require_version('Notify', '0.7')

from gi.repository import Gtk
from gi.repository import Notify

class MyWindow(Gtk.Window):
    def __init__(self):
        Gtk.Window.__init__(self, title="Hello World")
        Gtk.Window.set_default_size(self, 640, 480)
        Notify.init("Simple GTK3 Application")

        self.box = Gtk.Box(spacing=6)
        self.add(self.box)
       
        self.button = Gtk.Button(label="Click Here")
        self.button.set_halign(Gtk.Align.CENTER)
        self.button.set_valign(Gtk.Align.CENTER)
        self.button.connect("clicked", self.on_button_clicked)
        self.box.pack_start(self.button, True, True, 0)

    def on_button_clicked(self, widget):
        n = Notify.Notification.new("Simple GTK3 Application", "Hello World !!")
        n.show()

win = MyWindow()
win.connect("destroy", Gtk.main_quit)
win.show_all()
Gtk.main()

Screenshot of the final result.

The desktop notification that arrives when “Click Here” button is clicked:

Step-by-Step Explanation

Various “import” statements in the first few lines of the code import necessary modules required for the application to work. These modules expose numerous classes and functions that can be used within the application. “Gi.require_version” statements ensure that only the required version of the library is imported to avoid compatibility issues and crashes. In this case “3.0” is used to make sure that GTK3 library is used in the application and not GTK2 or any other version of GTK.

Similar to the GTK class, Notify class is also imported by specifying its required version (0.7 is that latest version at the time of writing this article). This class will be used later in the application.

import gi

gi.require_version("Gtk", "3.0")
gi.require_version('Notify', '0.7')

from gi.repository import Gtk
from gi.repository import Notify

The next statement subclasses “Gtk.Window” class as “MyWindow” class. The “Gtk.Window.__init__” method initializes the constructor of the super class (Gtk.Window) from which a subclass (MyWindow) was created. In the constructor, the application title is also set as “Hello World” using the “title” argument. Default geometry of the application window is also set by specifying width and height in the “set_default_size” method.

class MyWindow(Gtk.Window):
    def __init__(self):
        Gtk.Window.__init__(self, title="Hello World")
        Gtk.Window.set_default_size(self, 640, 480)

Next, “init” method of the Notify class is used to initialize the “libnotify” library by supplying an application title. Without initialization, notifications won’t be sent and shown on the Linux desktop.

Notify.init("Simple GTK3 Application")

The “box” statement adds an empty layout container to the main application window. This container is like an empty canvas where any number of widgets can be put on. “Spacing” refers to the space between widgets in the “pixel” units.

self.box = Gtk.Box(spacing=6)
self.add(self.box)

A new button widget “Click Here” is created using the “Gtk.Button” method. It is then aligned to horizontal and vertical centers of the parent box layout using “set_halign” and “set_valign” methods. The button is connected to the “clicked” signal so that whenever the button is pressed, the callback method “on_button_clicked” can be invoked. Lastly, button widget is inserted from left along the horizontal axis to the box layout using the “box.pack_start” method. This method takes four arguments: the widget object to be added, boolean for expanding the widget, boolean for filling the widget, and padding between the added and other adjacent widgets.

self.button = Gtk.Button(label="Click Here")
self.button.set_halign(Gtk.Align.CENTER)
self.button.set_valign(Gtk.Align.CENTER)
self.button.connect("clicked", self.on_button_clicked)
self.box.pack_start(self.button, True, True, 0)

The “on_button_click” method is invoked whenever the “Click Here” button is pressed. A new notification is created using the “new” method which takes notification title and content as arguments. This notification is then shown on the desktop using the “show” method. You can also move the “new” statement in the main constructor to avoid recreating the notification whenever the button is pressed.

def on_button_clicked(self, widget):
        n = Notify.Notification.new("Simple GTK3 Application", "Hello World !!")
        n.show()

The next few statements are about creating, managing and showing a new application window. A new instance of “MyWindow” class is created and it is connected to “destroy” signal to ensure that application is closed properly whenever a user decides to quit application by clicking on the “x” button. The “show_all” method displays the application window on your Linux desktop. Lastly, the main application loop responsible for handling events and signals is run.

Conclusion

GTK3 and Qt are some of the most popular GUI frameworks used for creating applications that run natively on Linux. Both these frameworks allow you to write main logic in C++ and Python languages. You can’t go wrong by choosing any of these toolkits for your next Linux application project.

]]>
Best Audio Editing and Music Making Software for Linux https://linuxhint.com/audio_editing_music_making_software_linux/ Wed, 09 Dec 2020 05:20:10 +0000 https://linuxhint.com/?p=80472

This article covers a list of music making or audio editing software usable on Linux. Some of these applications allow you to record sound streams through external devices like microphones while others allow you to capture audio from musical instruments connected to your Linux system.

Audacity

Audacity is one of the most widely used sound editing and recording software available for Linux, Windows and macOS. Audacity is completely free and anyone can access its source code repository as it is an open source software. Its main features include audio recording through microphone and other instruments, support for importing sound files, mixing and editing of audio tracks, configurable sample rates, dithering, spectrogram, respamling, built-in and third-party plugins, sequential editing, edit history, sound effects, full support for navigation through keyboard and so on. You can read more about its features, functionality and user interface elements from its manual available here.

Audacity can be installed in latest versions of Ubuntu by executing the command mentioned below:

$ sudo apt install audacity

You can install the Audacity app from package manager in other Linux based distributions or you can download it from its official website.

Ardour

Ardour is a music making and recording software specially designed for engineers who regularly edit and make music. You can also use it for casual sound editing needs. Main features of Ardour include its ability to capture sound streams through microphone and other connected instruments, input monitoring, multi-layer recording mode, multi-channel and multi-layer tracks, edit history, mixing and merging of clips, support for extracting audio from video files, basic video editing tools, routing, monitor controls, official and third-party plugins, dedicated mixer strips, groups, stream panning, automation macros and so on.

Ardour can be installed in latest versions of Ubuntu by executing the command mentioned below:

$ sudo apt install ardour

You can install Ardour app from package manager in other Linux based distributions or you can download it from its official website.

Rosegarden

Rosegarden is an open source audio sequencer, music notation creator and editor, and MIDI sequencer combined into one. It is mainly designed for editing and mixing audio recorded from musical instruments but it also works with other popular digital audio file formats. Using Rosegarden, you can compose, synthesize, arrange, edit and organize audio files and MIDI data.

Rosegarden can be installed in latest versions of Ubuntu by executing the command mentioned below:

$ sudo apt install rosegarden

You can install the Rosegarden app from package manager in other Linux based distributions or you can download it from its official website.

LMMS

LMMS is a cross-platform and open source software mainly used for producing music. You can create new tracks, mix and synthesize sounds, rearrange clips and use layers. Other features of LMMS include support for MIDI keyboards, MIDI controls, multiple export options, beat editor, looping points, automation macros, piano roll, effects mixer, song editor, built-in presets and samples, and so on.

LMMS can be installed in latest versions of Ubuntu by executing the command mentioned below:

$ sudo apt install lmms

You can install LMMS app from package manager in other Linux based distributions or you can download the official “AppImage” file that runs on any distribution from its official website.

Mixxx

Mixxx is an open source and cross-platform DJ software that can be used to create live mixes and remixes. While it doesn’t work like other audio editors listed above, you can use it to record any live mixes created in real time. Its main mixing features include tempo control, support for external instruments, sound effects, support for controlling vinyl records, cue points, beat control, beat looping, pitch manipulation, built-in equalizer and so on.

Mixxx can be installed in latest versions of Ubuntu by executing the command mentioned below:

$ sudo apt install mixxx

You can install Mixxx app from package manager in other Linux based distributions or you can download it from its official website.

Qtractor

Qtractor is an open source music making software programmed in C++ and designed using Qt toolkit. You can use it to create multi-track and multi-channel sequences of MIDI and various other sound files. Other features of Qtractor include support for mixing and editing of audio clips, edit history, drag-and-drop user interface, plugins, looped recording, crossfading tools, audio normalization, pitch and tempo manipulation, support for time-stretching, sample rate manipulation and so on.

Qtractor can be installed in latest versions of Ubuntu by executing the command mentioned below:

$ sudo apt install qtractor

You can install the Qtractor app from package manager in other Linux based distributions or you can download it from its official website.

Hydrogen

Hydrogen is an open source software that can sequence and synthesize emulated drum patterns or real sounds through external instruments. Other features of Hydrogen include multiple layers, chainable patterns of variable lengths, mixing and editing capabilities, tempo and pitch manipulation, visual metronome, time-stretch function, loop support and so on.

Hydrogen can be installed in latest versions of Ubuntu by executing the command mentioned below:

$ sudo apt install hydrogen

You can install the Hydrogen app from package manager in other Linux based distributions or you can download it from its official website.

Helm

Helm is an open source and cross-platform synthesizer that can be used to create digital music. It features multiple oscillators, waveshaping, shelf filters, arpeggiator, sound effects, step sequencer, multiple waveforms, filters and so on.

Helm can be installed in Ubuntu by downloading installable “.deb” packages available here. Once downloaded, run a command in the following format to install the “.deb” package.

$ sudo apt install ./helm_0.9.0_amd64_r.deb

You can follow instructions available here to install Helm in other Linux based distributions.

Conclusion

These are some of the best, free, and open source software that you can use to record, edit, mix, synthesize, and directly make music from scratch using external instruments connected to your Linux system.

]]>
How to Create a Hello World Application in Python Using Tkinter https://linuxhint.com/hello_world_application_python_using_tkinter/ Tue, 08 Dec 2020 01:24:56 +0000 https://linuxhint.com/?p=79944

Tkinter or “TK Interface” module provides various classes and functions to create cross-platform graphical applications in Python using the “Tk UI” framework. Tkinter is included in the default modules shipped with Python builds, even though it is maintained by ActiveState. It is one of the most popular GUI toolkits available for Python, useful for both creating quick prototypes and for development of full-fledged applications. This article covers a guide about installation of Tkinter in Linux, some code samples and their explanation to create a simple “Hello World” application.

Installing Tkinter

You can install Tkinter for Python 3 in Ubuntu by running the command specified below:

$ sudo apt install python3-tk

Tkinter can be installed in other Linux based distributions from the package manager. You can also install Tkinter packages in Linux by following installation instructions available here.

To verify that Tkinter has been successfully installed on your system, run the the command mentioned below:

$ python3 -m tkinter

If Tkinter has been installed correctly, you should see a GUI window like this:

You can also use a Python interpreter to verify installation of Tkinter. Run the following commands in succession to do so (last two commands will run in the Python interpreter):

$ python3

import tkinter

print (tkinter.TclVersion)

Creating a Hello World Application Using Tkinter

You can create a simple application showing “Hello World !!” string by using the code sample specified below:

from tkinter import *

root = Tk()

root.title("Hello World")

main_string = Label(root, text="Hello World !!")

main_string.pack()

root.mainloop()

The first statement in the code sample above imports necessary functions from the Tkinter module. Instead of importing specific functions, everything is imported at once using “*” (asterisk) character. Next, the main application or root window is defined and a “Hello World” title is set for it. A new label widget showing “Hello World !!” string is created in the next statement. The “pack” method is used to automatically resize and match the window area with the position and area of the widget without cutting off visibility of the widget as no geometry is specified. Lastly, the main event loop is run that listens for user events like keyboard and mouse input actions. Once the main loop is successfully run, you should see an application window like this:


Notice that the application title is not completely displayed in the title bar. The “pack” method without any arguments auto-fits the main application window to the area of visible widgets. Since the application window is too small, you can manually specify its size by using the “geometry” method to prevent auto-fit.

from tkinter import *

root = Tk()

root.title("Hello World")

root.geometry("640x480")

main_string = Label(root, text="Hello World !!")

main_string.pack()

root.mainloop()

You can also add a padding argument to the pack method used for the label widget to increase the area of the main application window by stretching the widget.

from tkinter import *

root = Tk()

root.title("Hello World")

main_string = Label(root, text="Hello World !!")

main_string.pack(padx=50, pady=50)

root.mainloop()

The two arguments, “padx” and “pady” specify horizontal and vertical spacing respectively on both sides of the widget.

Pack method is one of the most important methods you will use while creating user interfaces using Tkinter library. Widgets won’t appear on the main application frame unless you call pack method on each and every widget you have defined in the code. You can use the pack method to define dynamic and fixed geometry and position of the widgets. Widgets can be packed into each other to create nested widgets as well. You can read more about the pack method and a few more examples about it from its usage reference.

Further Reading

To know more about Tkinter API you can use a guide available in the official Python documentation. TkDocs features an excellent tutorial that can help create your first Tkinter app though the guide may be a little complex for absolute beginners. You can find official Tkinter manuals that include API definitions and examples on Tcl Developer Xchange website. Python Wiki’s Tkinter page features numerous links that can help you get started.

Conclusion

This article only covers a simple example for getting you started with Tkinter applications. You can create advanced GUIs using Tkinter, but for applications requiring complex user interface elements, many developers prefer PyQt over Tkinter. PyQt also features more widget built-ins than Tkinter, including a graphical suite for designing applications using drag and drop actions.

]]>
Best Radio Players for Linux https://linuxhint.com/radio_players_linux/ Tue, 08 Dec 2020 01:24:53 +0000 https://linuxhint.com/?p=79933

This article will cover a list of open source music streaming applications that can live-stream free radio channels available on the Web. Many of these applications come with channel presets and also allow users to add their own custom channels.

Radiotray-NG

Radiotray-NG is inspired by an open source radio streaming application called “RadioTray”. Development of RadioTray has stagnated over the years, making the application bug ridden and crash prone. To overcome these shortcomings, a new application was created with almost the same name but with more features and installable packages for modern Linux distributions. Today Radiotray-NG has feature parity with classic RadioTray application and allows you to stream music through genre based radio stations. It also features improved groups, improved system tray support, improved desktop notifications and better parsing of metadata.


You can install Radiotray-NG in the latest version of Ubuntu by downloading the “.deb” package available on its official GitHub repository. Once you have downloaded the “.deb” package, run a command in the following format to install Radiotray-NG on Ubuntu:

$ sudo apt install ./radiotray-ng_0.2.7_ubuntu_20.04_amd64.deb

Packages for other Linux distributions and source code archives are available on its GitHub repository.

Goodvibes

Goodvibes is an open source radio streaming application for Linux. Featuring a lightweight and minimal GTK3 based user interface, Goodvibes allows you to play pre-defined radio stations as well as add your own. It also supports loop mode and a shuffle mode to randomly play saved radio stations.


You can install Goodvibes in latest version of Ubuntu by executing the command specified below:

$ sudo apt install goodvibes

Goodvibes can be installed in other Linux based distributions by following official installation instructions available here.

Streamtuner2

Streamtuner2 is an open source and cross-platform music stream explorer that allows you to browse varios radio station streams available across the Web. Streamtuner2 is not a radio player in itself, it just shows browsable radio streams in a multi-pane user interface. Any stream you want to play can be opened in any external media player of your choice by clicking on the “play” button visible in the top toolbar. Streamtuner2 also allows you to bookmark and record streams of your favorite radio channels.


You can install Streamtuner2 in latest version of Ubuntu by executing the command specified below:

$ sudo apt install streamtuner2

Streamtuner2 can be installed from the package manager in other Linux based distributions or it can be downloaded from its source code repository.

Shortwave

Shortwave is an open source radio streaming application for Linux featuring a selection of over 25000 Web based radio stations. You can mix and match stations to create your own library and cast the music to other devices connected to the same network. Shortwave automatically detects titles of music streams and displays them in the sidebar. Shortwave is successor to another and now defunct radio streaming application named Gradio. Other features of Shortwave include a search bar to search catalog of radio stations and a responsive layout that works on handheld Linux devices.


Shortwave can be installed in Ubuntu from its Flathub page. To do so, execute the following commands in succession:

$ sudo apt install flatpak

$ flatpak remote-add --if-not-exists flathub
<a href="https://flathub.org/repo/flathub.flatpakrepo">
https://flathub.org/repo/flathub.flatpakrepo</a>

$ reboot

$ flatpak install flathub de.haeckerfelix.Shortwave

You can install Shortwave radio player in any Linux distribution from its Flathub listing. Make sure that you follow the setup guide before you run installation commands.

Tuner

Tuner is an open source radio streaming application for Linux. Its feature set is mostly identical to the Shortwave app mentioned above. Similar to Shortwave, it also uses an API from radio-browser to stream music from thousands of radio channels. Tuner also features a sidebar that allows you to quickly browse and manage radio stations.


Tuner can be installed in Ubuntu from its Flathub page. To do so, run the following commands in succession:

$ sudo apt install flatpak

$ flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

$ reboot

$ flatpak install flathub com.github.louis77.tuner

You can install Tuner in any Linux distribution from its Flathub page. Make sure that you follow the setup guide before you run installation commands.

Conclusion

These are some of the best radio players usable on Linux distributions. While almost all graphical and command line music players available for Linux can stream radio stations if you know the URL, this article covers only dedicated Internet radio streaming applications.

]]>
How to Setup Flutter and Create Hello World Web Application in Linux https://linuxhint.com/setup-flutter-create-hello-world-web-application-linux/ Wed, 02 Dec 2020 12:41:36 +0000 https://linuxhint.com/?p=79118 Flutter is an application development framework that can be used to develop cross-platform apps running on native code once compiled or built. Being developed by Google, Flutter allows you to create rapid prototypes in a short time as well as allows you to create full-fledged apps that make use of platform specific APIs. Using Flutter, you can create beautiful looking apps for mobile devices, desktop operating systems and web browsers using official material design widgets. This article will discuss installation of Flutter and creation of a new project for developing a web application. Flutter uses “Dart” as the main programming language for writing apps.

Install Flutter on Linux

You can install Flutter in Linux using two methods. The first method is pretty straightforward, all you have to do is run a simple command to install Flutter from snap store.

$ sudo snap install flutter --classic

The second method involves downloading the flutter repository from GitHub. Run the following commands in succession to manually install Flutter:

$ sudo apt install git
$ git clone https://github.com/flutter/flutter.git -b stable --depth 1 --no-single-branch

Note that running the above command will get you required files from the official Flutter repository including executable binary files. You will be able to execute these binary files from the “bin” folder. However, these executable files won’t be added to your system wide PATH variable and you won’t be able to run them from anywhere unless you manually add them to the PATH variable. To do so, follow the steps below.

Open “.bashrc” file located in your home folder using your favorite text editor:

$ nano “$HOME/.bashrc”

Add the following line at the bottom of the file, carefully replacing the <full_path_to_flutter_directory> string.

export PATH="$PATH:&lt;full_path_to_flutter_directory&gt;/flutter/bin"

For instance, if you downloaded Flutter repository in “Downloads” folder, you will have to add the following line:

export PATH="$PATH:$HOME/Downloads/flutter/bin"

Save the file once you are done. Refresh “.bashrc” file by running the command below:

$ source “$HOME/.bashrc”

To verify that Flutter’s “bin” folder has been added to the path, run the command below:

$ echo $PATH

You should get some output like this:

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/nit/Downloads/flutter/bin

Notice the presence of the “flutter” keyword and the full path that shows the “bin” folder in “flutter” directory.

To check if the “flutter” command can be run from any path, use the command below:

$ which flutter

You should get some output like this:

/home/nit/Downloads/flutter/bin/flutter

Note that “Dart” language, which is required to write Flutter apps, comes bundled with Flutter files downloaded from git repository or from snap package. Run the following command to check missing dependencies required to run Flutter:

$ flutter doctor

Some required files may start downloading to complete Flutter setup. If you have not installed Android SDK yet, a message will be shown in the output to guide you through the installation.

If you want to develop Android apps using Flutter, click on the links visible in the terminal output and follow relevant steps to install Android SDK.

This tutorial focuses on building web applications using Flutter. To enable support for creating web apps, run the following commands in succession:

$ flutter channel beta
$ flutter upgrade
$ flutter config --enable-web

To verify that web application support has been indeed enabled, run the command below:

$ flutter devices

You should get some output like this:

2 connected devices:
Web Server (web) • web-server • web-javascript • Flutter Tools
Chrome (web)     • chrome     • web-javascript • Google Chrome 87.0.4280.66

If you have followed steps correctly so far, Flutter should be now correctly installed on your system, ready to create some web apps.

Create a New Flutter Project

To create a new “HelloWorld” web application project using Flutter, run the commands mentioned below:

$ flutter create helloworld
$ cd helloworld

To test your newly created project, run command:

$ flutter run -d chrome

You should see a Flutter web application demo like this:

You can debug Flutter web apps using development tools built into Chrome.

Modify Your Project

The demo project you created above contains a “main.dart” file located in the “lib” folder. Code contained in this “main.dart” file is commented very well and can be understood pretty easily. I would suggest you to go through the code at least once to understand the basic structure of a Flutter app.

Flutter supports “hot reload”, allowing you to quickly refresh your app without relaunching it to see the changes. Try changing the application title from “Flutter Demo Home Page” to “Hello World !!” in the “main.dart” file. Once done, press <r> key in terminal to refresh the app state without relaunching it.

Build Your Flutter App

To build your Flutter web app, use the command specified below from your project directory:

$ flutter build web

Once the build process has finished, you should have a new folder in your project directory located at “build/web” path. Here you will find all necessary “.html”, “.js” and “.css” files required to serve the project online. You will also find various asset files used in the project.

Useful Resources

To know more about web app development using Flutter, refer to its official documentation. You can refer to official documentation for Dart language to get a better understanding of Flutter apps. Flutter comes with tons of official and third-party packages that you can use to quickly develop apps. You can find these packages available here. You can use material design Flutter widgets in your web apps. You can find documentation for these widgets in official Flutter documentation. You can also get a feel of these widgets by browsing working demos of material design web components.

Conclusion

Flutter has been in development for quite a while now and it is growing as a framework for developing “write once deploy anywhere” cross-platform apps. Its adoption and popularity may not be as high as other such frameworks, but it does provide a stable and robust API to develop cross-platform applications.

]]>
How to Setup Android Emulator Without Installing Android Studio in Linux https://linuxhint.com/setup-android-emulator-without-installing-android-studio-in-linux/ Tue, 01 Dec 2020 10:03:41 +0000 https://linuxhint.com/?p=78911

This article will explain how to install the official Android emulator as a standalone application in Linux. The official Android emulator comes with the “Android Studio” application development suite. However, if you are not interested in developing Android apps and just want a working emulator without installing Android Studio, this article should help you. All the steps mentioned in the article are tested on Ubuntu 20.04 LTS version.

Install Command Line Tools

Download the latest version of “Android Command Line Tools” from here (scroll down to the command line section).

Extract the downloaded archive and make a new folder named “tools” inside “cmdline-tools” directory. Copy and paste all files from “cmdline-tools” folder to “tools” folder. Your final directory layout should look like this:

cmdline-tools
    ├── bin
    ├── lib
    ├── NOTICE.txt
    ├── source.properties
    └── tools

Install Required Packages

Go to the “tools/bin” folder, launch a new terminal window and run the following command to update repository details:

$ ./sdkmanager

Next, run the following command to list available and installed packages:

$ ./sdkmanager --list

Install some packages required for the Android emulator to work:

$ ./sdkmanager platform-tools emulator

Find Correct System Image to Use

Next you need to make a note of the system image you want to load in the Android emulator. To get a list of downloadable system images, run the command below:

$ ./sdkmanager --list | grep "system-images;android"

You should get some output similar to this:

You will see some numbers like “27”, “28” etc. in the name of system images. These numbers denote Android API levels. Find the Android version corresponding to the API levels from here and make a note of the appropriate system image you want to use in the emulator and the API level number.

Download System Image and Corresponding Packages

Next, download the following packages using the same API level number you finalized in the step above:

$ ./sdkmanager “platforms;android-30” “system-images;android-30;google_apis_playstore;x86_64” “build-tools;30.0.2”

For instance, if you decided to use “system-images;android-29;default;x86_64” as the system image, the command would change to:

$ ./sdkmanager “platforms;android-29” “system-images;android-29;default;x86_64” “build-tools;29.0.3”

You can always use the “list” switch to find correct command and version numbers:

$ ./sdkmanager --list

Create a New AVD

AVD or “Android Virtual Device” is a set of configuration parameters that defines values for a virtual device that will emulate a real Android hardware device.

To create a new AVD, you need to use the system image you downloaded in the step above. Run the following command to create a new AVD:

$ ./avdmanager create avd -n “my_avd_30” -k “system-images;android-30;google_apis_playstore;x86_64”

Replace “my_avd_30” with any name of your choice. You may be prompted to alter some configuration parameters. Follow on-screen instructions and change the values as per your requirements.

Confirm that the AVD has been successfully created using the command below:

$ ./avdmanager list avd

You should get some output similar to this:

Available Android Virtual Devices:
    Name: my_avd_30
    Path: /home/nit/.android/avd/my_avd_30.avd
  Target: Google Play (Google Inc.)
          Based on: Android 11.0 (R) Tag/ABI: google_apis_playstore/x86_64
  Sdcard: 512 MB

Note the path of AVD in the output above. At the same path, you can find a “config.ini” file that can be used to change configuration parameters of the AVD.

Run Emulator

Go to “emulator” folder (up a few directories) and use the following command to launch the emulator:

$ ./emulator -avd “my_avd_30”

Replace “my_avd_30” with the name of your own AVD you created in the step above. Your Android emulator should be now up and running:

You can create as many as AVDs as you want and each AVD / System Image will be treated separately.

Conclusion

Android emulator provides an excellent way to emulate real life Android devices on your desktop PC. You can use the emulator to test some apps that are yet in development or you can use the emulator to regularly run Android compatible apps and games on a Linux PC. The performance of the emulator will depend on your system’s horsepower, virtualization technologies available on your PC and your system’s compatibility with the KVM kernel module.

]]>