
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Contents
fls
— filtering ls — is a type-filtering wrapper for the standard ls
Unix utility.
The general idea is to enhance ls
with the ability to filter items by filesystem type by specifying a filter expression as the first argument.
A filter expression is composed of one or more optionally negatable filter characters based on the type-identifying chars. supported by find
's -type
primary and Bash's file-test operators,
such as f
for files, d
for directories.
Behind the scenes ls
is ultimately invoked, so all of its options - except -R
/ --recursive
- are supported.
Specifying a filter is optional, so fls
can generally be used in lieu of ls
, with a few restrictions detailed in the manual.
The following example lists only subdirectories in the current directory, in long format:
fls d -l
fls
also lends itself to creating aliases; for instance, the following alias lists all executable (x
) files (f
):
alias lsbin='fls fx'
This alias can serve as a general ls
replacement with fixed options, to which you may optionally pass filters as the first operand:
alias lsx='fls -FAhl'
See examples below, read concise usage information further below, or read the manual.
# List all files (not directories) in the current dir.
fls f
# List all subdirs. of the user's home dir.
fls d ~
# List all symlinks to hidden files in long format in the user's home dir.
fls lf -l ~/.*
# List all executable files matching c* in /usr/local/bin
fls xf /usr/local/bin/c*
# List all empty (zero bytes) files in the current dir.
fls fe
# List all empty directories in the current dir, most recent one first.
fls de -t
# Use without filters:
fls # same as ls
fls -lt ~ # same as ls -lt ~
fls -lt -- pg # same as lf -lt pg; -- unambiguously marks 'pg' as file operand
Supported platforms
With Node.js or io.js installed, install the package as follows:
[sudo] npm install fls -g
Note:
sudo
depends on how you installed Node.js / io.js and whether you've changed permissions later; if you get an EACCES
error, try again with sudo
.-g
ensures global installation and is needed to put fls
in your system's $PATH
.bash
script as fls
.chmod +x fls
.$PATH
, such as /usr/local/bin
(OSX) or /usr/bin
(Linux).Find concise usage information below; for complete documentation, read the manual online, or, once installed, run man fls
(fls --man
if installed manually).
$ fls --help
A type-filtering wrapper around the standard ls utility.
fls [<filter>] [<options-for-ls>] [<dir>]
fls [<filter>] [<options-for-ls>] <fileOrDir>...
<filter> is a string of filter characters; commonly used are:
f file or symlink to file
d dir or symlink to dir
l symlink
x executable file / searchable dir. (by you)
e empty file (zero bytes) or empty dir. (no files or subdirs.)
Filters are combined with logical AND, and filters placed after ^ are negated.
E.g., fls fx^l lists executable files that aren't symlinks.
Standard options: --help, --man, --version, --home
Copyright (c) 2015-2020 Michael Klement mklement0@gmail.com (http://same2u.net), released under the MIT license.
This project gratefully depends on the following open-source components, according to the terms of their respective licenses.
npm 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.
Versioning complies with semantic versioning (semver).
v0.4.0 (2021-08-19):
ls
's -R
/ --recursive
option now causes an error; it was never meaningfully supported.v0.3.3 (2020-01-26):
v0.3.2 (2018-07-26):
v0.3.1 (2018-07-25):
npm
-package security vulnerabilities fixed - note that these vulnerabilities never affected runtime operation.v0.3.0 (2015-09-17):
l
now accepted in addition to L
and h
),
s
in addition to S
; (b) new filter e
for testing emptiness added, which supersedes the previous s
filter with opposite semantics.
s
now means test for a socket, and what was previously s
(non-emptiness test) can now be expressed more intuitively as
^e
(negated emptiness test), and, conversely, a simple e
tests for emptiness rather than the obsolete double-negative ^s
.v0.2.3 (2015-09-16):
v0.2.2 (2015-09-16):
fls
now has a man page, and -h
outputs concise usage information only.v0.2.1 (2015-09-15):
v0.2.0 (2015-07-26):
ls
so as to facilitate use of fls
-based aliases as general ls
replacements with optional on-demand filtering.--
also unambiguously marks it as a filter.ls
implementation doesn't support it.--
in lieu of a filter to explicitly requests that no filtering be performed - the previously used -
no longer works.-d
, previously only used behind the scenes for multiple operands, can now be used explicitly to request that a single operand
that is a directory be targeted as itself, as opposed to its contents.v0.1.5 (2015-07-18):
v0.1.4 (2015-06-09):
v0.1.3 (2015-06-03):
v0.1.2 (2015-06-03):
v0.1.1 (2015-06-03):
v0.1.0 (2015-06-03):
v0.0.2 (2015-06-03):
command
with exec
, which fails on Linux, because command
is only a builtin (and was never needed to begin with).v0.0.1 (2015-06-03):
FAQs
Unix CLI that is a type-filtering wrapper for the standard ls utility.
We found that fls demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.