Tag Archives: cli

Finding Files in the Command Line

Unfortunately in Linux, certainly Ubuntu, the default GUI file search is not the most useful way to find files. With just a small amount of patience you can find files quickly and easily using the command line, and your options for this are really powerful if you want to learn a bit about it. Locate The […]

This post, Finding Files in the Command Line, was written by Nixie Pixel and first appeared on OMG! Ubuntu!.

Read More

Streamlink 0.5.0 Adds Support For Streaming Google Drive / Google Docs Videos

Streamlink 0.5.0 was released yesterday, bringing support for streaming videos from Google Drive / Google Docs, along with other improvements.


Forked from Livestreamer, which is no longer maintained, Streamlink is a command line tool (and API) that can be used to stream videos from various streaming services, such as Twitch, YouTube Live and many more, and play them using your favorite video player, be it VLC, mpv, and more.

It is is available for Linux, Windows, and Mac OS.

Changes in Streamlink 0.5.0 include:

  • added support for streaming videos stored on Google Drive / Google Docs;
  • added support for BBC iPlayer live and VOD, along with support for HLS streams;
  • add support for Beam VOD and HLS streams for live;
  • added support for camsoda.com;
  • added new plugin: canlitv;
  • added new plugin: garena;
  • Aliez plugin now accepts any TLD;
  • added support for avi/mov VOD streams for rtve;
  • removed dead plugins such as blip.tv, gaminglive.tv, leon.tv, livestation.com and more.

Since our initial article about Streamlink, the tool has seen quite a few improvements, including support to use FFmpeg to mux separate video and audio streams, along with new plugins and much more. Check out the Streamlink GitHub releases page for a complete changelog.

For a complete list of supported streaming services, see THIS page.

Using the Streamlink command line interface is very simple. Here’s an example using a Google Drive video. The first thing you need to do is run Streamlink with the link you want to stream, to see the available streams:

streamlink https://drive.google.com/open?id=0B0tRrdcY7CwJWGdVdHEyYWpfTTQ

This should list the available formats:

[cli][info] Found matching plugin googledrive for URL https://drive.google.com/open?id=0B0tRrdcY7CwJWGdVdHEyYWpfTTQ
Available streams: 360p_alt, 480p_alt, 360p (worst), 480p, 720p, 1080p (best)

Next, simply add one of the available streams at the end of the command, and Streamlink will start streaming:

streamlink https://drive.google.com/open?id=0B0tRrdcY7CwJWGdVdHEyYWpfTTQ 1080p

By default, Streamlink uses VLC to play the stream, but you can specify a different video player by using the “–player” argument, e.g. “–player mpv” to use mpv instead.

For more about using the Streamlink command line interface, check out THIS page.

Install Streamlink

Ubuntu / Linux Mint users can install Streamlink by using the main WebUpd8 PPA. To add the PPA and install Streamlink, use the following commands:
sudo add-apt-repository ppa:nilarimogard/webupd8
sudo apt update
sudo apt install streamlink

I didn’t add a direct deb download link because the PPA provides quite a few dependencies required to install Streamlink.
For how to install Streamlink in other Linux distributions, Windows or Mac OS, see THIS page.
Report any bugs you may find @ GitHub.

Read More

Automatically Organize Your Downloads Folder In Linux Using `Classifier` (Command Line)

My downloads folder is pretty messy but I can’t just delete things because I still need most of the stuff I download. To “fix” this, I was looking for an app that can automatically organize my downloads, and I stumbled upon Classifier, an easy to use command line tool that can organize files in any directory.
Here’s an example – on the left there’s a folder which contains various file types (images, archives, documents, etc.) and on the right it’s a folder that contains the exact same files as the folder on the left, but after running Classifier to organize it (into folders):

classifier organize folder

Classifier organizes a directory based on file extension, moving the files into specific folders, like music, documents, images and so on.
I should also note that while this article mentions organizing the downloads folder, Classifier can be used to organize files in any any directory.

To organize files in the downloads (~/Downloads) folder, either run Classifier in that folder with no arguments, e.g.:

cd ~/Downloads

Or specify the directory as an argument, like this:

classifier -d ~/Downloads

Classifier can also organize specific file types that aren’t classified by default, organize by creation date and more. You can find a few examples on its GitHub page.

Here are all Classifier options:

$ classifier --help
usage: classifier [-h] [-st SPECIFIC_TYPES [SPECIFIC_TYPES ...]]

Organize files in your directory instantly,by classifying them into different

optional arguments:
-h, --help show this help message and exit
Move all file extensions, given in the args list, in
the current directory into the Specific Folder
Folder to move Specific File Type
-o OUTPUT, --output OUTPUT
Main directory to put organized folders
The directory whose files to classify
-dt, --date Organize files by creation date

Since the tool organizes files only when it’s ran, and you may not want to run it manually every day / hour, etc., you can create a cron job to run it periodically. For those who are not very familiar with Cron, here’s an online crontab generator (use the full path to the classifier executable in the crontab if you install it using the instructions in this article).
Important: Classifier doesn’t display any warning or confirmation when moving files, and there’s no way to undo any operations it performs, so make sure you run it in the correct folder and / or with the correct arguments!

Tip: for a somewhat similar tool which doesn’t organize folders based on file types, but based on when the files were last accessed, check out Download Sweeper.

Install Classifier

1. Classifier can be installed using Python pip (you’ll also need python-setuptools). To install python-pip and python-setuptools in Ubuntu, Debian, Linux Mint and other Debian-based Linux distributions, use the following command:
sudo apt install python-pip python-setuptools

2. Next, install Classifier (for the current user only) using the commands below (the first command installs wheel because it looks like the installation fails if it’s not installed first):

pip install --user wheel
pip install --user classifier

3. The Classifier executable is installed under ~/.local/bin, and this may not be in your PATH by default. To add ~/.local/bin/ to your PATH, paste PATH=”$HOME/.local/bin:$PATH” in your ~/.bashrc file (replace it with ~/.zshrc if you use Zsh) file. You can use the command below to do this from a terminal:

echo "PATH="$HOME/.local/bin:$PATH"" >> ~/.bashrc

And finally, source the ~/.bashrc (or ~/.zshrc if you use Zsh) so the new configuration is used in the current terminal (opening a new shell should work as well):

. ~/.bashrc

(there’s a dot, then a space followed by ~/.bashrc)

Later on, if you want to update Classifier, use the following command:

pip install --user --upgrade classifier

To download the Classifier code, report bugs, etc., see its GitHub page.

Read More

Uber CLI: Quickly Get Uber Time-To-Pickup And Price Estimates From The Command Line

uber logo

Uber CLI is a tool to get time-to-pickup and price estimates for Uber from the command line. The application cannot be used to request Uber rides.

This is useful if you use Uber and the command line a lot, as it’s much faster than checking these details on your phone, especially if you create some Bash aliases for your home address and the places you frequently use Uber to get to.

The developer says that he created Uber CLI because “[…] as a lazy person it pains me every time [I] open my phone, open the Uber app, type my destination, and see the estimated price, only for my inner, responsible, cost-cutting, fiduciary-self to end up taking the bus all the way home. I think we can all agree that it would be much more efficient to simply be disappointed before I open my phone at all”.

Installing and using Uber CLI

1. To install Uber CLI, you’ll need Node.js and npm.

For Ubuntu 16.04 and newer, you can use the Node.js and npm packages from the official repositories:

sudo apt install nodejs npm

For Ubuntu versions older than 16.04, you’ll need a newer Node.js/npm version. This can be installed by using the official Node.js repository. You’ll find exact instructions HERE (in my test I installed Node.js 6.x in Ubuntu 14.04 and uber-cli installed without any issues).

2. Install Uber CLI

Before proceeding, you may wish to set up npm to allow installing packages globally without sudo. For how to do this, see our previous article. You can skip this and use the command below with sudo, but that’s not recommended!

To install Uber CLI, simply type the following command in a terminal:

npm install uber-cli -g

That’s it. You can now start using Uber CLI. To get a time-to-pickup estimate, use the following command:

uber time 'pickup address'

replacing ‘pickup address’ with the address the Uber ride should pick you up.

Here’s an example:

$ uber time '10 downing street london uk'
│ 10 Downing St, Westminster, London SW1A 2AA, UK │
│ │ │
│ 2 min. │ uberPOOL,uberX,uberXL │
│ 4 min. │ UberEXEC │
│ 6 min. │ UberLUX │
│ 8 min. │ uberASSIST │
│ 17 min. │ uberWAV │
│ 14 min. │ taxi │

You may skip the city and country – in my test, this worked without any issues, but I assume it is required in cases where there are multiple streets with the same name, etc.

To get price estimates, use the following:

uber price -s 'start address' -e 'end address'

replacing the start and end addresses with the actual locations.

Here’s an example:

$ uber price -s '10 downing street london uk' -e '221b baker street london uk'
│ │ │ │ │ Surge │
│ uberPOOL │ £10-£11 │ 3.74 mi. │ 20 min. │ │
│ uberX │ £9-£12 │ 3.74 mi. │ 20 min. │ │
│ uberXL │ £13-£17 │ 3.74 mi. │ 20 min. │ │
│ UberEXEC │ £17-£23 │ 3.74 mi. │ 20 min. │ │
│ UberLUX │ £27-£35 │ 3.74 mi. │ 20 min. │ │
│ uberASSIST │ £9-£12 │ 3.74 mi. │ 20 min. │ │
│ uberWAV │ £9-£12 │ 3.74 mi. │ 20 min. │ │
│ taxi │ ?undefined-?undefined │ 3.74 mi. │ 20 min. │ │
│ │ 10 Downing St, Westminster, London SW1A 2AA, UK │
│ │ 221B Baker St, Marylebone, London NW1 6XE, UK │

The blank cells in the examples above are Emoji, but I removed them so the columns don’t get messed up. To get Emoji support in Linux, install the EmojiOne Color SVGinOT font (but note that it doesn’t work properly with monospace formatted text and causes incorrect character alignment, or at least that’s the case at the time I’m writing this).

app seen @ desdelinux.net

Read More

Configure npm To Install Packages Globally Without sudo Using A Script

npm logo

npm is the default package manager for Node.js. It consists of a command line client that integrates with a remote registry, and it makes it easy to install, share and distribute code.

If you’re using npm installed from a repository in Linux (like the official Ubuntu or Node.js repositories), you may have noticed that you can’t install packages globally (“-g”) as a regular user. Many websites mention installing npm packages using sudo, but this messes up some permissions and is not recommended.

The easiest way to get npm to download packages globally without sudo (“npm install -g <package>”) in Linux is to use a script, called npm-g_nosudo, to automatically set everything up.

The script GitHub page mentions that it was tested on Ubuntu 14.04 with Bash, but I don’t see why it wouldn’t work in other Linux distributions.

As an alternative, you can use THESE instructions to set up npm to install packages globally without sudo in Linux.

Here’s what the npm-g_nosudo script does:

  • creates a backup list of your installed npm packages and removes all but npm;
  • then it creates a local directory and configures node to use this for global installs (~/.npm-packages); this (optionally) includes adding the local directory and bin paths to ~/.bashrc or ~/.zsh;
  • it fixes permissions for the ~/.npm directory;
  • and finally, it reinstalls the old packages.

The reason behind publishing this article is to be able to link to it in future posts that mention installing npm packages, to make it easy for users to install them the recommended way – without sudo.

Another way of installing packages with npm in Linux without sudo is by using NVM to install Node.js, instead of a repository.

Configure npm to install packages globally without sudo on Linux (using npm-g_nosudo)

Before proceeding, it’s important to mention that you should never run scripts without understanding what they do. So take a look at the npm-g_nosudo script before running it!

To download the npm-g_nosudo script and run it, use the following commands:

cd && wget https://raw.githubusercontent.com/glenpike/npm-g_nosudo/master/npm-g-nosudo.sh
chmod +x npm-g-nosudo.sh

The script will ask you to choose the install directory – you can press ENTER to use the default directory (~/.npm-packages). The second and final step is to choose if if you want to update ~/.bashrc and ~/.zsh with the new paths – type “y” and press ENTER to do this automatically, or “n” to perform these changes manually.

Once you’re done, remember to source ~/.bashrc or ~/.zsh, depending on what you use (or launch a new terminal):
– for Bash:

source ~/.bashrc

– for Zsh:

source ~/.zsh

Read More

Argos Lets You Create GNOME Shell Extensions From Scripts (W/ BitBar Plugin Support)

Argos is a tool inspired by the BitBar app for Mac, which makes it easy to create your own GNOME Shell extensions, using information provided via scripts.
Being a GNOME Shell extension itself, Argos adds a button with a dropdown on the GNOME Shell top panel. This button can display or expose functionality provided by a script, be it Bash, Python, Ruby, and so on (remember to make it executable or else Argos won’t use it).

Here’s Argos in action (gif via Argos GitHub page):

Argos GNOME Shell script extension

Basically, the extension turns an executable’s standard output into information that’s displayed by Argos on the GNOME Shell top panel and its dropdown menu. A new button is added for each executable file placed in the Argos configuration directory (~/.config/argos/).

For example, you can use Argos to display weather, ping, stocks or network download speed on the GNOME Shell Top Panel, while providing advanced information in its dropdown menu, like a weather forecast, ping details, a list of stocks, or network upload and download speed.
Furthermore, plugins are not limited to displaying information. Argos can also perform actions on click, so for instance, you could create a launcher. Here’s a simple launcher created with Argos:

Argos GNOME Shell script extension

Another example – Argos running “top” in its submenu:

Argos GNOME Shell script extension

The code for these two examples is available HERE.

Argos is not only inspired by the Mac BitBar app, but it also supports many Bitbar plugins, without any modifications. Note that not all BitBar plugins run on Linux, so you’ll have to use plugins that don’t contain macOS-specific code to use with Argos.
You can find BitBar plugins on the GetBitBar website or, to directly download the code, see the BitBar plugins GitHub page.

Below you’ll find a few BitBar plugin examples, used with Argos under GNOME Shell:

Argos GNOME Shell script extension
Hacker News

Argos GNOME Shell script extension
Ping results for multiple websites

Argos GNOME Shell script extension
Bandwidth test (to use this, install speedtest-cli and change the executable from ~/bin/speedtest-cli to simply “speedtest-cli”)

Under the hood, Argos uses an asynchronous execution engine, which should prevent blocking, even for long-running scripts. Furthermore, its GitHub page mentions that Argos is optimized for minimum resource consumption, so even with multiple plugins refreshing every second, it should still use less than 1% CPU.
For a similar tool (but without BitBar support) for desktops that support AppIndicators, see Sysmonitor Indicator or the old “Zenity for AppIndicators“.

Install Argos for GNOME Shell

1. Install Argos

Argos is not available on the GNOME Shell extensions website, so you must install it manually. To make it easy to install, you can simply use the following commands:
sudo apt install git
mkdir -p ~/.local/share/gnome-shell/extensions/
git clone https://github.com/p-e-w/argos.git ~/.local/share/gnome-shell/extensions/argos
ln -s ~/.local/share/gnome-shell/extensions/argos/argos@pew.worldwidemann.com/ ~/.local/share/gnome-shell/extensions/

Alternatively, if you don’t want to use the commands, you can download the extension .tar.gz from HERE and extract the “argos@pew.worldwidemann.com” folder to ~/.local/share/gnome-shell/extensions/

2. Restart GNOME Shell and enable Argos

To restart GNOME Shell, press Alt + F2 and type “r” (without the quotes). Then use GNOME Tweak Tool to enable the extension.

Later on if you want to update the extension (if you’ve used the commands mentioned above to install it), open a terminal and type:
cd ~/.local/share/gnome-shell/extensions/argos
git pull

Argos is very well documented so I won’t get into details about using it here. For how to use Argos, please visit its GitHub page.

Read More

Rclone Is Now Available As A Snap Package [Quick Update]

cloud storage

[Quick Update] Rclone is now available as a snap package, making it easy to install and update on a wide range of Linux distributions which support Snaps, like Ubuntu, Debian, Fedora, Gentoo, Arch Linux, openSUSe and more.

Rclone is a command line tool for synchronizing files and folders to multiple cloud storages (either from your machine or from one cloud storage to another). It supports Dropbox, Google Drive, Amazon S3, Amazon Drive, Microsoft One Drive, Yandex Disk, and more.

For more information about Rclone, as well as a GUI for it, see the following articles:

To install the Rclone (currently the snap provides a development version, 1.3.5-dev) snap package, use the following command:
sudo snap install rclone --classic

This should install the Rclone binary under /snap/bin/. The “–classic” argument is used because it puts the snap in classic mode and disables the security confinement. This is required for Rclone to work, or else it won’t be able to access some user files.

Later on, if you want to update the Rclone snap, use:

sudo snap refresh rclone

You can update all the installed snaps using:

sudo snap refresh

For the “snap” command to work, you need the “snapd” package. This should be installed by default in recent Ubuntu versions, like 16.04 and 16.10 or 17.04. For Ubuntu 14.04, you can install it from the repositories:
sudo apt install snapd

For other Linux distributions, installing snapd is detailed on the Rclone installation page @ GitHub.

I should also mention that there’s currently only one Rclone version – 1.35-dev -, available as a snap, no matter what channel you choose (stable / candidate / beta / etc/):
$ snap info rclone
name: rclone
summary: ""rsync for cloud storage" "
publisher: fireeye
description: |
"rsync for cloud storage" - Google Drive, Amazon Drive, S3, Dropbox, Backblaze
B2, One Drive, Swift, Hubic, Cloudfiles, Google Cloud Storage, Yandex Files
- rclone
tracking: stable
installed: 1.35 (55) 5MB -
refreshed: 2017-02-15 22:00:31 +0200 EET
stable: 1.35 (55) 5MB -
candidate: 1.35 (55) 5MB -
beta: 1.35 (55) 5MB -
edge: 1.35 (55) 5MB -

Read More

Jam: Listen To Google Play Music From The Console

A couple of weeks ago I wrote about GPMDP, a Google Play Music desktop application that integrates Google Play Music with the desktop and adds various features on top. If you don’t need all those desktop features and all you need is a lightweight, console Google Play Music client, you can try Jam.

Jam Google Play Music console player

Jam is a new Google Play Music console player for Linux and Windows. The application, which is written in Go, had its first alpha release about two weeks ago, and it’s currently at version 0.4.0.

Jam features a console interface very similar to that of Cmus, with easy keyboard navigation. While the interface is easy to use, it currently lacks a help screen, so for a list of keyboard shortcuts, see the Jam GitHub page.

Jam features:

  • console interface inspired by Cmus;
  • Last.fm scrobbling;
  • play, pause (this is buggy), stop, previous / next track;
  • populates a local database with the artists and albums you saved through the web interface (or by any other means) and allows searching artists in this database.

Jam is still very new, so it lacks a few features, but its developer hopes to improve it further, by making its interface detachable like MOC or to allow controlling the playback via command line arguments. If there’s some feature you’d like to see in Jam, you can submit a bug report.
It’s important to mention for Jam to work, you need to login using the same account used for Google Music on your mobile device. Without this, you will get a “no valid devices” error when trying to login with Jam.
If you use the Google two-factor authentication, you’ll need to generate an app password for Jam. You can do this by visiting THIS link.

Download Jam (64bit binary)

Download Jam (64bit binaries are available for Linux and Windows)

To install the 64bit binary on Linux, download it from GitHub (it’s the first one, called simply “jam”) and place it in your home folder. Then to install it to /usr/local/bin/ (so it’s available in your PATH), use the following command:
sudo install jam /usr/local/bin/

How to install Jam from source

Note: the instructions below were tested on Ubuntu 16.04+ / Linux Mint 18.x and may not work on older Ubuntu versions (golang-go may be too old).

To install Jam from source, you’ll need Go, Git and libpulse-dev. Install these in Ubuntu / Debian / Linux Mint using the following command:

sudo apt install golang-go git libpulse-dev

Next, you’ll need to set the GOPATH environment variable and make the GOPATH/bin folder available in your PATH. To do this (and use ~/.go as GOPATH), use the commands below:
mkdir ~/.go
echo "export GOPATH=$HOME/.go" >> ~/.bashrc
echo "export PATH=$PATH:$GOROOT/bin:$GOPATH/bin" >> ~/.bashrc
source ~/.bashrc

And finally, install Jam from source (the binary will be available in ~/.go/bin/) using the following command:

go get github.com/budkin/jam

If you encounter bugs, report them @ GitHub.

Read More