├── LICENSE ├── README.md └── index.html /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Steven Kneiser 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Introduction to Unix Commands 2 | 3 | [](http://spartanhackers.com) 4 | 5 | [](https://www.youtube.com/watch?v=UrMB1Pdwja0) 6 | 7 | ###### Click the image above to see the screencast! 8 | 9 | Windows users should download PuTTY: 10 | 11 | ``` 12 | http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html 13 | ``` 14 | 15 | ## Getting Started (5 minutes) 16 | 17 | - Why bash is important to know 18 | - Understanding the directory structure (tree) 19 | 20 | > Remember how, on your Desktop, you can manipulate files and folders? 21 | > 22 | > The entire filesystem for your computer is just a MASSIVE tree of folders and folders with files along the way. 23 | 24 | Notable Directories 25 | - Root "**/**" - The single folder at the core 26 | - Home "**~**" - The folder containing everything for your user 27 | - Working "**.**" - The current folder you're in 28 | 29 | ...also, I'm gonna refer to folders as directories here on out. 30 | 31 | ## Bits of Bash (20 minutes) 32 | 33 | Got that shell open? Time for some basic navigation! 34 | 35 | - **ls** - list directory contents 36 | - **cd** - change working directory 37 | - **touch** - change file access and modification times (creates a file) 38 | - **rm** - remove directory entries 39 | - **cp** - copy files 40 | - **mv** - move files 41 | - **clear** - clear the terminal screen 42 | 43 | Now that you've got those under your belt, we need to talk about command options- or *flags*. Flags are how we specify additional parameters to our commands similar to passing arguments to a function in programming. 44 | 45 | For example: sure, **ls** lists directory contents but what if I want to see hidden dotfiles? I can include the **-a** option: 46 | 47 | ```shell 48 | ls -a 49 | ``` 50 | 51 | Want a "long" listing with lots of additional system information? 52 | 53 | ```shell 54 | ls -l 55 | ``` 56 | 57 | But how do we familiarize with all of these hidden options? *...I'm glad you asked.* 58 | 59 | - **man** - format and display the on-line manual pages 60 | 61 | # Time to wing it 62 | 63 | Before we move on, you should copy this document onto your desktop: 64 | 65 | ```shell 66 | curl --location goo.gl/NU44jC > ~/Desktop/unix.txt 67 | ``` 68 | This will prove a great resource for you to refer back to if you ever get lost or have any nagging questions after the workshop. 69 | 70 | > I got you. -Steven Kneiser 71 | 72 | ## My Mysterious & *Undisputably Dope* Project (10 minutes) 73 | 74 | Finally! Time to do something both tangible *and dope*. First thing we're gonna do is remote into a school server: 75 | 76 | ```shell 77 | ssh your_net_id@arctic.cse.msu.edu 78 | ``` 79 | 80 | After entering your password you should be in your user's home directory (represented by the "**~**"). Next up, we're gonna make a directory for this project called "**web**" and hop right in there: 81 | 82 | ```shell 83 | mkdir web 84 | cd web 85 | ``` 86 | 87 | This seems like the PERFECT place to dump my mysterious & *undisputably dope* file: 88 | 89 | ```shell 90 | curl --location goo.gl/W5GHZd > index.html 91 | ``` 92 | 93 | *Rubs hands together with a devilish grin* 94 | 95 | Now before I give anything away, I want you to run these two commands: 96 | 97 | ```shell 98 | chmod -R a+rX ~/web 99 | chmod 701 ~/ 100 | ``` 101 | 102 | **Congratulations**, you've officially setup your very own student homepage! Don't believe me? Visit: 103 | 104 | ``` 105 | cse.msu.edu/~your_net_id 106 | ``` 107 | 108 | ## Q&A & Unix Tips (25 minutes) 109 | 110 | #### Basic Navigation 111 | 112 | - ls & cd 113 | - touch & rm 114 | - cp & mv 115 | - mkdir & rmdir 116 | - cat & editors (nano, vim, emacs) 117 | - understanding flags 118 | - *tab-completion & clear* 119 | - **finding help (man, apropos, ...then google)** 120 | 121 | #### Bash Redirection & Search 122 | 123 | - piping 124 | - less/more & head & tail 125 | - grep 126 | - sort & awk & wc 127 | - find 128 | 129 | #### Filesystem security 130 | 131 | - reading access rights 132 | - chmod 133 | - sudo & su 134 | 135 | #### Running processes (language-specific consoles etc) 136 | 137 | - jobs (listing and suspending) 138 | - fg & bg 139 | - ps 140 | - sending signals 141 | 142 | #### Customizing your environment (dotfiles) 143 | 144 | - environmental variables (echo & printenv) 145 | - **.profile's & rc's (SHELL-DEPENDENT)** 146 | - aliases & functions 147 | - SSH & simplifying (.ssh/config) 148 | - package-management 149 | 150 | #### Advanced Miscellaneous 151 | 152 | - keyboard shortcuts (reverse-i search) 153 | - curly brace completion 154 | - bash scripting 155 | - crontab 156 | 157 | ## Further reading 158 | 159 | #### [*This Repo*](https://github.com/theshteves/bash-workshop) 160 | 161 | #### Other Unix tutorials 162 | 163 | - [CSE-320 Bash reference **READ THIS IF NOTHING ELSE**](http://www.ee.surrey.ac.uk/Teaching/Unix/) 164 | - [A curated list of awesome command-line guides, frameworks, etc](https://github.com/alebcay/awesome-shell) 165 | - [Advancing in the Bash Shell](http://samrowe.com/wordpress/advancing-in-the-bash-shell/) 166 | - [Advanced Bash-Scripting Guide: An in-depth exploration of the art of shell scripting](http://www.tldp.org/LDP/abs/html/) 167 | 168 | #### Other shells 169 | 170 | - [Z Shell (zsh) tutorial](http://reasoniamhere.com/2014/01/11/outrageously-useful-tips-to-master-your-z-shell/) 171 | - [Great resource for customizing your zsh](https://github.com/robbyrussell/oh-my-zsh) 172 | 173 | #### More on Unix: 174 | 175 | - [Wikipedia - Unix](https://en.wikipedia.org/wiki/Unix) 176 | - [dotJS Talk w/ some historical background knowledge](https://www.youtube.com/watch?v=UIDb6VBO9os) 177 | 178 | #### Learning Vim? 179 | 180 | - [My favorite cheatsheet](http://i.imgur.com/YLInLlY.png) 181 | - [Learn from others' screencasts](http://vimcasts.org/) 182 | - [Advanced vim registers](http://blog.sanctum.geek.nz/advanced-vim-registers/) 183 | 184 | #### Miscellaneous 185 | 186 | - [Jealous of my colorful bash prompt? Generate a dope one](https://www.kirsle.net/wizards/ps1.html) 187 | - [An even more beautiful prompt](https://github.com/milkbikis/powerline-shell) recommended by [@nicovergara](https://github.com/nicoevergara) 188 | - [Scheduling routine tasks on your crontab](http://kvz.io/blog/2007/07/29/schedule-tasks-on-linux-using-crontab/) 189 | - [Passing command-line arguments to python](https://docs.python.org/3/library/argparse.html) 190 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 |This is where I put all my mysterious & undisputably dope content!
10 | 11 |