From d36e40aa9eae4bd8a311fafc79d1587b60504683 Mon Sep 17 00:00:00 2001 From: Lynne Williams Date: Sun, 17 Feb 2013 10:49:52 -0500 Subject: [PATCH] Update shell_cheatsheet.md --- shell_cheatsheet.md | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/shell_cheatsheet.md b/shell_cheatsheet.md index 5054347..ce0cba0 100644 --- a/shell_cheatsheet.md +++ b/shell_cheatsheet.md @@ -23,21 +23,29 @@ ### b) How to delete files and directories... #### _Remember that deleting is forever. There is NO going back_ -* **`rm ./filename`** --> deletes a file called `filename` from the current directory -* **`rmdir ./dirname`** --> deletes the directory `dirname` from the current directory. _Note:_ `dirname` must be empty for `rmdir` to run. + +| Command | Definition | +|-------------------|------------------------------------------------------------------------------------------------------------------| +| `rm ./filename` | deletes a file called `filename` from the current directory | +| `rmdir ./dirname` | deletes the directory `dirname` from the current directory. _Note:_ `dirname` must be empty for `rmdir` to run. | ### c) How to copy and rename files and directories... -* **`mv tmp/filename .`** --> moves the file `filename` from the directory `tmp` to the current directory. _Note:_ _(i)_ the original `filename` in `tmp` is deleted. _(ii)_ `mv` can also be used to rename files (e.g., `mv filename newname` -* **`cp tmp/filename .`** --> copies the file `filename` from the directory `tmp` to the current directory. _Note:_ _(i)_ the original file is still there + +| Command | Definition | +|---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `mv tmp/filename .` | moves the file `filename` from the directory `tmp` to the current directory. _Note:_ _(i)_ the original `filename` in `tmp` is deleted. _(ii)_ `mv` can also be used to rename files (e.g., `mv filename newname` | +| `cp tmp/filename .` | copies the file `filename` from the directory `tmp` to the current directory. _Note:_ _(i)_ the original file is still there | ## 3. Pipes and Filters ### a) How to use wildcards to match filenames... Wildcards are a shell feature that makes the command line much more powerful than any GUI file managers. +Wildcards are particularly useful when you are looking for directories, files, or file content that can +vary along a given dimension. These wildcards can be used with any command that accepts file names or +text strings as arguments. - -** Table of commonly used wildcards ** +#### Table of commonly used wildcards | Wildcard | Matches | |------------------------|------------------------------------------------| @@ -49,7 +57,7 @@ Wildcards are a shell feature that makes the command line much more powerful tha | `[!a-e]` | any character that is not in the given range | | `{software,carpentry}` | exactly one entire word from the options given | - +See the cheatsheet on regular expressions for more "wildcard" shortcuts. ### b) That wildcards are expanded by the shell before commands are run... ### c) How to redirect a command's output to a file... -- 2.26.2