渋谷で働くWebエンジニアのログ. Java, Android, iOS, Docker, GCP, AWS, ゲーム開発


Run a Command Repeatedly and Display the Output

watch runs a command repeatedly, displaying its output. This allows you to watch the program output change over time. By default, the program is run every 2 seconds. watch is very similar to tail.

watch -d ls -l

  • This will watch the current directory for any file changes and highlight the change when it occurs.

Navigate to the Last Directory You Were In

cd –
will take you to the last directory you were in.


Delete the Entire Line

If you’ve just typed a long string of commands that you don’t need to enter anymore, delete the entire line by using: CTRL+U,K. That is not easy. CTRL+U deletes whatever is to the left of the cursor and CTRL+K deletes what is to the right. If you are at the end of command, CTRL+U will do. Especially if you start typing password and you make a mistake. Alternatively, you can use CTRL+C, which discards the current typed command, and gives you a new line.
CTRL+L will clear the screen.

CTRL+L でスクリーンのクリア
CTRL+U でコマンドのカーソルから左を削除
CTRL+K は右を削除