> basic terminal utilities Terminal utilities are essential for viewing, filtering, and manipulating text and files. Here are some of the most common utilities included in SDG-OS. --- ### Viewing File Contents - `cat `: Displays the entire contents of a file. For example, `cat notes.txt` prints the contents of "notes.txt" to the terminal. - `less `: Views a file interactively, allowing you to scroll with arrow keys and exit with *q*. For example, `less longfile.txt` lets you scroll through "longfile.txt". - `head -n `: Displays the first lines of a file. For example, `head -n 10 notes.txt` shows the first 10 lines of "notes.txt". - `tail -n `: Displays the last lines of a file. For example, `tail notes.txt` shows the last 10 lines of "notes.txt". Use `tail -f ` to follow updates to a file in real-time, which is useful for monitoring logs. --- ### Printing Text - `echo "text"`: Prints text to the terminal. For example, `echo "Hello, SDG-OS!"` prints "Hello, SDG-OS!", you can also use this to input text to another command --- ### Counting Words and Lines - `wc `: Counts lines, words, and characters in a file. For example, `wc notes.txt` outputs: "5 10 50 notes.txt", This means "notes.txt" has 5 lines, 10 words, and 50 characters. - `wc -l `: Counts only lines. For example, `wc -l notes.txt` outputs the number of lines in "notes.txt". --- ### Sorting and Unique Lines - `sort `: Sorts lines alphabetically. For example, `sort list.txt` sorts the lines in "list.txt". - `uniq `: Removes duplicate lines from a sorted file. For example, `sort list.txt | uniq` sorts "list.txt" and removes duplicates. ### watching outputs - `watch -n `: provides you with a live-updating display of the provided command, refreshing every seconds, `watch -n 1 iostat` would give you the iostat output, updating every second.