Skip to main content

clf - Command line tool to search snippets on Commandlinefu.com

https://travis-ci.org/ncrocfer/clf.svg?branch=master

Commandlinefu.com is the place to record awesome command-line snippets. This tool allows you to search and view the results into your terminal.

Example 1

$ clf python server

  # python smtp server
  python -m smtpd -n -c DebuggingServer localhost:1025

  # Python version 3: Serve current directory tree at http://$HOSTNAME:8000/
  python -m http.server

  # Start a HTTP server which serves Python docs
  pydoc -p 8888 & gnome-open http://localhost:8888

  # put current directory in LAN quickly
  python -m SimpleHTTPServer

  # An alternative to: python -m SimpleHTTPServer for Arch Linux
  python3 -m http.server

Example 2

$ clf recursive line count

  # Recursive Line Count
  find ./ -not -type d | xargs wc -l | cut -c 1-8 | awk '{total += $1} END {print total}'

  # Recursive Line Count
  find * -type f -not -name ".*" | xargs wc -l

  # Get Total Line Count Of All Files In Subdirectory (Recursive)
  find . -type f -name "*.*" -exec cat {} > totalLines 2> /dev/null \; && wc -l totalLines && rm totalLines

  # Recursive Line Count
  wc -l `find . -name *.php`

Installation

The tool works with Python 2 and Python 3. It can be installed with Pip :

pip install clf

Usage

Command line tool to search snippets on Commandlinefu.com

Usage:
  clf --browse [options]
  clf <command> [options]
  clf <keyword> <keyword>... [options]

Options:
  -h, --help     Show this help.
  -v, --version  Show version.
  -c, --color    Enable colorized output.
  -b, --browse   Browse the Commandlinefu.com archive.
  --order=ORDER  The order output (votes|date) [default: votes].
  --proxy=PROXY  The proxy used to perform requests.

Examples:
  clf tar
  clf python server
  clf tar --proxy=http://127.0.0.1:8080
  clf --browse --order=date

Notes

  • You can set the CLF_COLOR environment variable to enable the colorized output by default.

  • You can import the clf module and use it in your own scripts :

>>> from clf import Clf
>>> c = Clf()
>>> for cmd in c.browse():
>>>     print(cmd.summary)
>>>     print(cmd.command)

Release files for clf 0.5.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for clf 0.5.7
File Size Uploaded
clf-0.5.7.tar.gz 5.2 kB Details

Release files / clf-0.5.7.tar.gz

Download URL clf-0.5.7.tar.gz
Size 5.2 kB
Tags Source
SHA-256 checksum
How to use checksums
abc919a1e99667f32fdde15dfb4bc527dbe22cf86a17acb78a449d7f2dfe937e
BLAKE2b-256 checksum
How to use checksums
7442448e0b36b6424835edda52e1e3139a045cccb963e5c6a302081bcd12522c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.5.7 This release

1 release file

0.5.6

1 release file

0.5.5

1 release file

0.5.4

1 release file

0.5.3

1 release file

0.5.2

1 release file

0.5.1

1 release file

0.5

1 release file

0.4

1 release file

0.3

1 release file

0.2

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page