Skip to content

Latest commit

 

History

History
126 lines (70 loc) · 2.69 KB

locate_statistics.md

File metadata and controls

126 lines (70 loc) · 2.69 KB
layout title tags
manual
locate - Statistics of command combinations using pipe
statistic

Before

The commands before locate: Pipe the result of the given command to locate.

Command percentage
head 100%

After

The commands after locate: Pipe the result of locate to the given command.

Command Percentage
xargs 25%
grep 14%
ls 11%
w 11%
sed 7%
name 7%
mv 3%
cat 3%
sort 3%
awk 3%
rm 3%
head 3%

Related Scenarios

Below are the scenarios for all command combinations above.

The description in the table is referenced from and can be used to search the one-line-command or the scripts in the website of CommandLineFu.

Pipe head to locate

  • Check apache config syntax and restart or edit the file

Pipe locate to xargs

  • do a full file listing of every file found with locate
  • Move all located items to folder
  • Delete all files from a locate output
  • show a sorted list of directory whose name matches the pattern
  • Find 'foo' in located files
  • look some php code by some keywords
  • locate a filename, make sure it exists and display it with full details

Pipe locate to grep

  • quick find executable from locate db
  • Find all relevant certificates (excluding some dirs) and list them each
  • Find 'foo' in located files
  • look some php code by some keywords

Pipe locate to ls

  • do a full file listing of every file found with locate
  • Find all relevant certificates (excluding some dirs) and list them each
  • locate a filename, make sure it exists and display it with full details

Pipe locate to w

  • Random play a mp3 file
  • Look up a unicode character by name
  • look some php code by some keywords

Pipe locate to sed

  • do a full file listing of every file found with locate
  • pc is ghosted?!

Pipe locate to name

  • show a sorted list of directory whose name matches the pattern
  • look some php code by some keywords

Pipe locate to mv

  • Move all located items to folder

Pipe locate to cat

  • Find all relevant certificates (excluding some dirs) and list them each

Pipe locate to sort

  • search for files or directories, then show a sorted list of just the unique directories where the matches occur

Pipe locate to awk

  • Random play a mp3 file

Pipe locate to rm

  • Delete all files from a locate output

Pipe locate to head

  • Check apache config syntax and restart or edit the file