Viewing, Creating, and Editing Files

Cat Command

  • Displays the contents of Hey.txt.

cat Hey.txt 

Overwrite

  • Creates or overwrites Hey.txt with the text Hello.

echo "Hello" > Hey.txt

Append

  • Appends Hello again again to the end of Hey.txt.

echo "Hello again again" >> Hey.txt

Touch Command

  • The touch command is used to quickly create empty files, update timestamps of existing files, or check if a file exists in scripts.

touch hello.txt

Gedit Command

  • The command gedit hello.txt opens the file hello.txt in the Gedit text editor, allowing you to view or edit its contents in a graphical interface.

gedit hello.txt

Nano Command

  • The command nano hello.txt opens the file hello.txt in the Nano text editor, allowing you to edit it directly in the terminal.

nano hello.txt

Last updated