How To Run SpeedTest From The Linux Terminal

Speedtest.net is a handy tool for Linux server admins and enthusiasts as it helps them quickly test ping, bandwidth, and other network information from the comfort of a website. Still, for as good as the Speedtest.net website is, it’s not very useful if you’re trying to test the internet connection of a remote server and don’t have access to a web browser.

Introducing Speedtest-cli: it’s a command-line utility that lets you run Speedtest from the Linux terminal. It does everything that the Speedtest website does but with Linux command arguments. To install this software, you’ll need the latest version of the Python programming language.

Install Speedtest-cli

Speedtest-Cli is installable via many different Linux distribution’s software sources. It is also available via the source code or the Python Package tool.

Ubuntu

sudo apt install speedtest-cli

Debian

sudo apt-get install speedtest-cli

Arch Linux

Arch users looking to install Speedtest-cli will need to first enable the “Community” software repository in /etc/pacman.conf. To activate, launch a terminal and open pacman.conf with Nano.

sudo nano /etc/pacman.conf

Scroll down and find “Community.” Remove all instances of # from in front of “Community,” and the lines underneath it as well. After removing the # symbols, press Ctrl + O to save the edits, and exit Nano with Ctrl + X.

Re-sync your Pacman to enable the Community repo.

sudo pacman -Syy

With the Community rep now up and running on your Arch Linux PC, install the speedtest-cli utility.

sudo pacman -S speedtest-cli

Fedora

sudo dnf install speedtest-cli -y

OpenSUSE

sudo zypper install speedtest-cli

Generic Linuxes Via Python PIP

If you can’t get the Speedtest-cli utility, you’ll be able to get it going with Python and PIP. To start the installation, open up a terminal window and ensure you have the latest version of both Python and Pip. When you’ve determined you have the newest version of Python and Pip working on your Linux PC, install Speedtest-cli with the following command.

Note: do not try to use sudo during the installation, as it will mess up your Python development environment.

pip install speedtest-cli

Generic Linuxes via building from source

Going the Python Pip route on generic Linux distributions is usually the easiest way to get it going if your Linux distribution doesn’t care the software. However, if PIP doesn’t work, there’s another solution: building from source.

Before installing Speedtest-cli via the Github source code, install the Python programming language, as well as the Git tool. Then, use the git clone command to grab the code.

git clone https://github.com/sivel/speedtest-cli.git

Move your terminal into the speedtest-cli code folder and update the contents’ permissions.

sudo chmod +x *

Run the installation tool to get Speedtest-cli working on your Linux PC.

python setup.py install

Use Speedtest-Cli

To run a basic internet speed test with the Speedtest-cli tool, launch a terminal, and run speedtest-cli in it. What follows is a basic test of your ping, upload, and download speed. The results of your internet test will show up in text form when the process is complete.

speedtest-cli

If you’re new to using the terminal and wish internet test results were easier to read, add the simple modifier to speedtest-cli commands.

speedtest-cli  --simple

Download-only Test

Want to figure out your download speed but don’t feel like running a full internet speed test? Try running the speedtest-cli command with the no-upload modifier.

speedtest-cli --no-upload

Combine no-upload with the simple modifier for an easy to read experience.

speedtest-cli --no-upload --simple

Upload-only Test

Running speedtest-cli with the no-download command will allow the user to do an “upload only” test.

speedtest-cli --no-download

For best results, run with the simple modifier.

speedtest-cli --no-download --simple

View Graphical Results

When you run an internet speed test on Speedtest.net, you have the option of viewing your network results in a PNG image. If you want a picture result of speed tests you run with speedtest-cli in the terminal, add the share modifier.

speedtest-cli --share --simple

Speedtest With Bytes

Each internet test you run with the speedtest-cli command is measured in bits. It’s the universal standard for measuring speed on the internet. If this doesn’t sit right with you, consider using the bytes modifier in your tests.

speedtest-cli --bytes

Export SpeedTest To CSV

Do you run speed tests a lot? Want to keep track of your data? Consider running the speedtest-cli command with the csv modifier. Using this feature prints out test results in the “csv” text format which is easily pasteable in spreadsheet programs like Microsoft Excel or Libre Office Calc.

speedtest-cli --csv

Other Speedtest-cli Features

In this tutorial, we go over many different useful features that you can use with speedtest-cli. Though, there are many other useful features that we haven’t covered.

To access the other Speedtest command-line features, run the following command in a terminal window.

speedtest-cli --help

Alternatively, save the help page to a text file with:

speedtest-cli --help >> ~/Documents/speedtest-cli-commands.txt

Read How To Run SpeedTest From The Linux Terminal by Derrik Diener on AddictiveTips – Tech tips to make you smarter

How To Analyze Hard Drive Usage On Linux With Qdirstat

With how large data can be nowadays, hard drives can fill up quickly. For this reason, it’s a good idea to install a tool that lets you analyze hard drive usage to help you keep track of large files, and delete them if need be.

Install Qdirstat

On Linux, one of the best hard drive analysis tools users can install is Qdirstat. It’s Qt-based, open source and does an outstanding job of quickly determining the location of large files and folders on your Linux PC.

Ubuntu

sudo apt install qdirstat

Debian

sudo apt-get install qdirstat

Arch Linux

Fans of Arch can install Qdirstat through the AUR if they want to use it, as the developers don’t officially support it.

To install Qdirstat on Arch Linux, open up a terminal window and use the Pacman tool to install both Git and Base-devel. These two packages are critical, and building the software is impossible without them.

sudo pacman -S git base-devel

Now that both Git and Base-devel are on your Linux PC, it’s time to download the latest version of the Qdirstat AUR build files. Grabbing the build files for Qdirstat is done with the git clone command.

git clone https://aur.archlinux.org/qdirstat.git

CD into the code folder.

cd qdirstat

In the code folder, run the makepkg command. Running makepkg here will generate an installable Arch package for Qdirstat. Keep in mind that when you run this command, the build may fail if it can’t install all of the Qdirstat dependencies.

makepkg -si

Fedora

sudo dnf install qdirstat -y

OpenSUSE

sudo zypper install qdirstat

Generic Linux

The source code is available for Qdirstat if you’re on a Linux distribution that doesn’t have an easy way to install it. Launch a terminal window and follow along to learn how to compile Qdirstat.

Before compiling the code, it’s essential to install all of the dependencies that the Qdirstat code needs. Search for these programs using your package manager and install them.

  • C++ compiler
  • Git
  • Qt 5 runtime environment
  • Qt 5 header files
  • libz (compression lib) runtime and header file

The Qdirstat building process starts by cloning the code with the git clone command.

git clone https://github.com/shundhammer/qdirstat.git

Move your terminal into the Qdirstat code folder with CD.

cd qdirstat

Invoke the qmake build command to start the compilation process.

qmake

After Qmake finishes, run the make command. Make will finish off the compilation of Qdirstat.

make

Install Qdirstat to your Linux PC with:

sudo make install

Scan Directories

To start scanning for files and folders, open Qdirstat. As soon as the program opens up, you’ll see a selection window. The file browser lists all of the directories it can access on the system. Look through the file browser window and select the area you’d like to scan. For most users, the ideal folder to choose is “home.”

Note: it’s possible to scan other hard drives, aside from the one where your Linux OS is set up. To do this, click the left-hand sidebar in the Qdirstat file browser, locate your desired hard drive and access it. Keep in mind that Qdirstat will not work with drives that are not mounted.

Now that Qdirstat has a scan location to work with, you’ll notice the left side of the program starts to populate a list of folders. These folders are scan results, and the program organizes them based on how large they are in size. Click on the arrow icons to sort through folders, and look at files. Like the folders, Qdirstat sorts data from biggest to smallest.

Navigating Data

When the Qdirstat tool scans a folder on your Linux PC, it’ll populate a “Treemap” on the left side of the window. This Treemap is very straightforward and easy to navigate. On the right side of the screen, you’ll see a graph with various squares in different colors.

The data graph allows users to see a visual representation of the data in the directory they scanned. To view a file through the Qdir visual chart, click on any square. Selecting a square will instantly show the exact location of the data in the Treemap on the left. Alternatively, you can right-click on a data square and click “copy URL” to get its location on your computer.

Delete Large Files

If you’re looking to delete a file or folder in Qdirstat, view your Treemap on the left (or the data graph on the right), right-click on a search result and click the “delete” button. Selecting “delete” will remove the file from your Linux PC instantly, so be careful! Don’t use the delete feature unless you’re sure!

Aside from deleting files, the Qdirstat also has a “move to trash feature.” To use it, look to your Treemap or data graph, find a search result and right-click on it. In the right-click menu, select “move to trash.”

Read How To Analyze Hard Drive Usage On Linux With Qdirstat by Derrik Diener on AddictiveTips – Tech tips to make you smarter

How To Back Up The LXQt Desktop Settings On Linux

Sick of re-setting up your LXQt desktop environment every time you install it? Instead of sitting at all of your computers taking time re-customizing your desktop, it might be a good idea to back up the LXQt desktop settings. That way, the next time you need to re-setup your LXQt environment, it happens in a matter of minutes, rather than hours.

Back Up LXQt Desktop Settings

If you’re trying to preserve your LXQt desktop settings, you’ll need to create a complete backup of your ~/.config folder. When backing up this folder, it’s best to compress it to a TarGZ archive.

To start the backup, open up a terminal and use the tar command to create a new archive. Be sure also to use the “p” switch. Using “p” switch will allow you to preserve all of the permissions of everything in the ~/.config folder.

Note: close any programs, including things like FireFox and Chrome when running this backup, as it may affect the compression process.

tar -cvpf config-folder-backup.tar.gz ~/.config

Your data is backed up in a TarGZ archive. Feel free to upload the config-folder-backup.tar.gz file to Google Drive, Dropbox, Microsoft OneDrive, etc.

Encrypt Backups

Encrypting desktop environments usually isn’t necessary. In this case, it’s not a required step, though users should still consider it. Why? We haven’t backed up LXQt’s config files on their own. Instead, we’ve created a backup of the default configuration folder, which holds sensitive data (like browser info, application info and potentially even passwords).

The quickest way to encrypt files and folders on Linux is with GPG. Launch a terminal window and follow the instructions below to learn how to install it.

Ubuntu

sudo apt install gpg

Debian

sudo apt-get install gpg

Arch Linux

sudo pacman -S gnupg

Fedora

sudo dnf install gpg

OpenSUSE

sudo zypper install gpg

Generic Linux

GPG has support on all Linux distributions in some form. To install it on your OS, search your package manager for “gpg” or “GnuPG.” Can’t find it? Check the Pkgs.org website for a downloadable binary file.

Make a backup up of config-folder-backup.tar.gz by running gpg with the “c” switch.

gpg -c config-folder-backup.tar.gz

In the terminal, enter a secure password. If the encryption is successful, config-folder-backup.tar.gz.gpg will appear in your home folder. Finish up the encryption process by removing the unencrypted archive file.

rm config-folder-backup.tar.gz

Finish up the LXQt backup process by uploading  config-folder-backup.tar.gz.gpg to a safe place online or on your network.

Themes And Icons

After backing up the ~/.config folder, you’ll need to create a backup of your custom icons and themes. If you don’t, LXQt will not look right after the backup is restored.

Generally, most users have icons set up in the ~/.icons and ~/.themes folders, so we’ll be creating backups of those using the tar command. Keep in mind that if you install your custom icon themes system-wide, you’ll have to back up the /usr/share/icons/ and /usr/share/themes/ instead.

To start the backup, open up a terminal and use the tar command.

tar -cvpf custom-icons.tar.gz ~/.icons

tar -cvpf custom-themes.tar.gz ~/.themes

For a system-wide backup of custom icons and themes, run the following commands

sudo -s

cd /usr/share/

tar -cvpf custom-icons.tar.gz icons

tar -cvpf custom-themes.tar.gz themes
mv *.tar.gz /home/username/

When the compression process is complete, close the terminal and open up your file manager. In the file manager, navigate to your home folder and upload both custom-icons.tar.gz and custom-themes.tar.gz to the cloud, or a home server for storage purposes.

Restore Backup

Grab a copy of your config-folder-backup.tar.gz.gpg data and place it in ~/Downloads on your Linux PC. When that’s taken care of, place the custom-icons.tar.gz and custom-themes.tar.gz files there as well. After all of the TarGZ archive files are in place, launch a terminal window and use the CD command.

cd ~/Downloads

Decrypt your config-folder-backup.tar.gz.gpg file using the gpg command.

gpg config-folder-backup.tar.gz.gpg

Using the tar command, extract the contents of the decrypted config-folder-backup.tar.gz archive to the home directory.

tar --extract --file config-folder-backup.tar.gz -C ~/ --strip-components=2

After restoring your configuration files, extract both the icon and theme archive files with tar.

Restore icons and themes for single users

tar --extract --file custom-icons.tar.gz -C ~/ --strip-components=2

tar --extract --file custom-themes.tar.gz -C ~/ --strip-components=2

Restore icons and themes system-wide

sudo tar --extract --file custom-icons.tar.gz -C /usr/share/ --strip-components=1 --overwrite 

sudo tar --extract --file custom-themes.tar.gz -C /usr/share/ --strip-components=1 --overwrite

Now that the custom icons and themes are in place, restoration is complete. Finish up by restarting your Linux PC. When you log back in, LXQt should look as if nothing happened.

Read How To Back Up The LXQt Desktop Settings On Linux by Derrik Diener on AddictiveTips – Tech tips to make you smarter

How To Back Up The Budgie Desktop Settings On Linux

If you’re looking to back up the Budgie desktop, panel, widgets, and all of that, it requires working with Dconf. To work with Dconf, you’ll need to ensure that it’s installed and working on your Linux PC.

Install Dconf

Note: Dconf is most likely already on your Linux PC. Still, it’s important you try to re-install this software, just in case.

Ubuntu

sudo apt install dconf*

Debian

sudo apt-get install dconf*

Arch Linux

sudo pacman -S dconf

Fedora

sudo dnf install dconf

OpenSUSE

sudo zypper install dconf

Generic Linuxes

Need Dconf on your system but not using something on the list above? Open up a terminal and use your package manager to search for “dconf.” When you’ve found it, install all packages with “dconf” in the name.

Back Up Budgie Settings

A full backup with Dconf is the best way to ensure that all of your system settings (including Budgie) are safe. To create the backup, launch a terminal window and run the dconf dump command to make a copy of your entire Dconf setup. DO NOT USE SUDO!

dconf dump / > full-backup

With the setting dump complete, run it through the cat command to verify the contents of the file.

cat ~/full-backup | more

If the contents of the file look good after running it through the cat command, type clear to blank out the terminal. Then create a folder in your ~/Documents directory to store the backup file. Moving the data here, rather than keeping it in your home directory is a good idea, as it will ensure that you do not accidentally delete it at a later date.

mkdir -p ~/Documents/dconf-backups/

mv full-backup ~/Documents/dconf-backups/

Budgie-only backup

Going the Budgie-only route when creating a new backup is an excellent idea if you only care about saving your core settings, and not the entire system. To make a new backup, export the data in /com/solus-project/ using the dconf dump command.

dconf dump /com/solus-project/ > budgie-backup

After the export command finishes, view the backup file with the cat command. Looking at the data file will allow you to assess whether the backup was successful.

cat ~/budgie-backup | more

If the backup looks ok, create a new backup folder in ~/Documents and move the data there with the mv command.

mkdir -p ~/Documents/budgie-backups/

mv budgie-backup ~/Documents/budgie-backups/

Themes And Icons

You’ve backed up your Budgie settings by exporting them from Dconf. Making a backup in that way will ensure that your panel, widgets and other customizations are intact. However, it will not keep your custom icons and themes in place, as Dconf is only text and can’t contain icon and theme files. As a result, you’ll need to make a complete backup of both your ~/.icons and ~/.themes folders.

To create the backup, open up a terminal and use the tar command to compress these folders.

Note: if you install custom themes and icon files system-wide, you’ll need to back up the /usr/share/icons/ and /usr/share/themes/ directories, rather than ~/.icons and ~/.themes.

tar -cvpf custom-icons.tar.gz ~/.icons

tar -cvpf custom-themes.tar.gz ~/.themes

mv *.tar.gz ~/Documents/budgie-backups/

Alternatively, create a system backup.

sudo -s

cd /usr/share/

tar -cvpf custom-icons.tar.gz icons

tar -cvpf custom-themes.tar.gz themes
mv *.tar.gz /home/username/Documents/budgie-backups/

Take the “budgie-backups” folder and upload it to your favorite cloud storage provider for safe keeping. Alternatively, put it on a home server or an external hard drive.

Restore Backup

Download your “budgie-backups” folder from the cloud (or a home server) and place it in ~/Downloads on your Linux PC. Then, open up a terminal window and use the CD command to navigate from home directory to your ~/Downloads folder.

cd ~/Downloads/budgie-backups

Using the dconf load command, restore your Budgie desktop settings.

Full restore command

dconf load / < full-backup

Gnome-only restore command

dconf load /com/solus-project/ < budgie-backup

After restoring the Budgie desktop backup, it’s time to put our custom icons and themes into place on the system.

Restore icons for a single user

To restore your custom icons and themes for a single user, run the following commands in a terminal window.

tar --extract --file custom-icons.tar.gz -C ~/ --strip-components=2

tar --extract --file custom-themes.tar.gz -C ~/ --strip-components=2

Restore icons for system-wide users

To restore system-wide icons and themes, do the following operations in the command-line.

sudo tar --extract --file custom-icons.tar.gz -C /usr/share/ --strip-components=1 --overwrite 

sudo tar --extract --file custom-themes.tar.gz -C /usr/share/ --strip-components=1 --overwrite

With all the files restored to your Linux PC, Budgie should look as if it did before you made the backup. If it doesn’t look right, log out of the session and log back in.

Read How To Back Up The Budgie Desktop Settings On Linux by Derrik Diener on AddictiveTips – Tech tips to make you smarter

How To Back Up The LXDE Desktop Settings On Linux

Customizing a desktop environment on Linux is fun and rewarding but time-consuming. Rather than spending an entire day re-setting up your LXDE desktop environment each time you install it, you shold back up the LXDE desktop settings, and restore from it whenever you need to.

Back Up LXDE Settings

LXDE is still a popular desktop environment, despite its age. Due to the age of it, you won’t be able to do a quick backup by exporting things in Dconf. Instead, if you want to preserve your LXDE desktop environment, you’ll need to create a complete backup of the ~/.config folder.

Making a backup of ~/.config is best done with a TarGZ archive. With these types of archives, users can easily preserve all of the file permissions in the backup. While safeguarding permissions for configuration files isn’t ultimately that important, it’s still a reasonable precaution to take.

Open up a terminal and use the tar command to create a new TarGZ archive.

tar -cvpf my-configuration-folder.tar.gz ~/.config

Encrypt Backups

Creating a GPG encryption of a desktop environment, for the most part, isn’t required. However, in this tutorial it is since we are building a complete backup of the entire ~/.config folder (which has your browser profile, and other application login settings) rather than just a few LXDE folders.

Before attempting to make a complete GPG backup, you’ll need to ensure that you have GnuPG on your Linux PC. Open up a terminal and follow the instructions that correspond with your operating system.

Ubuntu

sudo apt install gpg

Debian

sudo apt-get install gpg

Arch Linux

sudo pacman -S gnupg

Fedora

sudo dnf install gpg

OpenSUSE

sudo zypper install gpg

Generic Linux

Need to install GPG on your Linux PC but unsure of how to do it? Open up a terminal window, search the package manager for “gpg” and install it. Alternatively, find a downloadable binary package from Pkgs.org.

Start the encryption process by executing the gpg command along with the “c” switch.

gpg -c my-configuration-folder.tar.gz

Fill out the password prompt that appears in your terminal to finish the encryption process. Don’t forget to use a secure password! When the encryption is complete, you’ll see my-configuration-folder.tar.gz.gpg in your home directory. Feel free to upload this file to the cloud or a home server for safe keeping.

After uploading the backup to a safe place, use the rm command to delete the unencrypted TarGZ archive.

rm my-configuration-folder.tar.gz

Themes And Icons

The LXDE desktop environment configuration settings are safe and secure in a GPG encrypted archive. However, the LXDE backup process isn’t complete, as we still need to create a copy of your custom icons and and themes.

Creating a backup of custom icons and themes on Linux involves compressing  ~/.icons and ~/.themes folders into separate TarGZ archives. Start the backup process by opening up a terminal and running the following commands.

Note: did you install icons and themes system-wide? If so, create a back up of  /usr/share/icons/ and /usr/share/themes/ directories, and not ~/.icons and ~/.themes.

tar -cvpf custom-icons.tar.gz ~/.icons

tar -cvpf custom-themes.tar.gz ~/.themes

For system-wide icons and themes, do the following.

sudo -s

cd /usr/share/

tar -cvpf custom-icons.tar.gz icons

tar -cvpf custom-themes.tar.gz themes

mv *.tar.gz /home/username/

Now that all custom themes and icons are in TarGZ archives, the backup is complete. Move these TarGZ files to the cloud, or a home server for safe keeping.

Restore Backup

Download your my-configuration-folder.tar.gz.gpg file and place it in the ~/Downloads folder. Do the same for the custom-icons.tar.gz and custom-themes.tar.gz files. When all of the files are in place, open up a terminal window and use the CD command to navigate to the ~/Downloads folder.

cd ~/Downloads

In ~/Downloads, use the gpg command to decrypt your my-configuration-folder.tar.gz.gpg file.

gpg my-configuration-folder.tar.gz.gpg

Once decrypted, restore the file to your home directory with the tar command.

tar --extract --file my-configuration-folder.tar.gz -C ~/ --strip-components=2

After restoring your configuration files, extract both the icon and theme archive files with tar.

Restore icons and themes for a single user

tar --extract --file custom-icons.tar.gz -C ~/ --strip-components=2

tar --extract --file custom-themes.tar.gz -C ~/ --strip-components=2

Restore icons and themes system-wide

sudo tar --extract --file custom-icons.tar.gz -C /usr/share/ --strip-components=1 --overwrite 

sudo tar --extract --file custom-themes.tar.gz -C /usr/share/ --strip-components=1 --overwrite

When the icons are in place, your LXDE desktop you will need to reboot your Linux PC. This is because the LXDE desktop environment can’t automatically apply changes to the settings.

After restarting, log back into LXDE and everything should look as it did before creating your backup!

Read How To Back Up The LXDE Desktop Settings On Linux by Derrik Diener on AddictiveTips – Tech tips to make you smarter