Skip to content

Repository files navigation

coreutils in V

This repository contains programs equivalent to GNU coreutils, written in the V language.

Goal

Complete set of coreutils, written as closely as possible to the POSIX spec, with as many GNU extensions as feasible.

We are looking for solid, working implementations of the commands, not 100% 1-to-1 parity, especially not quirks and unintended side-effects.

The reference implementation is GNU coreutils 8.32.

Layout

Each command has it's own separate subdirectory under src, in case the implementor wishes to create multiple .v files to implement a command, or add a README.md specifically for that command.

Developing

Please use the common module for command line/help handling. This will make the command input/output consistent across the tools.

Building

Running make or v run build.vsh will build all the programs in bin/. Use JOBS=N make or v run build.vsh --cpus=N to compile in parallel.

Note: support for access to user account info (via utmp) is limited to POSIX-like platforms. And, so, for Windows, utilities requiring utmp support (uptime, users, who, whoami) are currently skipped during the default build process.

Contributing

Contributions are welcome!

Please only contribute versions of the original utilities written in V. Contributions written in other languages will likely be rejected.

When your contribution is finalized, don't forget to update the completed count below and mark it as done in this README.md. Thanks!

NOTE: When testing on Windows, comparison tests are currently run against uutils/coreutils, a Rust re-implementation of GNU coreutils. They are not 100% compatiable. If you encounter different behaviors, compare against the true GNU coreutils version on the Linux-based tests first.

Completed (76/109) - 69% done!

Done Cmd Descripton Windows
✓ [ Alternate form of test ✓
✓ arch Print machine hardware name
✓ b2sum Print or check BLAKE2 digests ✓
✓ base32 Transform data into printable data ✓
✓ base64 Transform data into printable data ✓
✓ basename Strip directory and suffix from a file name ✓
✓ basenc Transform data into printable data ✓
✓ cat Concatenate and write files ✓
chcon Change SELinux context of file ✓
chgrp Change group ownership
chmod Change access permissions
chown Change file owner and group
chroot Run a command with a different root directory
✓ cksum Print CRC checksum and byte counts ✓
✓ comm Compare two sorted files line by line ✓
coreutils Multi-call program ✓
✓ cp Copy files and directories ✓
csplit Split a file into context-determined pieces ✓
✓ cut Print selected parts of lines ✓
date Print or set system date and time ✓
dd Convert and copy a file ✓
df Report file system disk space usage
dir Briefly list directory contents
dircolors Color setup for ls ✓
✓ dirname Strip last file name component ✓
du Estimate file space usage ✓
✓ echo Print a line of text ✓
✓ env Run a command in a modified environment ✓
✓ expand Convert tabs to spaces ✓
✓ expr Evaluate expressions ✓
✓ factor Print prime factors ✓
✓ false Do nothing, unsuccessfully ✓
✓ fmt Reformat paragraph text ✓
✓ fold Wrap input lines to fit in specified width ✓
✓ groups Print group names a user is in
✓ head Output the first part of files ✓
✓ hostid Print numeric host identifier
✓ hostname Print or set system name
✓ id Print user identity
install Copy files and set attributes
join Join lines on a common field ✓
kill Send a signal to processes ✓
✓ link Make a hard link via the link syscall ✓
✓ ln Make links between files ✓
✓ logname Print current login name ✓
✓ ls List directory contents
✓ md5sum Print or check MD5 digests ✓
✓ mkdir Make directories ✓
✓ mkfifo Make FIFOs (named pipes) ✓
mknod Make block or character special files ✓
✓ mktemp Create temporary file or directory ✓
✓ mv Move (rename) files ✓
nice Run a command with modified niceness
✓ nl Number lines and write files ✓
✓ nohup Run a command immune to hangups ✓
✓ nproc Print the number of available processors ✓
✓ numfmt Reformat numbers ✓
od Write files in octal or other formats ✓
✓ paste Merge lines of files ✓
pathchk Check file name validity and portability ✓
pinky Lightweight finger
pr Paginate or columnate files for printing ✓
✓ printenv Print all or some environment variables ✓
✓ printf Format and print data ✓
ptx Produce permuted indexes ✓
✓ pwd Print working directory ✓
✓ readlink Print value of a symlink or canonical file name ✓
realpath Print the resolved file name ✓
✓ rm Remove files or directories ✓
✓ rmdir Remove empty directories ✓
runcon Run a command in specified SELinux context ✓
✓ seq Print numeric sequences ✓
✓ sha1sum Print or check SHA-1 digests ✓
✓ sha224sum Print or check SHA-2 224 bit digests ✓
✓ sha256sum Print or check SHA-2 256 bit digests ✓
✓ sha384sum Print or check SHA-2 384 bit digests ✓
✓ sha512sum Print or check SHA-2 512 bit digests ✓
✓ shred Remove files more securely ✓
✓ shuf Shuffling text ✓
✓ sleep Delay for a specified time ✓
✓ sort Sort text files ✓
split Split a file into pieces ✓
✓ stat Report file or file system status
stdbuf Run a command with modified I/O stream buffering
stty Print or change terminal characteristics
✓ sum Print checksum and block counts ✓
✓ sync Synchronize cached writes to persistent storage ✓
✓ tac Concatenate and write files in reverse ✓
✓ tail Output the last part of files ✓
tee Redirect output to multiple files or processes ✓
✓ test Check file types and compare values ✓
✓ timeout Run a command with a time limit
✓ touch Change file timestamps ✓
tr Translate, squeeze, and/or delete characters ✓
✓ true Do nothing, successfully ✓
✓ truncate Shrink or extend the size of a file ✓
tsort Topological sort ✓
✓ tty Print file name of terminal on standard input
✓ uname Print system information ✓
✓ unexpand Convert spaces to tabs ✓
✓ uniq Uniquify files ✓
✓ unlink Remove files via the unlink syscall ✓
✓ uptime Print system uptime and load
✓ users Print login names of users currently logged in
vdir Verbosely list directory contents
✓ wc Print newline, word, and byte counts ✓
who Print who is currently logged in
✓ whoami Print effective user ID ✓
✓ yes Print a string until interrupted ✓

Windows ✓ if the utility exists in the Windows version of GNU coreutils.

About

This repository contains programs equivalent to GNU coreutils, written in the V language.

Resources

Stars

200 stars

Watchers

18 watching

Forks

Releases

Packages

Used by

Contributors

Languages