To edit a file in Bash, you can use text editors like nano or vim. Here’s how to use both:
Using nano:
- Open the file with
nano:nano filename.txt - Make your changes.
- Save and exit by pressing
CTRL + X, thenYto confirm, andEnter.
Using vim:
- Open the file with
vim:vim filename.txt - Press
ito enter insert mode and make your changes. - Press
ESCto exit insert mode. - Type
:wqand pressEnterto save and exit.
Note:
- If you are new to text editors,
nanois generally more user-friendly for beginners.
Let me know if you need more details or assistance!
