-
Notifications
You must be signed in to change notification settings - Fork 1
/
readme.txt
130 lines (87 loc) · 3.67 KB
/
readme.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
whereis started out 1997 as a C++ program and is something I've used almost
daily on Windows since then.
As an exercise in learning Python, I ported it to Python about 2 years and
discovered to my delight that not only was the code a lot smaller in Python,
but that it was actually faster, too. With Python 3.5, it's become
significantly faster still.
Since this is something I use a lot, especially at work, it's been pretty well
bug-tested and featureful.
As of 3.10.0, I've made the program compatible with Linux, something I should
have done years ago. It also works on Python 2. I've tested it (but not
comprehensively) with Python 2.6 and 2.7.
Using whereis in Linux requires suppressing bash globbing. I put this in my
.bashrc:
function whereis( ) {
python ~/bin/whereis.py "$@";
}
Note that on Linux, the command-line switches are denoted by '-' instead of
'/'.
Rick
c:\>whereis /?
whereis 3.10.0
usage: whereis [options] [filespec] [target]
Search for files with names matching 'filespec' in the location specified
by 'target'.
filespec defaults to '*.*'
target defaults to '.'
If only one argument is specified, whereis attempts to determine if it is a
filespec or target.
command-line options:
/?, /h, --print_help
output this help message and exit
/1, --find_one
quit after finding one file
/a, --file_attributes
print file attributes (file permissions on Linux)
/b dir, --backup dir
backup found files to a location relative to dir
/c command, --execute_command command
execute a command for each file (currently unsupported in Linux)
/D {a,c,m} --output_timestamp {a,c,m}
output file timestamp, a = last accessed, c = created, m = last
modified
/d, --output_timestamp
output file timestamp (equivalent to /Dm)
/e, --output_dir_totals
output totals for each directory
/E, --output_dir_totals_only
output totals for each directory and not for each file
/g, --filename_truncation
whereis attempts to display the filenames on a single line
/i filespec [filespec ...], --include_filespec filespec [filespec ...]
include additional filespecs for searching
/l, --count_lines
output the line count of each file
/Lf n, --file_count_length n
set the amount of size of the file count column
/Ll n, --line_length n
set the default line length for displaying text, used with /g (default is 80)
/Ln n, --line_count_length n
set the default size of the line count column
/Lz n, --file_size_length n
set the default size of the file size column
/m, --no_commas
display numerical values with no commas (Python 2.6 does not support commas)
/n [n], --max_depth [n]
maximum directory depth to recurse when searching, defaults to infinite
if /n is not specified or 1 directory if /n is specified with no value
/q, --quiet
suppress status output
/r, --output_relative_path
output a relative path to the current directory for files rather than
an absolute file path
/s, --output_file_size
output the file sizes in bytes
/t, --output_totals
output totals for all numerical vallues
/u, --hide_command_output
suppress output from commands (i.e. when using /c)
/v, --version
output the version number and exit
/vv, --version_history
output the version history
/x filespec [filespec ...], --exclude_filespec filespec [filespec ...]
exclude filespecs from searching
/z, --print_command_only
the same as /c, except the command is not executed, but output to the
console