From 096e5622d35f34e5c435f2a1dec19e9d8e409cf7 Mon Sep 17 00:00:00 2001 From: jbranchaud Date: Tue, 14 Jul 2026 19:58:14 -0500 Subject: [PATCH] Add Access CoreUtils That Conflict With Unix Utilities as a Mac TIL --- README.md | 3 +- ...utils-that-conflict-with-unix-utilities.md | 42 +++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 mac/access-coreutils-that-conflict-with-unix-utilities.md diff --git a/README.md b/README.md index 6854b00..3b3b11c 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ working across different projects via [VisualMode](https://www.visualmode.dev/). For a steady stream of TILs, [sign up for my newsletter](https://visualmode.kit.com/newsletter). -_1820 TILs and counting..._ +_1821 TILs and counting..._ See some of the other learning resources I work on: @@ -735,6 +735,7 @@ If you've learned something here, support my efforts writing daily TILs by ### Mac - [Access All Screen And Video Capture Options](mac/access-all-screen-and-video-capture-options.md) +- [Access CoreUtils That Conflict With Unix Utilities](mac/access-coreutils-that-conflict-with-unix-utilities.md) - [Access System Information On OS X](mac/access-system-information-on-osx.md) - [Access Unsupported Screen Resolutions With RDM](mac/access-unsupported-screen-resolutions-with-rdm.md) - [Add A Bunch Of CLI Utilities With coreutils](mac/add-a-bunch-of-cli-utilities-with-coreutils.md) diff --git a/mac/access-coreutils-that-conflict-with-unix-utilities.md b/mac/access-coreutils-that-conflict-with-unix-utilities.md new file mode 100644 index 0000000..edc5455 --- /dev/null +++ b/mac/access-coreutils-that-conflict-with-unix-utilities.md @@ -0,0 +1,42 @@ +# Access CoreUtils That Conflict With Unix Utilities + +In [another post about GNU CoreUtils](add-a-bunch-of-cli-utilities-with-coreutils.md) I explained how to +install and use some of the provided utilities. The utilities I referenced were +`seq` and `realpath` which are novel on MacOS. There are other CoreUtils that +would conflict with existing system utilities. To avoid the conflicts, those +utilities are installed with `g` prefix. + +A good example of this is `mv` and `gmv`. These are both utilities for moving +files and largely behave the same. They are a few subtle differences though. + +Here is the manpage for the built-in `mv` utility: + +``` +NAME + mv – move files + +SYNOPSIS + mv [-f | -i | -n] [-hv] source target + mv [-f | -i | -n] [-v] source ... directory +``` + +And here is the manpage for `gmv`: + +``` +NAME + mv - move (rename) files + +SYNOPSIS + mv [OPTION]... [-T] SOURCE DEST + mv [OPTION]... SOURCE... DIRECTORY + mv [OPTION]... -t DIRECTORY SOURCE... +``` + +There are some different forms and flags available. `gmv` for instance supports +a `-t` flag which specifies the _target_ directory so that all other listed +paths are treated as sources of the move. This makes `gmv` easier to use with +`xargs`, for instance. + +Look through `fd '^g' /opt/homebrew/bin/` and you'll notice a bunch of them like +`gls`, `gln`, `ghead`, `gwhoami`, `gyes`, etc. You can also look through all of +them in the [`coreutils.json` homebrew formula](https://formulae.brew.sh/api/formula/coreutils.json).