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
--
nlines requires bash v4.4+
--
- Ubuntu 16.04, Ubuntu 18.04
- Linux Mint 18, 19
- Debian variants of Ubuntu / Linux Mint distributions above
- Redhat 7+, CentOS 7+
--
The easiest way to install nlines is via the Debian-tools repository:
-
Download the public key:
$ wget -qO - http://awscloud.center/keys/public.key | sudo apt-key add -
-
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 distributionsxenial
: Ubuntu 16.04, 16.04 based Linux distributionsbionic
: Ubuntu 18.04, 18.04 based Linux distributions (Linux Mint 19, etc)cosmic
: Ubuntu 18.10, 18.10 based Linux distributions
-
Verify debian-tools repository installation
$ grep ^ /etc/apt/sources.list /etc/apt/sources.list.d/*
-
Update and install the package:
$ sudo apt update && sudo apt install nlines
-
Verify Installation. To verify a Debian (.deb) package installation:
$ apt show nlines
--
The easiest way to install nlines on redhat-based Linux distributions is via the developer-tools package repository:
-
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
-
Update local repository cache
$ sudo yum update -y
-
Install nlines os package
$ sudo yum install -y nlines
-
Verify Installation
$ yum info nlines
To display the help menu:
$ nlines --help
Run time options for nlines can be configured by entering the configure menu:
$ nlines --configure
- Option A: To add a new file type to exclude from line counting, select option "a":
- 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":
- Option C: To change the threshold at which file objects are highlighted to indicate large line count, select option "c":
nlines persists a list of excluded file types on the local filesystem. To see this list, type the following:
$ nlines --exclusions
Counting lines in large repository with long paths.
$ nlines --sum git/AWSAMPLES/aws-serverless-workshops/
All works contained herein copyrighted via below author unless work is explicitly noted by an alternate author.
- Copyright Blake Huber, All Rights Reserved.
- Software contained in this repo is licensed under the license agreement.
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.