1 个不稳定版本
0.1.0 | 2022年8月21日 |
---|
#63 在 #cli-command
9KB
120 行
fadvise
fadvise
是一个 CLI 命令,用于对特定文件调用 posix_fadvise(2)
使用方法
以下是一个缓存驱逐的示例。
❯ cat Cargo.toml > /dev/null
❯ fincore -b Cargo.toml
RES PAGES SIZE FILE
4096 1 500 Cargo.toml
❯ fadvise dontneed Cargo.toml
filename: Cargo.toml
advice: POSIX_FADV_DONTNEED
offset: 0
len: 500
❯ fincore -b Cargo.toml
RES PAGES SIZE FILE
0 0 500 Cargo.toml
安装
从 crates.io
❯ cargo install fadvise
从源代码(GitHub)
❯ git clone https://github.com/StoneDot/linux-tools.git
❯ cd linux-tools/fadvise/
❯ cargo install --path .
完成
bash
# Create a directory to store a completion code
❯ mkdir -p $HOME/.local/share/bash-completion/completions
# Place a completion code
❯ fadvise completion --shell bash > $HOME/.local/share/bash-completion/completions/fadvise
zsh
# Create a directory to store a completion code
❯ mkdir -p $HOME/.zsh.d/functions
# Place a completion code
❯ fadvise completion --shell zsh > $HOME/.zsh.d/functions/_fadvise
# Execute the following line if your fpath does not include `$HOME/.zsh.d/functions`
❯ echo '[ "${fpath[(I)$HOME/.zsh.d/functions]}" -eq 0 ] && fpath=($fpath $HOME/.zsh.d/functions)' | tee -a $HOME/.zshrc
依赖项
~5MB
~98K SLoC