Skip to content

command line

Installing SSHPT to Automate SSH Commands & File Transfers on Multiple Hosts

SSHTP is a great little Python script that will allow you to run SSH commands or transfer files on multiple hosts with a single command.  It’s simple to use.  You simply create a hosts file with all of the remote systems you want to execute a task on, then create a file with credentials to login and run the task.  You can even configure it to be executed via a website in multiple configurations (more info on that at the bottom).

 

sshpt_command_line_window

 

Click Here To Keep Reading!

An Open Source, Command-Line App to Download Videos From Youtube & Over 100 Other Sites!

There is a wealth of outstanding content on Youtube and all of the other video sites online. Sometimes I like to download movies for trips, or training videos when I want to cut out distractions.

 

I found the solution; on Github of all places!  Youtube-dl is a simple command line executable you can use to download video quickly, with ease.  It supports hundreds of websites with video content.  Here’s how to use it on Windows.

 

How To Download Videos

 

First, we need to download the latest version of youtube-dl from Github. This link will always produce the latest version of youtube-dl, directly from Github:

 

https://yt-dl.org/downloads/latest/youtube-dl.exe

 

I suggest saving it in your “Videos” folder, located within your user folder.  You can find your user folder on your desktop. It’s the folder with your name.  There is a “Videos” folder already located there, by default.

Click Here To Keep Reading!

Secure Apache In No Time, For Free, With an SSL Certificate From Let’s Encrypt!

Recently, I found out about a non-profit organization called Let’s Encrypt, which came into existence earlier this year.  Let’s Encrypt is a publicly trusted certificate authority that issues FREE SSL certificates.  The SSL Certificates are fully functional and extremely easy to request and install.  In fact, using Let’s Encrypt, it only takes about a minute to request and install an SSL certificate on Apache via the Linux command line, using a few simple commands.  If you have a Linux server(s) running any sort of public facing web server, there is no reason not to do this right now.  Here’s how to do it on Ubuntu 16.04 (although it should be the same process on any version of Ubuntu)!

 

Prerequisites

To install an SSL certificate from Let’s encrypt using this guide, you will need a couple things.

  • A server running Ubuntu 16.04 (although this should work on any version of Ubuntu)
  • Apache installed with a domain name(s) that is resolvable to the IP of the server.
    • If you are hosting multiple domains, you will need to be sure you have Virtual Hosts configured that properly specify the ServerName variable.

 

Install the Let’s Encrypt Client

 

To make things easy, there is a client available, based on python, that will do all of the hard work for you.  The package is called python-letsencrypt-apache.  Let’s use Aptitude to install it.

 


#  sudo apt-get update

# sudo apt-get install python-letsencrypt-apache

 

The client is now installed and we can move on to setting up the SSL certificate.

Click Here to Keep Reading!!

How to Update Proxmox VE When “You Do Not Have A Valid Subscription”

If you have recently dove into the Proxmox VE world, your mind is probably blowing chunks.  Proxmox gives you the unmatched ability to run hypervisor-like Virtual Machines, as well as containers, side by side with High Availability.  It’s an amazing virtualization platform and if you haven’t tried it out yet I highly recommend you do so.  After installing Proxmox 4.2 on one of my lab servers, I found the need to update it and I wasn’t about to pay for an Enterprise Subscription for my home lab.

proxmox-1

How to update Proxmox when “You do not have a valid subscription for this server, please visit www.proxmox.com to get a list of available options” and keep you Proxmox server updated!”

There are a few steps involved and they go something like this:

  1. Disable the enterprise repository that is configured by default
  2. Add the no-subscription repository
  3. Update apt so it knows what can be updated
  4. Use apt to upgrade any packages
  5. Upgrade the entire distribution, using apt, of course

First, lets disable the enterprise repository.  You can’t run apt-get update by default without a subscription, you will get an error.  So, lets comment out that repo so it isn’t checked.  Go ahead and putty / ssh / console into your Proxmox server, and run the following command:


sed -i.bak 's|deb https://enterprise.proxmox.com/debian jessie pve-enterprise|\# deb https://enterprise.proxmox.com/debian jessie pve-enterprise|' /etc/apt/sources.list.d/pve-enterprise.list

Click Here to Continue Reading!

How to Run Bandwidth Speed Tests From the Linux Command Line With Speedtest.net

Believe it or not, there is a way to use Speedtest.net’s speed test service from a Linux command line. Usually, one would fire up a web browser and just go to Speedtest.net and the flash utility would load. Obviously, this is impossible from a command line. If you have a cloud instance or virtual private server (VPS), you don’t have a gui or a web browser. So, here is how to run an Internet speed test from the Linux command line.

To achieve this, there is a package called speedtest-cli. It is a python based utility that more or less has the same functionality as the gui. When ran with defaults, it will locate the closest server and run a download test, then an upload test, and display the results when it’s finished. You can do this by running:

#  wget -O - https://raw.github.com/sivel/speedtest-cli/master/speedtest_cli.py | python

After the script downloads and runs, you’ll see something like this:

Retrieving speedtest.net configuration...
Retrieving speedtest.net server list...
Testing from AT&T U-verse (108.238.104.79)...
Selecting best server based on latency...
Hosted by TekLinks (Birmingham, AL) [103.61 km]: 30.383 ms
Testing download speed........................................
Download: 98.96 Mbit/s
Testing upload speed..................................................
Upload: 56.06 Mbit/s

Personally, I like to select a specific server from a specific location when I run a speed test. I’ve found that the closest server, isn’t always the fastest. Just because a speed test server is located a couple hundred miles from you, it does not mean the path to it is linear, and it doesn’t mean their connection is fast enough to saturate your own. Not to worry, you can also select a server to your liking. There are two ways to approach this. You can either install the speedtest-cli package using your package manager, or you can download the script manually. I’ll cover both.

To install the speedtest-cli package on Ubuntu

#  sudo apt-get install speedtest-cli

After installing the package, you can simply run:

#  speedtest-cli

Now, if you’re using a distribution other than Ubuntu, or do not wish to install the package, you can simply download the script. To do that, do the following:

#  wget https://raw.github.com/sivel/speedtest-cli/master/speedtest_cli.py

#  chmod +x speedtest_cli.py

The chmod command gives execute permission to the file. This is required to run it. Once you have downloaded the script, you can run it by doing this:

#  ./speedtest_cli

There are quite a few options you can use with the script. I’ll go over the few that I have used. First up is –share. This option gives you a web link to share you speed test results with others. You’ve probably seen the little png boxes before. They look like this:

speed test results

So to get a nice automatically generated results picture like this, just run this command:

#  ./speedtest_cli.py --share

or

#  speedtest-cli --share

It will run the speed test like normal, but the very last line will have a link to your results. Now, like I was saying earlier, I like to specify the server the speed test runs against. To do that you first need to know the ID of the server you want to use. To get a list of speed test servers available, and their ID, run this command:

#  ./speedtest_cli.py --list | more

or

#  speedtest-cli --list | more

My favorite servers ID is 3595, so I’ll use it in my example. Once you have the ID of the server you want to use, all you need to do is specify it with the –server option. Be sure to swap out 3595 with the ID of your prefered server. Like this:

#  ./speedtest_cli.py --server 3595

or

#  speedtest-cli --server 3595

There are some other pretty cool options available if you want to play around some more. You can display values in Bytes instead of Bits, use the URL of a Speedtest Mini server, and even select the source IP you want to bind to. If you want to check out the other options available, run this command.

#  ./speedtest_cli.py --help

or

#  speedtest-cli --help

That’s all there is to it. If you run into any troubles feel free to ask for help in the comments below. Thanks!