Command Line Interface#
Barecat provides a unified command-line interface through the barecat command
with various subcommands. This document provides a complete reference for all
available commands and their options.
Synopsis#
barecat <command> [options] [arguments]
Commands#
barecat create#
Create a new barecat archive.
Synopsis:
barecat create [options] ARCHIVE [PATHS...]
Description:
Creates a new archive from specified files and directories. If the archive
already exists, the command fails unless -f is specified.
Options:
ARCHIVEPath to the barecat archive to create (without suffix).
PATHSFiles or directories to add. Directories are added recursively.
-C, --directory DIRChange to DIR before adding files (like tar).
-T, --files-from FILERead paths from FILE (one per line). Use
-to read from stdin.-0, --nullPaths are null-separated (for use with
find -print0).--exclude PATTERNExclude files matching PATTERN. Can be repeated.
-i, --include PATTERNOnly include files matching PATTERN. Can be repeated.
-j, --workers NNumber of worker threads for parallel processing.
-f, --forceOverwrite existing archive.
-s, --shard-size-limit SIZEMaximum shard size (e.g.,
1G,500M). Default: unlimited.--physical-orderAdd files in physical disk order (optimization for HDDs).
Examples:
# Create archive from directory
barecat create myarchive.barecat /path/to/data/
# Create from find output
find /data -name '*.jpg' -print0 | barecat create -T - -0 myarchive.barecat
# Create with shard limit
barecat create -s 10G myarchive.barecat /path/to/data/
barecat add#
Add files to an existing archive.
Synopsis:
barecat add [options] ARCHIVE [PATHS...]
Description:
Adds files to an existing archive. By default, fails if the archive does not
exist. Use -c to create it if missing.
Options:
Same as barecat create, plus:
-c, --createCreate the archive if it does not exist.
Examples:
# Add more files to existing archive
barecat add myarchive.barecat /more/data/
# Add with create-if-missing
barecat add -c myarchive.barecat /data/
barecat extract#
Extract files from an archive.
Synopsis:
barecat extract [options] ARCHIVE [PATHS...]
Description:
Extracts files from the archive. If PATHS are specified, only those paths are extracted. Otherwise, the entire archive is extracted.
Options:
-C, --directory DIRExtract to DIR (default: current directory).
Examples:
# Extract entire archive
barecat extract myarchive.barecat -C /output/
# Extract specific paths
barecat extract myarchive.barecat subdir/file.txt
barecat list#
List archive contents.
Synopsis:
barecat list [options] ARCHIVE [PATHS...]
Aliases: ls, l, t
Options:
-l, --longLong listing format with file sizes.
-R, --recursiveList directories recursively.
Examples:
barecat list myarchive.barecat
barecat ls -l myarchive.barecat subdir/
barecat list -lR myarchive.barecat
barecat find#
Search for files in an archive (like /usr/bin/find).
Synopsis:
barecat find [options] ARCHIVE [PATH]
Description:
Searches for files and directories within the archive, supporting name, path, type, and size filters. By default searches from the archive root.
Options:
PATHStarting path within the archive (default: root).
-name PATTERNMatch basename against a glob pattern.
-path PATTERNMatch full path against a glob pattern. Also available as
-wholename.-type f|dRestrict to file type:
ffor files,dfor directories.-size [+-]N[kMG]Size filter:
+N(larger than N),-N(smaller than N),N(exactly N).-maxdepth NMaximum depth to descend.
-print0Print paths separated by null character (for use with
xargs -0).
Examples:
# Find all JPEG files
barecat find myarchive.barecat -name '*.jpg'
# Find large files
barecat find myarchive.barecat -size +100M -type f
# Find directories under a path
barecat find myarchive.barecat subdir/ -type d
# Pipe to xargs
barecat find myarchive.barecat -name '*.tmp' -print0 | xargs -0 echo
barecat cat#
Print file contents to standard output.
Synopsis:
barecat cat ARCHIVE PATH
Examples:
barecat cat myarchive.barecat path/to/file.txt > output.txt
barecat shell#
Interactive shell for exploring archives.
Synopsis:
barecat shell [options] ARCHIVE
Description:
Opens an interactive shell with commands like ls, cd, cat, pwd.
Options:
-c, --cmd COMMANDExecute COMMAND and exit.
-w, --writeOpen in write mode (allows modifications).
Examples:
barecat shell myarchive.barecat
barecat shell -c "ls subdir/" myarchive.barecat
barecat browse#
Ranger-like file browser for archives.
Synopsis:
barecat browse ARCHIVE
Description:
Opens a curses-based file browser similar to ranger.
barecat du#
Show disk usage (like du).
Synopsis:
barecat du [options] ARCHIVE [PATH]
Description:
Prints disk usage by directory, similar to the Unix du command.
Options:
-a, --allShow all files, not just directories.
-s, --summarizeShow only total for each argument.
-H, --human-readablePrint sizes in human-readable format.
-d, --max-depth NMaximum depth to show.
barecat tree#
Display a directory tree of the archive contents.
Synopsis:
barecat tree [options] ARCHIVE [PATH]
Description:
Prints a tree-style listing of the archive directory structure, similar to the
Unix tree command.
Options:
PATHStarting path within the archive (default: root).
-L, --level NLimit display depth to N levels.
-d, --dirs-onlyList directories only, omitting files.
Examples:
# Show full tree
barecat tree myarchive.barecat
# Show tree starting from subdirectory, 2 levels deep
barecat tree -L 2 myarchive.barecat subdir/
# Show only directory structure
barecat tree -d myarchive.barecat
barecat ncdu#
Interactive disk usage viewer (ncdu-like).
Synopsis:
barecat ncdu ARCHIVE
Description:
Opens an ncdu-like curses interface showing disk usage by directory.
barecat verify#
Verify archive integrity.
Synopsis:
barecat verify [options] ARCHIVE
Description:
Verifies CRC32C checksums and index integrity.
Options:
--quickQuick verification (index integrity + last file CRC check only).
Exit Status:
Returns 0 on success, non-zero if verification fails.
barecat defrag#
Defragment archive.
Synopsis:
barecat defrag [options] ARCHIVE
Description:
Removes gaps left by deleted files, compacting the archive.
Options:
--quickUse best-fit algorithm for faster but less thorough defragmentation.
barecat reshard#
Reshard archive with a new shard size.
Synopsis:
barecat reshard -s SIZE ARCHIVE
Description:
Reorganizes the archive with a new shard size limit.
Options:
-s, --shard-size-limit SIZENew shard size limit (required).
Examples:
# Consolidate into larger shards
barecat reshard -s 50G myarchive.barecat
barecat merge#
Merge multiple archives into one.
Synopsis:
barecat merge [options] -o OUTPUT ARCHIVES...
Description:
Merges multiple archives (barecat, tar, or zip) into a single barecat archive.
Options:
-o, --output OUTPUTOutput archive path (required).
-s, --shard-size-limit SIZEShard size limit for output.
-f, --forceOverwrite output if it exists.
-a, --appendAppend to output if it exists.
--symlinkCreate symlinks to original shards instead of copying (barecat inputs only).
--ignore-duplicatesSkip files that already exist in output.
Examples:
# Merge barecat archives
barecat merge -o combined.barecat arch1.barecat arch2.barecat
# Merge mixed archive types
barecat merge -o combined.barecat data.tar.gz more.zip existing.barecat
barecat subset#
Create a new archive containing a subset of files from an existing archive.
Synopsis:
barecat subset [options] ARCHIVE -o OUTPUT
Description:
Creates a filtered copy of an archive. Files can be selected using glob patterns or rsync-style include/exclude rules.
Options:
-o, --output OUTPUTOutput archive path (required).
-s, --shard-size-limit SIZEShard size limit (e.g.,
1G,500M).-f, --forceOverwrite output if it already exists.
--pattern GLOBOnly include files matching glob pattern. Incompatible with
-i/-x.-i, --include PATTERNInclude files matching glob pattern (rsync-style, repeatable).
-x, --exclude PATTERNExclude files matching glob pattern (rsync-style, repeatable).
Examples:
# Extract only JPEG files into a new archive
barecat subset myarchive.barecat -o images.barecat --pattern '**/*.jpg'
# Include/exclude with rsync-style rules
barecat subset myarchive.barecat -o filtered.barecat -i '**/*.png' -x '**/thumbs/**'
# Overwrite existing output
barecat subset myarchive.barecat -o subset.barecat -f --pattern 'train/**'
barecat rsync#
rsync-like sync between local filesystem and barecat archives.
Synopsis:
barecat rsync [options] SRC... DEST
Description:
Synchronizes files between the local filesystem and barecat archives. Uses
archive.barecat:path/ syntax to specify paths inside an archive. The
source or destination (or both) can be archive paths.
Options:
-n, --dry-runShow what would be done without making changes.
-v, --verboseVerbose output.
--progressShow progress.
--deleteDelete extraneous files from the destination.
-c, --checksumCompare files by checksum instead of size/mtime.
-u, --updateSkip files that are newer on the destination.
--include PATInclude pattern (repeatable).
--exclude PATExclude pattern (repeatable).
Examples:
# Copy local directory into archive
barecat rsync /data/images/ myarchive.barecat:images/
# Extract from archive to local directory
barecat rsync myarchive.barecat:images/ /data/images/
# Sync with delete (remove files in dest not in source)
barecat rsync --delete /data/ myarchive.barecat:data/
# Dry run to preview changes
barecat rsync -nv /data/ myarchive.barecat:data/
barecat convert#
Convert between barecat and tar/zip formats.
Synopsis:
barecat convert [options] INPUT OUTPUT
Description:
Converts between barecat and traditional archive formats. Direction is auto-detected based on file extensions.
Options:
-s, --shard-size-limit SIZEShard size limit (tar/zip to barecat only).
-f, --forceOverwrite existing output.
--stdinRead input from stdin (INPUT specifies format:
tar,tar.gz, etc.).--stdoutWrite output to stdout (OUTPUT specifies format:
tar,tar.gz, etc.).--root-dir NAMEWrap all files in a root directory (barecat to tar only).
--wrapZero-copy mode: create barecat index over existing uncompressed tar/zip (symlinks to original file).
Examples:
# Convert tar.gz to barecat
barecat convert data.tar.gz data.barecat
# Convert barecat to tar
barecat convert data.barecat data.tar
# Stream conversion
cat data.tar.gz | barecat convert --stdin tar.gz output.barecat
barecat convert --stdout data.barecat tar.gz > data.tar.gz
# Zero-copy wrap (uncompressed archives only)
barecat convert --wrap data.tar data.barecat
barecat to-ncdu-json#
Export archive structure as ncdu JSON.
Synopsis:
barecat to-ncdu-json ARCHIVE
Description:
Outputs the archive structure in ncdu’s JSON format for use with ncdu -f.
Examples:
barecat to-ncdu-json myarchive.barecat > archive.json
ncdu -f archive.json
barecat index-to-csv#
Export index as CSV.
Synopsis:
barecat index-to-csv ARCHIVE
Description:
Dumps the file index as CSV to standard output.
barecat upgrade#
Upgrade index to new schema version.
Synopsis:
barecat upgrade [options] ARCHIVE
Options:
-j, --workers NNumber of worker threads.
barecat completion-script#
Print shell completion script path.
Synopsis:
barecat completion-script bash|zsh
Description:
Prints the path to the shell completion script. Source this in your shell configuration.
Examples:
# Bash: add to ~/.bashrc
source $(barecat completion-script bash)
# Zsh: add to ~/.zshrc
source $(barecat completion-script zsh)
Environment Variables#
Barecat does not currently use any environment variables.
Exit Status#
0Success.
1General error (file not found, invalid arguments, etc.).
Non-zeroVerification failures, integrity errors.
See Also#
Architecture - Internal architecture overview
ncdu - NCurses Disk Usage