windowsで「tails」コマンドを実行する

windowsで「tails」コマンドを実行する手順を記述してます。
環境
- OS windows10 pro
「tails」コマンドを実行
「powershell」を使用して、「tails」と同等のコマンドを実行することが可能です。
Get-Content ファイル -Wait -Tail 行数
例えば「test.log」というファイルを、後ろから10行のみリアルタイムに取得したい場合は、以下となります。
Get-Content .\test.log -Wait -Tail 10
「test.log」
testlog1
testlog2
testlog3
testlog4
testlog5
testlog6
testlog7
testlog8
testlog9
testlog10
testlog11
testlog12
testlog13
testlog14
testlog15
実行結果

vscode上でも、実行できるので便利です。
※ファイル更新時は全ての行が読み取られます。

全行表示されるのが嫌な場合は、「Bash on Ubuntu on Windows」を使用すれば可能です。
# mntに移動
cd /mnt
# ドライブ確認
ls
# ドライブを選択
c d e f g
# 対象ドライブに移動
cd c
# 対象のファイルに、tailsを使用する
tail -f 10 test.log
-
前の記事
node.js mysqlに接続してupdateを実行してデータを更新する 2021.08.28
-
次の記事
javascript lodashを使ってメソッドを配列に適応してから一意な値を取得する 2021.08.29
コメントを書く