#:notebook_with_decorative_cover: Understanding Command Line Abridged from [Codecademy](https://www.codecademy.com/en/courses/learn-the-command-line) ##List - `ls -t` orders files and directories by the time they were last modified ##Copy, Move, Rename & Delete## - `cp` copies files - `mv` moves and renames files - `rm` removes _files_ - `rm -r` removes _directories_ ## Useful Utils - `sort` : sorts lines of text alphabetically. - `uniq` : filters duplicate, adjacent lines of text. - `grep` : searches for a text pattern and outputs it. - `sed` : searches for a text pattern, modifies it, and outputs it. `grep` stands for "global regular expression print". It searches files for lines that match a pattern and returns the results. It is also case sensitive. Use `i` option for case insensitive. >Find all instances of "Mount" in `mountain.txt' regardless of case ``` $ grep -i Mount mountains.txt ``` > Recursively search (within) files within a directory ``` grep -R searchForSomething /path/to/directory ``` `sed` stands for "stream editor". It accepts standard input and modifies it based on an expression, before displaying it as output data. It is similar to "find and replace". Works on each line separately. Use `g` flag to match all instances on line, not just first. ``` $ sed 's/snow/rain/g' forests.txt ``` ## Putting it all together: Pipes & Redirects - **Pipe** is used to pass output to another **program** or utility. - **Redirect** is used to pass output to either a **file** or stream