You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
These are companion notes to my [dotfiles](https://github.com/rsapkf/config) and [links](https://github.com/rsapkf/42/) where I keep short snippets of code, shell scripts, tricks and tips to remember stuff.
7
+
These are companion notes to my [dotfiles](https://github.com/rsapkf/config) and [links](https://github.com/rsapkf/42/) where I keep short snippets of code, shell scripts, tricks and tips related to common Linux utilities/concepts, mathematical topics, Martin Gardner's mathemagic tricks, poems that I like, notes from books I've read, etc.
8
8
9
9
Notes are in the [`docs/`](https://github.com/rsapkf/73/tree/main/docs) directory.
find /usr -type f -name "*.conf"# Search for files ending in `.conf` in `/usr` directory
29
29
find /usr -type f -and -name "*.conf"# Equivalent to above; `-and` combines two queries
30
30
find -name query_1 -or -name query_2 # `-or` returns results that match either expression
31
-
32
31
```
33
32
34
33
### Find by size
35
34
36
35
```shell
37
36
find -size <number><suffix># Basic usage
38
37
# Common suffixes
39
-
# c: bytes
40
-
# k: kilobytes
41
-
# M: megabytes
42
-
# G: gigabytes
38
+
# c: Bytes
39
+
# k: Kilobytes
40
+
# M: Megabytes
41
+
# G: Gigabytes
43
42
# b: 512-byte blocks
44
43
45
44
find /usr -size 50c # Find all files in `/usr` exactly 50 bytes in size
46
45
find /usr -size -50c # Less than 50 bytes in size
47
46
find /usr -size +600M # More than 600 megabytes in size
48
-
49
47
```
50
48
51
49
### Find by time
@@ -80,7 +78,7 @@ find / -perm 644
80
78
find / -perm -644 # Files with at least these permisions
81
79
```
82
80
83
-
### Filter by depth
81
+
### Find by depth
84
82
85
83
```shell
86
84
find -mindepth <num>
@@ -89,9 +87,25 @@ find -maxdepth <num>
89
87
90
88
### Execute commands on `find` results
91
89
90
+
Other commands can be executed on results returned by `find` using the `-exec`/`-delete` options or by piping the output to the [`xargs`](./xargs) command or [GNU Parallel](<https://en.wikipedia.org/wiki/Parallel_(software)>).
`fzf` is a command line fuzzy finder. It can search through the entries in a list of files, command history, processes, hostnames, bookmarks, git commits, etc.
7
+
8
+
`fzf` provides 3 keyboard shortcuts:
9
+
10
+
-**`CTRL-T`** to paste the selected **files and directories** onto the command-line.
11
+
12
+
By default, `fzf` uses `find` to search for files. This can be configured setting `FZF_CTRL_T_COMMAND` in `.bashrc`/`,zshrc`:
13
+
14
+
```shell title="~/.zshrc"
15
+
# Set fd as the default source for fzf
16
+
export FZF_DEFAULT_COMMAND='fd -type f --follow --hidden --exclude .git'
Copy file name to clipboardExpand all lines: docs/linux/grep.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -30,7 +30,7 @@ grep "^[[:upper:]]" <file> # Equivalent to above; Using POSIX classes
30
30
31
31
### Extended regular expressions
32
32
33
-
Along with basic regular expressions (BREs, which is the default), `grep` also supports [extended regular expressions (EREs)](https://en.wikipedia.org/wiki/Regular_expression#Standards) by using the `-E`flag or by calling the `egrep` command.
33
+
Along with basic regular expressions (BREs, which is the default), `grep` also supports [extended regular expressions (EREs)](https://en.wikipedia.org/wiki/Regular_expression#Standards) by using the `-E`option or by calling the `egrep` command.
0 commit comments