cp

初級
1/6
user@linux:~/workspace$
cp file.txt backup.txt

解説

file.txtbackup.txt という名前でコピーします。backup.txt が既に存在する場合は上書きされます。

オプション

-rディレクトリを再帰的にコピー(必須)
-vコピーしたファイルを表示(verbose)
-pパーミッション・タイムスタンプを保持
-Rディレクトリを再帰的にコピー(`-r` と等価)
-i上書き前に確認を求める(interactive)
-u更新されたファイルのみコピー
-aアーカイブモード(-pRと同等)
1Hello, World!
2This is a sample text file for practicing Linux commands.
3You can use commands like cat, head, tail, and grep on this file.
4
5Line 5: Learning Linux commands through typing practice.
6Line 6: WebContainers make it possible to run commands in the browser.
7Line 7: Practice makes perfect!
8Line 8: Keep typing to improve your speed and accuracy.
9Line 9: Linux is widely used in servers and development environments.
10Line 10: Mastering the command line is a valuable skill.