Last Updated: November 21, 2016
·
3.886K
· dmichaelavila

Install +100 core CLI utilities with 1 command

GNU coreutils contains over 100 programs we all use every day. This includes cat, cp, mkdir, chown, wc, who, whoami, tail, ln, kill, mv, chmod, cut, dd, echo, pwd, etc. You can install all of them (on OS X) with the following command:

Full disclosure: you may need to run a brew update first (making this 2 commands)

$ brew install coreutils
...
coreutils: stable 8.21
http://www.gnu.org/software/coreutils
Conflicts with: ganglia, idutils
/usr/local/Cellar/coreutils/8.21 (210 files, 9.2M) *
  Built from source
From: https://github.com/mxcl/homebrew/commits/master/Library/Formula/coreutils.rb
 ==> Dependencies
Build: xz ✔
==> Caveats
All commands have been installed with the prefix 'g'.

If you really need to use these commands with their normal names, you
can add a "gnubin" directory to your PATH from your bashrc like:

    PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"

Additionally, you can access their man pages with normal names if you add
the "gnuman" directory to your MANPATH from your bashrc as well:

    MANPATH="/usr/local/opt/coreutils/libexec/gnuman:$MANPATH"

The info that is printed out at the end says that all of the commands have a 'g' prepended to their name, but you can add non-g versions of the commands by modifying your PATH. When this is complete you'll have all of the following commands available:

g[ gbase64 gbasename gcat gchcon gchgrp gchmod gchown gchroot gcksum gcomm gcp gcsplit gcut gdate gdd gdf gdir gdircolors gdirname gdu gecho genv gexpand gexpr gfactor gfalse gfmt gfold ggroups ghead ghostid gid ginstall gjoin gkill glink gln glogname gls gmd5sum gmkdir gmkfifo gmknod gmktemp gmv gnice gnl gnohup gnproc gnumfmt god gpaste gpathchk gpinky gpr gprintenv gprintf gptx gpwd greadlink grealpath grm grmdir gruncon gseq gsha1sum gsha224sum gsha256sum gsha384sum gsha512sum gshred gshuf gsleep gsort gsplit gstat gstty gsum gsync gtac gtail gtee gtest gtimeout gtouch gtr gtrue gtruncate gtsort gtty guname gunexpand guniq gunlink guptime gusers gvdir gwc gwho gwhoami gyes

If you change your PATH like the info mentions you'll have the following commands available:

[ base64 basename cat chcon chgrp chmod chown chroot cksum comm cp csplit cut date dd df dir dircolors dirname du echo env expand expr factor false fmt fold groups head hostid id install join kill link ln logname ls md5sum mkdir mkfifo mknod mktemp mv nice nl nohup nproc numfmt od paste pathchk pinky pr printenv printf ptx pwd readlink realpath rm rmdir runcon seq sha1sum sha224sum sha256sum sha384sum sha512sum shred shuf sleep sort split stat stty sum sync tac tail tee test timeout touch tr true truncate tsort tty uname unexpand uniq unlink uptime users vdir wc who ehoami yes

A number of commits have been made over the last few months according to the git log. I see commits for cp, rm, and ls ... how often do you use these commands?

1 Response
Add your response

@SaberUK The point is that installing and updating coreutils keeps you up to date.

over 1 year ago ·