Home Pauline Howto Articles Uniquely NZ Small Firms Search
Diary of a Homepage
Part 28 (November 2016 ->)

25 November 2016

DroidEdit - an Code Editor for Android

I have been looking once more for a good text/code editor for my Android machines now i have a Samsung Galaxy Tab S2 8" which now has the screen size and resolution to make it possible to look at writing some of the content for our web site without a laptop.

The advantages and features I have now discovered are:

Overall it seems to be a very practical option for writing and coding - very similar to gedit or xed in usability provided it is used on a machine with a big screen and one with adequate power if one wants syntax highlighting on big files.

There is another option anWriter which has code completion and seems faster and previews .htm files but does not have word wrap yet which is a show stopper or shortcut keys and is only planned in paid version.


26 November 2016

Video Editing Revisited (Kdenlive Versions 15.12.3 and 16.08.2)

I have started producing some videos from the Sony Camera taken earlier this year and from the new Panasonic Lumix TZ80 camera I bought to replace the existing still and complement the video cameras. This has meant that I have had to relearn all about Kdenlive which has changed significantly (for the better) since I last used it a couple of years ago. The last time I did any serious work with videos was in 2014 when I did a serious archiving of all my existing recordings which were on VHS tapes (mostly commercial recordings), Video8 tapes, and MiniDV tapes as well as the more recent digital recordings from the Sony Video Camera bought in September 2013 which have all been recorded in in H264 720p MP4 format although it is capable of 1080p.

All the earlier recordings were converted to .mp4 files, the analog ones as a single big file and the digital MiniDV ones as individual clips within a folder. The MiniDV files were also concatenated into a single file for easy playing prior to editing.

Folder and filename structures in use for source files:

Analog Video8 recordings from Sony Cameras.

Mostly singe file per tape captured under Windows and saved as .mpg (mpgv) 720x576 frame rate 25 and MPEG audio (mpga) for compatibility. These are stored in named folders under My Video/Video8 Capture/ eg My Video/Video8 Capture/1995 New Zealand/NZ95-1.mpg . Total 390 Gbytes. These suffer from edge artifacts which need to be trimed off.

These have been transcoded, de-intelaced and cropped of artifacts by Handbrake to .m4v files (H264 MPEG-4 AAC audio mp4a) typical resolution 704x578 for a display of 690x552 after triming which are typically <50% of the size and clean in appearance and are in stored in My Video/Video8 Videos/ typicaly My Video/Video8 Videos/NZ95-1.m4v suitable for viewing or as an input to an editor. 117 files total 185 Gbytes

JVC and Sony MiniDV from 2000 to 2012

Mini DV tapes are converted by Handbrake and are in form of My Video/DVnnn/DVnnn.yyyy.mm.dd_hh-mm-ss.m4v. There are 105 miniDV tapes labeled and in folders DV001 to DV105 for a total of 151 Gbytes

Sony Digital HDR-CX280 from 2013 ->

More recent Digital Video from Sony Camera and SDH cards are in My Video/yyyy/mm/dd/MAHnnnnn.MP4 where nnnnn goes from 00001 to 03007. Most of the folders also contain Sony 160x120 icon files with the .THM extension

Other less common sources of Digital Video 2008 - 2015

Canon A720 IS Camera Video (640x480) are also in My Video/yyyy/mm/dd/ and the files are MVI_nnnn.AVI tyoe MJPEG 640x480 frame rate 30 with Mono PCM sound.

Vivitar Underwater Camera are in My Video/yyyy/mm/dd/ and the files are CLIPnnnn.AVI type MPEG-4 (XVID) 640x480 frame rate 30 Mono MS ADPCM sound.

New Video Sources from 2016 ->

Panasonic Lumix TZ80 Camera - bought partially for its video capability with EVF (eye level Electronic ViewFinder) integrated into My Video/yyyy/mm/dd/P0nnnnn.MP4 where nnnnn is part of same series as .JPG picture files.

Canon Camera SX610 - 720i HD and 1080i Full HD both at 30 frames/sec None integrated so far and probably little use due to different format but destined for My Video/yyyy/mm/dd/MVInnnn.MP4 where nnnnis part of picture series.

Samsung Phones None integrated so far but destined for My Video/yyyy/mm/dd/

The following is a part of the structure:


Kdenlive has become even better as a Video Editor since I last used it as version .9xx. Version 15 seemed very stable after I can converted my existing files whilst 16.08 currently seems a bit more prone to crashes although the automatic backups seem to have avoided any significant lose of work. Lets look at what one needs to be able to do to edit a Video and see how Kdenlive does:

Minimum Video Editing Requirements

Desirable additions:


The panel above comes from my earlier work in Ubuntu on the Take largely writen before my shift from video cameras using MiniDV tapes to Cameras using solid state storage nor did it take into account my earlier Video8 analog tapes. Again DVDs are almost a thing of the past and few laptops have a DVD reader and DVD players are no longer an essential in every home entertainment system. In exchange the importance of the internet and mobile devices has increased as has the push to wards higher quality 'HD' and 'Full HD' video and onwards to 4k video. So although Kdenlive could cover the first point and the last they are no longer prime requirements, in fact the first step with MiniDV tape input is best split out and done in stages by specialised programs which allow the input scenes to be converted into a more efficient format more suitable for editing and outputing. Note: The latest version of Kddenlive acknowledge that and the DVD abilities are no longer integrated.

The rest of the list can easily be done by Kdenlive, much is intuitive but there are many shortcuts or tricks to make the process very efficient. There are also some facilities which would be very useful even if they do not all currently work fully including a mechnism to split a file into scenes based on content as well as time codes which would be extremely useful for the Video8 tapes where the scenes have to be manually split for editing.

Video Project and Rendering Profiles

Video8 Videos

This is probably the most demanding test of the video processing culminating in kdenlive

They were initially captured via an analog input using Pinnacle Studio DVplus software running under Windows Vista in circa 2007. This was before I converted completely to Linux and the Studio DVplus/Studio 10 were good editors at the time when I was initially working on my MiniDV videos. The format used was similar to that of MiniDV tapes as the intention in both cases was to create DVDs which use a subset of MPEG-2 at 720x576 with a pixel aspect ratio of 16x15 to give an aspect ratio at 4x3 at a display rate of 25 frames per second, interlaced. The audio is MP2 (MPEG Audio Layer II).

These files were latter (2014) transcoded using Handbrake to H264 reducing down to circa 1.8 Gbytes per hour. At the same time the size was cropped to 590x552 which, with a pixel aspect ratio of 16x15, retains the aspect ratio at 4x3 to a high degree of accuracy. The video was de-interlaced in Handbrake so it is progressive and the conversion to H264 has also led to a conversion of the PCM audio to AAC at 160 kb/sec stereo. The end result of this is that the Project Settings should use a SD/DVD Profile at 25 frames/sec., or one could create a special non standard profile for the 590x552 size.

The following screen grab shows the input clip properties and the project settings I have chosen to match.

and the settings for rendering are:

The rendering rate on my Defiant is circa 24 mins per hour of input video with the above settings and the resulting video occupies 1030 Mbytes/hr is considerably lower than the original 13 Gbytes per hour or the intermediate 1.8 Gbytes/hr and a very good match to the original Video8 video in quality. I did not experiment with the video quality setting but 18 is probably on the low side. Using 23 gives about 470 Mbytes/hr and may not impact the quality greatly if you want to minimise the sizes. NOTE: I have noticed one needs to change Auto to Force Progressive to force a progressive output.

Sony Camera in MP4 format

The Sony information states this is 1280 x720 pixels at 25 frames sec progressive quality , H.264 6M with AAC audio 384K (~3 Gbytes/hr). I have run a number of experiments on the settings in the rendering profile and a quality setting of 18 copes close to the incoming video bitrate of 6000 kb/sec and gives approximately 5500 kb/sec. The incoming stream has an audio bitrate of 128 kb/sec rather than the 384 quoted by Sony so the output bitrate has been selected to be the same. The measurements were made by using the internal properties screen for the incoming stream and the output using the same screen on a rendered video added back into the project bin. I found that the audio bitrate did not seem to be set correctly so I edited the ab= value to be 128k and also set up profiles with ab=160k and 192k. I did various tests of rendering speed and the medium setting on encoder speed seemed to give reasonable speeds and a slight improvement in video bandwidth. I am set to 8 threads but the setting seems to be ignored as changing to one thread makes no difference in the cores in use as displayed in my system monitoring.

Panasonic TZ80

Rendering with quality set to 18 and 128 kb audio gives at medium rendering speed a video bandwidth of 14050 kb/s and 6.5 Gbytes/hr data when the rendering is using the medium speed preset. Medium speed is 165% real time and 85% with the faster rendering preset. Faster at 18 gives video bandwidth almost the same at 13935 kb/sec and a fractionally smaller file size. Quality 19 gives a video bandwith of 12000 kb/sec. Quality 18 gives a video bandwith very equivalent to the 18 for the 720i from the Sony camera as (1920x1080)/(1280x720) = 2.25 so is probably a sensible standard to use but with the faster rendering preset as there is extra quality in hand. Quality 16 is required to fully match the Full HD input video stream at 20000 kb/sec if one has really fast action.

Background on presets etc in libav and impact on Profile settings

Rate Control and Quality

Constant Rate Factor is simple to use and targets a quality level and tries to maintain it over the encoding. The -crf value range is from 0 to 53 (or 63 in 10bit mode) and maps to the same range of the quantizer, ideally it would provide the same perceptual quality of the constant quantizer rate-control but in less space by discarding information human eyes would not perceive. As rule of thumb every increase by 5 halves the bitrate, 0 being lossless encoding. I have experimented in the range of 16 to 22 to match the video inputs and 18 seems a good compromise. Note the Kdenlive slider settings only give 15, 23, 30, 38 and 45 so the use of the 'More Options' box is essential and it is best to create a new profile with better options.


The encoder presets are ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow, placebo. There is the option of additional tunings which are film, animation, grain, stillimage, psnr, ssim, fastdecode, zerolatency. Only a subset is available through Kdenlive.

Each preset is supposed to be about twice as slow as the previous but this does not seem to be the case when used through Kdenlive.

Mixed Inputs

The Profile needs to be that of the most common input and the rendering should be the same. The new Canon SX610 can be used for video although that is not the intention. It records at 720i and 1080i in H264 (MP4) but at 30 frames/sec. I have done some experiments and Kdenlive seems to be quite happy to work with mixed inputs and render at H264 25i. I have checked the output is transcoded to 25 frames/sec and runs at the correct rate! I have not checked the audio with a quality input.

Audio Rates

I have gererally rendered at the audio bitrate of the input stream but will increasee that if I add a high quality audio track to 192kb/s or 384kb/s to match typical CD and MP3 sources.

Kdenlive - Some Basic Editing.

You can now reliably add multiple selected clips into the Project Bin, 200 now seems to be no problem.

You can drag (multiple) clips from the Bin to the timeline, again several hundred.

You can make and edit titles which then live in the Project Bin and can be saved for further (re)use in a folder - I use titles as the folder name and keep them in the project folder.

There are three tools for working in the timeline:

Remember to return to the standard Select after using the other tools..

There are now (since 15?) three modes which allow for three point editing, ie inserting into the timeline and making space or cuts to do so.

You can use the mouse wheel in the timeline ruler, timeline and zoom bar at bottom write to control the display

There are many useful shortcut keys to make accurate movements down to a frame at a time. See https://userbase.kde.org/Kdenlive/Manual/Useful_Information/Shortcuts


Before proceeding further I should mention snap which is crucial to the effective use of kdenlive - it should be on but can be toggled in the little toolbar at the very bottom right.

When this feature is on, dragging, for example, the beginning of one clip near to the end of another will result in the end of the first clip snapping into place to be perfectly aligned with the beginning of the second clip. As you move the two ends near to each other, as soon as they get within a certain small distance, they snap together so there is no space and no overlap. Note that this occurs even if the clips are on different tracks in the timeline. This occurs with almost every type of drag or positioning operation on clips, cursors, guides effects, transitions etc., and is how everything ends up accurately lined up when using the mouse.

Moving through your project

The timeline cursor shows your current position in the project. The positions of the cursors on the timeline ruler and Project Monitor are always in sync. Position can be moved in following ways:

Selecting a Zone and use of Zones

A zone can be selected in a clip or in the project and is required for certain activities such as setting up a region for preview video. The zone is displayed at the top of the timeline under the timecodes and in the project monitor. As far as I can tell the zone can only be selected in the project monitor using the Set Zone In (I) and Set Zone Out (O) buttons or in the timeline by shortcut keys I and O.

Also see https://userbase.kde.org/Kdenlive/Manual/Monitors#Creating_Zones_in_Project_Monitor

Adjusting Volume - Intro to use of Keyframes

The is a good tutorial from kdenlive at https://kdenlive.org/project/editing-audio-volume-with-keyframes/


Complete list of Kdenlive Keyboard Shortcuts

You can also see the full list and set up new shortcuts by Settings -> Configure Shortcuts. I have (re)set up two extra shortcuts :

Stabilising the Video

Select a Clip in the Project Bin -> Clip Jobs -> Stabilise ceates a 'clip' with .mlt added which you can drag to the timeline. There are a huge nuber of parameters and there is information in the Kdenlive Stabilisation Help

I have only used the defaults and it does seem to help a lot on flying videos despite the camera Image Stabilisation already present. The examples in the above reference are almost unbelievablely effective.

Now one needs to see if it is working. The best way is to set up a split screen of some sort by putting the stabilised and unstabilised videos below each other and using the Composite and Transform between them. In the simplest case you can just use the opacity setting to give a shadow of the old or you can add Position and Zoom Effects to each and scale to 50% and shift one sideways so you have a side by side comparison. You may need to use preview rendering to get a smooth view.

This has unfortunately shown that the stabilisation has had some unfortunate results in places on my flying aircraft videos so needs to be used with extreme care.

Kdenlive Effects - Motion Freeze

This is very useful if you have some video where parts are impossible to stabilise but you want to retain the audio track or just to turn it into a still [under a title].

This effect causes the video to freeze. If you add the effect and leave both check boxes unchecked, the clip will be frozen for its entire length. To change this, check either the Freeze Before or Freeze After setting and move the Freeze At slider to the time where you what the freeze to start or end. If Freeze Before is selected, the video will be frozen at the start and then start moving when it hits the Freeze At time. If Freeze After is selected, the video will be moving at the start and then freeze when it hits the Freeze At time. The audio in the video plays for the entire length, i.e. the Freeze effect does not alter the audio.

Preview Rendering

This is a new and very useful feature in Kdenlive 16.08. Again it is not implemented in an intuitive way but it is essential if one wants to look smoothly at complex effects in high resolution videos.

Automatic Scene Split

This only partially works which is a pity as it would be very useful for my early analog videos. It does seem to do something but the most I could make work was the analysis which seemed to generate split positions in frame number and possibly a confidence figure.

Copy Paste between Kdenlive Projects

This is an important addition in version 15 of Kdenlive but it is implemented in a complex way which is difficult to find and understand. I feel I have to refer to the Paper in the Kdenlive Toolbox on the Library which makes it reasonably clear. In Summary

Kdenlive Folder Defaults and Suggestions for Configuration.

The latest version of Kdenlive are quite different in many ways tothe previous versions I used which are versions .9x and many of the helpfiles and tutorials do not seem to have caught up which has meant that to some extent, I have had to experiment to findout the latest file usage and default folder locations. Kdenlive version 16.12 now locates its cache files in the Project Folder in a folder with a random 12 number name.

The subfolders are audiothumbs, videothumb and preview . Preview is a new feature.

These new caches can be cleared from within Kdenlive by Project -> Settings -> Cache Data and those still required will be regenerated if you re-open the project.

I have also found .cache/kdenlive/proxy/ which may contain the proxy files but I suspect they are now stored stored in a sub-folder within the project folder but I can not confirm that until I test it by using a proxy but Project -> Settings -> Cache Data has an option to clear it wherever it is! The old cache could always be deleted and would again be recreated and re-populated if required

There is now aConfig file which is .config/kdenlivec.

If you find that you settings are in a complete mess (such as being locked into full screen mode which happeded to me), it is possible to delete this file and you should be back to a basic new system but you will have to reconfigure everything including shortcuts, default folders etc.

So my Project Folders for the latest versions of Kdenlive 16.12. or higher is called Kdenlive and lives on my DATA partition (/media/DATA/Kdenlive) which contains sub-folders namely:

A folder I have created called Library to hold the kdenlive library - see below for setting default locations.

Folders for each Project with each containing:

Project files (.kdenlive) - these have multiple copies as I keep saving with increasing version numbers for security

A folder I have chosen to create called titles containing all title definitions (.kdenlivetitle) used in the project.

A folder I have chosen to create called pictures containing all custom pictures used in the project such as extracted frames and all other pictures not in My Pictures folder structure.

A folder I have chosen to create called rendered to contain rendered video. I also use a higher level folder called Rendered Video for more general rendered video.

The kdenlive project now also generate folders in the project folder - it always seems to generate one called .backup and I also have some called proxy and one called selections but they may be from an earlier version as well as the random numeric named folder containing the cache data.

The kdenlive project may also generate files, for example files with a .mlt extension with information on how to stabilise a video clip and, in this particular example, they are in the same folder as the video clip being stabilised.

I have deleted the folders called thumbs which no longer seemed to be used as it is replaced by folders in .cache/kdenlive in ones home folder

One needs to set up to use these default folder locations by Settings -> Configure Kdenlive -> Environment -> Default Folders where I have

The following shows a typical part of my folder structure where MRF is a project folder and Warbirds, Mediteranean_Wonders_2014 and Lisbon are further project folders. Library is the folder containg library items and is the only folder other than project folders directly beneath Kdenlive.

How robust is the structure above to changes in location and moves between machines and syncronisation between machines.

The folder Kdenlive can live anywhere as it contains all project specific files, the cache is a defined location in the home folder and all the 'input' files are defined to be in absolute locations in /media/DATA/My Videos and /media/DATA/My Pictures

If the input files are missing kdenlive does a search and/or asks for their new locations - I have checked that works for Video files. It may also be possible to create links (not tested)

My belief is that it should be possible to synchronise /media/DATA/Kdenlive, and /media/DATA/My Videos and /media/DATA/My Pictures between machines and everything should continue to work although it may take a while to recreate the thumbnails and other cached files. The project and kdenlive settings would also ideally need to be the same.

4 July 2017

Mint Consul Use

One can switch to console with CTRL+ALT+F1, log in, and type commands as usual to get out of a lockup of some form or kill a problem program using killall ie killall cinnamon-screensaver. Use CTRL+ALT+F7 or CTRL+ALT+F8 to get back to your session.

14th August 2017

Find text string in all files in current folder and subfolders.

This is very useful to search for use of programs etc when using Git

grep -rl "searchstring" .

Note the . (dot) at the end which could also be any /path

More interesting options at https://askubuntu.com/questions/55325/how-to-use-grep-command-to-find-text-including-subdirectories

2nd April 2018

Using Office 365 email under Linux

The Open University has started to provide access to Microsoft Office 365 to Students as well as Tutors. This has a big advantage even to a Linux user in that it provides an academic email address ie one ending in .ac.uk which is a standard way to check before firms provide academic discounts.

The way it works is that one first goes to the Office 365 Site office365.com where there should be a sign in link at the top right. Entering a email addess of the form ouusername@ou.ac.uk takes one to a OU specific login page and then one is into the online Office 365 which has a list of Apps you can access so -> Outlook and you have webmail access to your emails. Note that the forwarding option does not seem to work.

POP3 and STMP access to Office 365 Emails Accounts

Webmail access is useful but it is much better to be able to access from Thunderbird like all ones other accounts under linux or to use an Android phone or tablet. The setup is found in settings (the wheel at top right) -> Settings -> Mail (under your app settings) -> Accounts -> POP and IMAP which gives one all the information you need:

POP Setting

Server name: outlook.office365.com
Port: 995
Encryption method: TLS

IMAP Setting

Server name: outlook.office365.com
Port: 993
Encryption method: TLS

SMTP setting

Server name: outlook.office365.com
Port: 993
Encryption method: TLS

You only need this information and although there are some other tick boxes I left everything alone and it may well be that you never need to sign into Office 365 but I suggest you do as it may be required to initiate everything.

We now have the information to set up Thunderbird as usual when adding a new POP3 or IMAP account which I will not go into in detail although I have put some screen shots below to show what has been set or changed fro defaults

8 May 2018

Use of systemd (Part of checks to see if applets work on other distributions)

The applets need to access various system functions such as suspend and some of the applets need programs running the background as daemons ie the vnstat daemon. The following is a very brief introduction to systemd sufficient to act as a reminder for me and is based on https://wiki.archlinux.org/index.php/Systemd

Basic systemctl usage

The main command used to introspect and control systemd is systemctl. Some of its uses are examining the system state and managing the system and services. See systemctl(1) for more details.

Tip: You can use all of the following systemctl commands with the -H user@host switch to control a systemd instance on a remote machine. This will use SSH to connect to the remote systemd instance.

Analyzing the system state

Show system status using:

$ systemctl status

List running units:

$ systemctl


$ systemctl list-units

List failed units:

$ systemctl --failed

The available unit files can be seen in /usr/lib/systemd/system/ and /etc/systemd/system/ (the latter takes precedence). List installed unit files with:

$ systemctl list-unit-files

Using units

Units can be, for example, services (.service), mount points (.mount), devices (.device) or sockets (.socket).

When using systemctl, you generally have to specify the complete name of the unit file, including its suffix, for example sshd.socket. There are however a few short forms when specifying the unit in the following systemctl commands:

If you do not specify the suffix, systemctl will assume .service. For example, netctl and netctl.service are equivalent.
Mount points will automatically be translated into the appropriate .mount unit. For example, specifying /home is equivalent to home.mount.
Similar to mount points, devices are automatically translated into the appropriate .device unit, therefore specifying /dev/sda2 is equivalent to dev-sda2.device.

See systemd.unit(5) for details.
Note: Some unit names contain an @ sign (e.g. name@string.service): this means that they are instances of a template unit, whose actual file name does not contain the string part (e.g. name@.service). string is called the instance identifier, and is similar to an argument that is passed to the template unit when called with the systemctl command: in the unit file it will substitute the %i specifier.

To be more accurate, before trying to instantiate the name@.suffix template unit, systemd will actually look for a unit with the exact name@string.suffix file name, although by convention such a "clash" happens rarely, i.e. most unit files containing an @ sign are meant to be templates. Also, if a template unit is called without an instance identifier, it will just fail, since the %i specifier cannot be substituted.

Tip: Most of the following commands also work if multiple units are specified, see systemctl(1) for more information.
Tip: The --now switch can be used in conjunction with enable, disable, and mask to respectively start, stop, or mask immediately the unit rather than after the next boot.

Start a unit immediately:

# systemctl start unit

Stop a unit immediately:

# systemctl stop unit

Restart a unit:

# systemctl restart unit

Ask a unit to reload its configuration:

# systemctl reload unit

Show the status of a unit, including whether it is running or not:

$ systemctl status unit

Check whether a unit is already enabled or not:

$ systemctl is-enabled unit

Enable a unit to be started on bootup:

# systemctl enable unit

Enable a unit to be started on bootup and Start immediately:

# systemctl enable --now unit

Disable a unit to not start during bootup:

# systemctl disable unit

Mask a unit to make it impossible to start it:

# systemctl mask unit

Unmask a unit:

# systemctl unmask unit

Show the manual page associated with a unit (this has to be supported by the unit file):

$ systemctl help unit

Reload systemd, scanning for new or changed units:

# systemctl daemon-reload

Power management

polkit is necessary for power management as an unprivileged user. If you are in a local systemd-logind user session and no other session is active, the following commands will work without root privileges. If not (for example, because another user is logged into a tty), systemd will automatically ask you for the root password.

Shut down and reboot the system:

$ systemctl reboot

Shut down and power-off the system:

$ systemctl poweroff

Suspend the system:

$ systemctl suspend

Put the system into hibernation:

$ systemctl hibernate

Put the system into hybrid-sleep state (or suspend-to-both):

$ systemctl hybrid-sleep

I found the above information when looking at how to set up vnstat on systems which did not do so automatically like Mint.

Setting up vnstat on systems such as Arch Linux (WORK IN PROGRESS and untested)

vnStat is a lightweight (command line) network traffic monitor. It monitors selectable interfaces and stores network traffic logs in a database for later analysis.

Install the vnstat package

Distribution dependent


Start/Enable the vnstat.service daemon. For systemd systems the above indicates that one does

$ systemctl enable --now vnstat.service

Pick a preferred network interface and edit the Interface variable in the /etc/vnstat.conf accordingly. To list all interfaces available to vnstat, use vnstat --iflist.

To start monitoring a particular interface you must initialize a database first. Each interface needs its own database. The command to initialize one for the eth0 interface is:

# vnstat -u -i eth0


Query the network traffic:

# vnstat -q

Viewing live network traffic usage:

# vnstat -l

To find more options, use:

# vnstat --help


or use these instructions based on https://www.howtoforge.com/tutorial/vnstat-network-monitoring-ubuntu/

Monitoring Network Traffic or Bandwidth Usage is an important task in an organisational structure or even for developers. It is sometimes required to monitor traffic on various systems which share the internet bandwidth. There might be situations where network statistics are required for decision making in the networking areas or use the logged information on the network traffic for analysis tasks.

vnStat and vnStati are command line utilities which are very useful tools that help a user to monitor, log and view network statistics over various time periods. It provides summaries on various network interfaces, may it be wired like "eth0" or wireless like "wlan0". It allows the user to view hourly, daily, monthly statistics in the form of a detailed table or a command line statistical view. To store the results in a graphical format, we can use the vnStati to obtain and provide visual display of statistics in the form of graphs and store them in the form of images for later use.

This deals with the procedure to install and use vnStat and vnStati. It also details the options and usage methods required to view and store the type of information you want. vnStat does most of the logging and updating , where as vnStati is used to provide a graphical display of the statistics.

Installing vnStat and vnStati

System dependent

vnStat setup and running

Once the installation is complete, vnStat has to be setup or configured as it does not start on its own. vnStat has to be told explicitly which interfaces have to be monitored. We then start the vnStat daemon called "vnstatd", which starts vnStat and monitors for as long as it is not stopped explicitly.

The first thing to do here is tell vnStat the network interfaces to monitor. Here we look at a wired interface "eth0" and a wireless interface "wlan0". Type the following commands in the terminal.

vnstat -u -i eth0

This above command activates monitoring that interface. The first time you run this command on any interface you will get an error saying 'Unable to read database "/var/lib/vnstat/eth0" '. Ignore this as you will also see it says it has set up a suitable database for the future!

Similar to above we also set the wireless network interface using the command:

vnstat -u -i wlan0

To view all the network interfaces available in your system, use the command:

vnstat --islist

Once you know all the interfaces that you want to be monitored, use the command above with that interface name to monitor the traffic on it.

Once the above steps are complete, we can now start the vnStat daemon. To do this, we use the following command:



Before You Leave

I would be very pleased if visitors could spare a little time to give us some feedback - it is the only way we know who has visited the site, if it is useful and how we should develop it's content and the techniques used. I would be delighted if you could send comments or just let me know you have visited by sending a quick Message.

Home Pauline Howto Articles Uniquely NZ Small Firms Search
Copyright © Peter and Pauline Curtis
Content revised: 4th July, 2017