Text Editing
Tarih: 2026-06-11 | Kategori: Linux
Etiketler: Linux
Linux provides a range of powerful tools for creating, editing, and viewing text files. In this section, we will cover one of the most popular text editors and tools accessible from the command line: `nano`.
Nano Text Editor
`nano` is one of the most widely used editors on Linux-based systems. It is a simple yet effective text editor that comes pre-installed with many Linux distributions. No prior knowledge about the nano editor is required to use it.
You don't need to use commands to perform operations on a file in nano; all basic operations are displayed at the bottom of the editor, which can be triggered using the `CTRL` key. For example, to save a file, you press `CTRL+O`, and to exit the editor, you press `CTRL+X`.
To edit a file with the nano editor, run the following command:
root@hackerbox:~$ nano note.txt
The above command opens the file `note.txt` with the nano editor. You can move the cursor and enter the desired text to edit the file.
At the bottom of the screen, you'll see two lines with short descriptions. The `^` symbol represents the `CTRL` key on your keyboard.
For example, pressing `[CTRL + W]` brings up the `Search:` line at the bottom of the editor, where you can enter the word or phrase you are looking for. If you now enter `demo` and press `[ENTER]`, the cursor will move to the first instance of the word. In this way, you can search within the text.
To save the changes made in the `note.txt` file, use the shortcut `CTRL + O`. Then, to exit the text editor, use the shortcut `CTRL + X`.
After exiting the text editor, you can verify that your text has been saved by printing the contents of the file with the `cat` command. The `cat` command is used to print the contents of files to the terminal.
root@hackerbox:~$ cat note.txt
This is a sample text written with the nano editor.
root@hackerbox:~$