Tbpgr Blog

Employee Experience Engineer tbpgr(てぃーびー) のブログ

> リダイレクトでファイル出力

概要

リダイレクトによりコマンドの実行結果をファイルに出力可能。

上書きリダイレクト構文

コマンド > ファイル名

追記リダイレクト構文

コマンド >> ファイル名

リダイレクトサンプルコード

$echo test > test.txt
$cat test.txt
test
$echo test > test.txt
$cat test.txt
tes

上書きリダイレクトサンプルコード

$echo test >> test.txt
$cat test.txt
test
$echo test >> test.txt
$cat test.txt
test
test