{"id":13567489,"url":"https://github.com/mklement0/typex","last_synced_at":"2025-05-07T20:43:10.244Z","repository":{"id":26983803,"uuid":"30447562","full_name":"mklement0/typex","owner":"mklement0","description":"Unix CLI that provides salient information about installed commands and programs, combining elements from standard Unix utilities type, which, and file.","archived":false,"fork":false,"pushed_at":"2022-12-27T13:54:00.000Z","size":98,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-07T20:43:03.649Z","etag":null,"topics":["cli","command","diagnostics","discovery","unix-cli"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mklement0.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-02-07T06:27:22.000Z","updated_at":"2024-12-18T13:53:46.000Z","dependencies_parsed_at":"2022-09-14T00:52:32.471Z","dependency_job_id":null,"html_url":"https://github.com/mklement0/typex","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mklement0%2Ftypex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mklement0%2Ftypex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mklement0%2Ftypex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mklement0%2Ftypex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mklement0","download_url":"https://codeload.github.com/mklement0/typex/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252954140,"owners_count":21830894,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","command","diagnostics","discovery","unix-cli"],"created_at":"2024-08-01T13:02:32.791Z","updated_at":"2025-05-07T20:43:10.226Z","avatar_url":"https://github.com/mklement0.png","language":"Shell","funding_links":[],"categories":["Shell"],"sub_categories":[],"readme":"[![npm version](https://img.shields.io/npm/v/typex.svg)](https://npmjs.com/package/typex) [![license](https://img.shields.io/npm/l/typex.svg)](https://github.com/mklement0/typex/blob/master/LICENSE.md)\n\n\u003c!-- START doctoc generated TOC please keep comment here to allow auto update --\u003e\n\u003c!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --\u003e\n\n**Contents**\n\n- [typex \u0026mdash; introduction](#typex-\u0026mdash-introduction)\n- [Examples](#examples)\n- [Installation](#installation)\n  - [Installation from the npm registry](#installation-from-the-npm-registry)\n  - [Manual installation](#manual-installation)\n- [Usage](#usage)\n- [License](#license)\n  - [Acknowledgements](#acknowledgements)\n  - [npm dependencies](#npm-dependencies)\n- [Changelog](#changelog)\n\n\u003c!-- END doctoc generated TOC please keep comment here to allow auto update --\u003e\n\n# typex \u0026mdash; introduction\n\n`typex` is an enhanced version of the `type` Unix shell builtin that\nincorporates features from the `which` and `file` utilities:  \nBy default, it provides information about the current shell.  \nGiven a name, it indicates how the current shell would interpret that name as a command, and provides information about each command form found.  \nGiven a filesystem path, it provides information such as file type and canonical path.\n\n`typex` extends `type` as follows:\n\n* _All_ defined forms of a given command name are (always) reported, which includes shell keywords, aliases, shell functions, builtins, and executables.\n* Defined forms are listed in descending order of precedence - the first form listed is the effective one.\n* If an executable is a symlink, the entire chain of symlinks up to and including the ultimate target is printed, using _absolute_ paths.\n* The type of executable is printed, including the specific shell/interpreter used to run executable scripts.\n* Version information, if available, is printed for executables.\n* Optionally, you can get information about any filesystem object, including its canoncial path and symlink chain, if applicable.\n\nNote: `typex` is designed for interactive use, to provide humans with concise, salient information about a command or filesystem object.\nAs such, its output is geared toward readability by humans, and should not be relied on for programmatic parsing.\n\nSee the examples below, concise [usage information](#usage) further below,\nor read the [manual](doc/typex.md).\n\nFor supported platforms and shells, see the [Installation](#installation) chapter.\n\n# Examples\n\n```shell\n# Print information about the current shell.\n$ typex\nBINARY:     /bin/bash  [GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin14)]\n\n# Print information about command forms named 'printf' in order of precedence.\n$ typex printf\nBUILTIN:    printf\nBINARY:     /usr/bin/printf  [printf (GNU coreutils) 8.21]\n\n# Print information about binary 'nawk'; note the chain of symlinks,\n# and its use of *absolute* paths, as well as the version information.\n$ typex nawk\nBINARY:     /usr/bin/nawk@ -\u003e /etc/alternatives/nawk@ -\u003e /usr/bin/gawk  [GNU Awk 4.0.1]\n\n# Print information about executable script 'npm';\n# note the interpreter information ('POSIX shell script').\n$ typex npm\nSCRIPT:     /usr/bin/npm@ -\u003e /usr/lib/node_modules/npm/bin/npm-cli.js  (POSIX shell script)  [2.11.3]\n\n# Print information about an alias:\n$ alias lsx='ls -FAhl'\n$ typex lsx\nALIAS:      lsx='ls -FAhl'\n  BINARY:     /bin/ls  [ls (GNU coreutils) 8.21]\n\n# Print the canonical path of a directory:\n$ typex /etc/apache2/\nDIRECTORY:  /etc/apache2 -\u003e /private/etc/apache2\n\n# Print extended information about special file /dev/null\n$ typex -v /dev/null\nFILE:       /dev/null  (character special )\n\tcrw-rw-rw- 1 root root 1, 3 Feb  1 19:43\n```\n\n# Installation\n\n**Supported platforms**\n\n* When installing from the **npm registry**: **Linux** and **OS X**\n* When installing **manually**: any **Unix-like** platform with **Bash** that uses either **BSD or GNU utilities**. \n\n**Supported shells**\n\nFor this utility to detect the current shell's aliases, keywords, functions, and builtins, it must be *sourced*, which is supported in the following shells:\n\n* **Bash**, **Ksh**, and **Zsh**\n\n`typex` can still be useful in unsupported shells when invoked standalone (in which case it runs in `bash`), albeit in limited form:\n\n* only executable *files* and filesystem objects will be detected - no other command forms.\n* a warning to that effect is printed; you can suppress it with `-p`\n\nSimply put, non-sourced use of `typex` amounts to an enhanced version of the `which` utility.\n\n## Installation from the npm registry\n\n\u003csup\u003eNote: Even if you don't use Node.js, its package manager, `npm`, works across platforms and is easy to install; try [`curl -L http://git.io/n-install | bash`](https://github.com/mklement0/n-install)\u003c/sup\u003e\n\nWith [Node.js](http://nodejs.org/) or [io.js](https://iojs.org/) installed, install [the package](https://www.npmjs.com/package/typex) as follows:\n\n    [sudo] npm install typex -g\n\n**Note**:\n\n* Whether you need `sudo` depends on how you installed Node.js / io.js and whether you've [changed permissions later](https://docs.npmjs.com/getting-started/fixing-npm-permissions); if you get an `EACCES` error, try again with `sudo`.\n* The `-g` ensures [_global_ installation](https://docs.npmjs.com/getting-started/installing-npm-packages-globally) and is needed to put `typex` in your system's `$PATH`.\n\n**IMPORTANT**: After installation, run `typex -i` to add sourcing of `typex` to the per-user initialization file of all supported shells that are present (e.g., `~/.bashrc`).\nTo remove these sourcing commands later, run `typex -u`.\n\n## Manual installation\n\n* Download [this `bash` script](https://raw.githubusercontent.com/mklement0/typex/stable/bin/typex) as `typex`.\n* Make it executable with `chmod +x typex`.\n* Move it or symlink it to a folder in your `$PATH`, such as `/usr/local/bin` (OS X) or `/usr/bin` (Linux).\n\n**IMPORTANT**: After installation, run `typex -i` to add sourcing of `typex` to the per-user initialization file of all supported shells that are present (e.g., `~/.bashrc`).\nTo remove these sourcing commands later, run `typex -u`.\n\n# Usage\n\nFind concise usage information below; for complete documentation, read the [manual online](doc/typex.md), or, once installed, run `man typex` (`typex --man` if installed manually).\n\n\u003c!-- DO NOT EDIT THE FENCED CODE BLOCK and RETAIN THIS COMMENT: The fenced code block below is updated by `make update-readme/release` with CLI usage information. --\u003e\n\n```nohighlight\n$ typex --help\n\n\nReports salient information about available commands, programs, and  \nfilesystem items, such as command or file type, (ultimate) location,  \nand version.\n\n    typex [-p] [-V] [-v] [\u003cnameOrPath\u003e...]\n\n    -p     look for files only (ignore shell aliases, keywords, functions,  \n           builtins)\n    -V     skip attempt to obtain executable version information\n    -v     verbose mode: report additional information\n\nInstall / uninstall sourcing via shell-initialization files (required  \nto detect aliases, functions, shell builtins - supported in  \nBash, Ksh, Zsh):\n\n    typex -i\n    typex -u\n```\n\n\u003c!-- DO NOT EDIT THE NEXT CHAPTER and RETAIN THIS COMMENT: The next chapter is updated by `make update-readme/release` with the contents of 'LICENSE.md'. ALSO, LEAVE AT LEAST 1 BLANK LINE AFTER THIS COMMENT. --\u003e\n\n# License\n\nCopyright (c) 2015-2020 Michael Klement \u003cmklement0@gmail.com\u003e (http://same2u.net), released under the [MIT license](https://spdx.org/licenses/MIT#licenseText).\n\n## Acknowledgements\n\nThis project gratefully depends on the following open-source components, according to the terms of their respective licenses.\n\n[npm](https://www.npmjs.com/) dependencies below have optional suffixes denoting the type of dependency; the _absence_ of a suffix denotes a required _run-time_ dependency: `(D)` denotes a _development-time-only_ dependency, `(O)` an _optional_ dependency, and `(P)` a _peer_ dependency.\n\n\u003c!-- DO NOT EDIT THE NEXT CHAPTER and RETAIN THIS COMMENT: The next chapter is updated by `make update-readme/release` with the dependencies from 'package.json'. ALSO, LEAVE AT LEAST 1 BLANK LINE AFTER THIS COMMENT. --\u003e\n\n## npm dependencies\n\n* [doctoc (D)](https://github.com/thlorenz/doctoc)\n* [json (D)](https://github.com/trentm/json)\n* [marked-man (D)](https://github.com/kapouer/marked-man#readme)\n* [replace (D)](https://github.com/harthur/replace)\n* [semver (D)](https://github.com/npm/node-semver#readme)\n* [shall (D)](https://github.com/mklement0/shall)\n* [urchin (D)](https://git.sdf.org/tlevine/urchin)\n\n\u003c!-- DO NOT EDIT THE NEXT CHAPTER and RETAIN THIS COMMENT: The next chapter is updated by `make update-readme/release` with the contents of 'CHANGELOG.md'. ALSO, LEAVE AT LEAST 1 BLANK LINE AFTER THIS COMMENT. --\u003e\n\n# Changelog\n\nVersioning complies with [semantic versioning (semver)](http://semver.org/).\n\n\u003c!-- NOTE: An entry template is automatically added each time `make version` is called. Fill in changes afterwards. --\u003e\n\n* **[v0.4.3](https://github.com/mklement0/typex/compare/v0.4.2...v0.4.3)** (2020-10-13):\n  * [fix] npm v6.14.8 inexplicably complains about the \"install\" command in package.json (which simply printfs an informational message), so it is diabled for now.\n\n* **[v0.4.2](https://github.com/mklement0/typex/compare/v0.4.1...v0.4.2)** (2020-10-13):\n  * [fix] Syntax error fixed that was masked by an accidental non-breaking space Unicode char.\n\n* **[v0.4.1](https://github.com/mklement0/typex/compare/v0.4.0...v0.4.1)** (2015-09-21):\n  * [fix] `typex /` now works correctly.\n\n* **[v0.4.0](https://github.com/mklement0/typex/compare/v0.3.3...v0.4.0)** (2015-09-21):\n  * [potentially breaking change] `typex` now accepts options _after_ operands\n      as well (except after `--`), and now also accepts long option names.\n  * [doc] `typex` now has a man page (if manually installed, use `typex --man`);\n      `typex -h` now just prints concise usage information.\n  * [doc] Read-me improved.\n  * [fix] Various fixes and stability improvements.\n  * [dev] Installation of sourcing (with `-i`) no longer uses `ed` so as to\n      work on a wider range of platforms, notably Fedora.\n  * [dev] Tests improved, additional tests added.\n\n* **[v0.3.3](https://github.com/mklement0/typex/compare/v0.3.2...v0.3.3)** (2015-09-15):\n  * [dev] Makefile improvements; various other behind-the-scenes tweaks.\n\n* **[v0.3.2](https://github.com/mklement0/typex/compare/v0.3.1...v0.3.2)** (2015-09-03):\n  * [fix] Broken (dangling) symlinks are now properly detected and reported.\n\n* **[v0.3.1](https://github.com/mklement0/typex/compare/v0.3.0...v0.3.1)** (2015-06-26):\n  * [dev] Makefile updated; to-do file added; typo in source-code comment fixed.\n  * [doc] Minor read-me revision.\n\n* **[v0.3.0](https://github.com/mklement0/typex/compare/v0.2.1...v0.3.0)** (2015-06-10):\n  * [behavior change, enhancement] When reporting on an alias, information about the underlying command is now output with indentation, so as to make it clear that the information is subordinate to the alias information.\n  * [fix] Reporting on an alias' underlying command no longer causes additional command forms of the same name to be ignored.\n  * [fix] Obtaining a file's last-modified timestamp no longer breaks with filenames with embedded spaces.\n  * [doc] Read-me improvements; version badge switched to shields.io; license badge added.\n\n* **v0.2.1** (2015-05-30):\n  * [doc] [npm registry badge](https://badge.fury.io) added\n\n* **v0.2.0** (2015-05-24):\n  * [enhancement] Now by default prints information about the _current shell_ (if no names are given).\n  * [enhancement] Specifying `.` now also prints the current directory's canonical path.\n  * [enhancement] Given a filesystem path, now also displays its canonical path with all symlinks resolved, if different.\n  * [enhancement] A warning is now issued if a bareword can't be found as a command, but a file or dir. of the same name exists in the current dir.\n  * [enhancement] For aliases, their definitions are now printed recursively, if applicable, and, if the ultimate definition's first token is a command, its information is printed as well.\n  * [fix] `typex perl` now correctly reports Perl's version.\n  * [fix] Paths with embedded space are now handled correctly.\n\n* **v0.1.7** (2015-03-04):\n  * Fix: Variables `$u` and `$i` that happen to be defined in the current shell no longer interfere with the sourced function.\n\n* **v0.1.6** (2015-02-11):\n  * Temp. fix: `typex -i` now properly reports failure on platforms that don't have the actual `ed` line editor, such as Debian.\n\n* **v0.1.5** (2015-02-11):\n  * Fix: --version no longer mistakenly exits the current shell when typex is invoked as a sourced function.\n  * Dev: bash-presence test improved.\n  * Dev: Makefile improvements.\n\n* **v0.1.4** (2015-02-11):\n  * Fix: Filenames that start with '-' are now handled correctly.\n  * Dev: bash-presence test added.\n  * Dev: Makefile improvements.\n\n* **v0.1.3** (2015-02-09):\n  * Doc: read-me and package description improved.\n\n* **v0.1.2** (2015-02-07):\n  * Fix: sourcing no longer auto-installed/-removed on package installation - removed due to permission headaches; users must now run typex -i manually after installation.\n\n* **v0.1.1** (2015-02-07):\n  * Fix: --version reported incorrect version number.\n  * Temp. fix: installation of sourcing with -i doesn't report error in case of failure so as not to prevent installation of the npm package altogether.\n\n* **v0.1.0** (2015-02-07):\n  * Initial release.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmklement0%2Ftypex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmklement0%2Ftypex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmklement0%2Ftypex/lists"}