> For the complete documentation index, see [llms.txt](https://devops-3.gitbook.io/devops/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://devops-3.gitbook.io/devops/docs/linux-cheat-sheet/file-viewing-and-editing.md).

# File Viewing & Editing

| Command                                            | Description                                   | Example                                                                 |
| -------------------------------------------------- | --------------------------------------------- | ----------------------------------------------------------------------- |
| <mark style="color:red;">**cat**</mark>            | Concatenate and display file contents.        | cat file.txt → Displays the content of file.txt.                        |
| <mark style="color:red;">**more/less**</mark>      | View file contents one page at a time.        | less file.txt → Displays file.txt one page at a time.                   |
| <mark style="color:red;">**nano/vim/emacs**</mark> | Text editors for file editing.                | nano file.txt → Opens file.txt in the Nano editor.                      |
| <mark style="color:red;">**head**</mark>           | Display the beginning of a file.              | head -n 5 file.txt → Displays the first 5 lines of file.txt.            |
| <mark style="color:red;">**tail**</mark>           | Display the end of a file.                    | tail -n 5 file.txt → Displays the last 5 lines of file.txt.             |
| <mark style="color:red;">**wc**</mark>             | Count lines, words, and characters in a file. | wc file.txt → Outputs the line, word, and character counts of file.txt. |
| <mark style="color:red;">**sed**</mark>            | Stream editor for text manipulation.          | sed 's/old/new/g' file.txt → Replaces "old" with "new" in file.txt.     |
