Skip to content

fstab50/nlines

Repository files navigation


nlines


Summary

Count the number of lines of text in a code projects (or other text artifacts) in Linux operating system environments. Ideal for Linux development environments which lack higher order language support such as Python, Nodejs, etc.

Version: 1.1.2


Contents

--

back to the top


Dependencies

nlines requires bash v4.4+

--

back to the top


Supported Linux Distributions

  • Ubuntu 16.04, Ubuntu 18.04
  • Linux Mint 18, 19
  • Debian variants of Ubuntu / Linux Mint distributions above
  • Redhat 7+, CentOS 7+

--

back to the top


Installation


Ubuntu, Linux Mint, Debian variants

The easiest way to install nlines is via the Debian-tools repository:

  1. Download the public key:

    $ wget -qO - http://awscloud.center/keys/public.key | sudo apt-key add -
    
  2. Install the repository:

    $ sudo echo "deb [arch=amd64] http://deb.awscloud.center <distribution> main" > \
                 /etc/apt/sources.list.d/debian-tools.list
    

    Where: <distribution> is one of the following:

    • trusty: Ubuntu 14.04, Ubuntu 14.04 based Linux distributions
    • xenial: Ubuntu 16.04, 16.04 based Linux distributions
    • bionic: Ubuntu 18.04, 18.04 based Linux distributions (Linux Mint 19, etc)
    • cosmic: Ubuntu 18.10, 18.10 based Linux distributions
  3. Verify debian-tools repository installation

    $  grep ^ /etc/apt/sources.list /etc/apt/sources.list.d/*
    

    repository-contents

  4. Update and install the package:

    $ sudo apt update  &&  sudo apt install nlines
    
  5. Verify Installation. To verify a Debian (.deb) package installation:

    $ apt show nlines
    

    apt

--

back to the top


Redhat, CentOS, Fedora, Amazon Linux

The easiest way to install nlines on redhat-based Linux distributions is via the developer-tools package repository:

  1. Download and install the repo definition file

    $ sudo yum install wget
    
    $ wget http://awscloud.center/rpm/developer-tools.repo
    
    $ sudo mv developer-tools.repo /etc/yum.repos.d/  &&  sudo chown 0:0 developer-tools.repo
    
  2. Update local repository cache

    $ sudo yum update -y
    
  3. Install nlines os package

    $ sudo yum install -y nlines
    

    rpm-install1

  4. Verify Installation

    $ yum info nlines
    

    rpm-install2

back to the top


Help

To display the help menu:

    $ nlines --help

help

back to the top


Configuration

Run time options for nlines can be configured by entering the configure menu:

    $ nlines --configure

help

  • Option A: To add a new file type to exclude from line counting, select option "a":

help

help

  • Option B: To remove a file type from the exclusion list so that files of this type are included in line counts, select option "B":

help

  • Option C: To change the threshold at which file objects are highlighted to indicate large line count, select option "c":

help

back to the top


Exclusions

nlines persists a list of excluded file types on the local filesystem. To see this list, type the following:

    $ nlines --exclusions

help

back to the top


Screenshots

Counting lines in large repository with long paths.

    $ nlines  --sum  git/AWSAMPLES/aws-serverless-workshops/

repo1-1

back to the top


Author & Copyright

All works contained herein copyrighted via below author unless work is explicitly noted by an alternate author.

  • Copyright Blake Huber, All Rights Reserved.

back to the top


License

back to the top


Disclaimer

Code is provided "as is". No liability is assumed by either the code's originating author nor this repo's owner for their use at AWS or any other facility. Furthermore, running function code at AWS may incur monetary charges; in some cases, charges may be substantial. Charges are the sole responsibility of the account holder executing code obtained from this library.

Additional terms may be found in the complete license agreement.

back to the top