btt - Linux


Overview

btt (build to tar) is a versatile command-line tool for creating compressed tarball archives of source code and dependencies, making it particularly useful for distributing software projects.

Syntax

btt [options] <project_directory> [<tarball_name>]

Options/Flags

  • -c, –clean: Delete any previously generated tarball before creating a new one.
  • -f, –force: Overwrite an existing tarball without prompting.
  • -h, –help: Display help and usage information.
  • -v, –verbose: Enable verbose output, showing the files being included in the tarball.
  • -x, –exclude: Exclude specific files or patterns from the tarball. Supports both single files (--exclude=file.txt) and patterns (--exclude=*.log).
  • –ignore-dependencies: Skip installation of dependencies, useful for packaging already-built projects.
  • –no-clean: Preserve any existing tarball, even when --clean is specified.
  • –skip-git: Ignore Git repositories within the project directory.
  • –skip-npm: Ignore Node.js modules within the project directory.

Examples

Simple Tarball Creation:

btt my_project

Tarball Creation with Custom Name:

btt my_project my_project.tar.gz

Tarball Creation with Exclusions:

btt my_project --exclude=node_modules --exclude=logs

Common Issues

  • Missing Dependencies: Ensure that all required dependencies are installed before running btt.
  • Tarball Already Exists: Use --force to overwrite an existing tarball, or delete it manually.
  • File/Directory Permissions: Check file and directory permissions to ensure that btt has write access.

Integration

btt seamlessly integrates with other Linux commands:

  • Automate tarball creation in scripts:

    #!/bin/sh
    btt my_project && rsync my_project.tar.gz remote_server:/path/to/destination/
    
  • Create tarballs for backup purposes:

    find /path/to/important_data | tar -cvf /backup.tar -T -
    

Related Commands

  • tar: General-purpose tar archiving tool.
  • make: Build automation tool.
  • docker: Containerization platform.