Windows users should download PuTTY:
http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
- Why bash is important to know
- Understanding the directory structure (tree)
Remember how, on your Desktop, you can manipulate files and folders?
The entire filesystem for your computer is just a MASSIVE tree of folders and folders with files along the way.
Notable Directories
- Root "/" - The single folder at the core
- Home "~" - The folder containing everything for your user
- Working "." - The current folder you're in
...also, I'm gonna refer to folders as directories here on out.
Got that shell open? Time for some basic navigation!
- ls - list directory contents
- cd - change working directory
- touch - change file access and modification times (creates a file)
- rm - remove directory entries
- cp - copy files
- mv - move files
- clear - clear the terminal screen
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.
For example: sure, ls lists directory contents but what if I want to see hidden dotfiles? I can include the -a option:
ls -a
Want a "long" listing with lots of additional system information?
ls -l
But how do we familiarize with all of these hidden options? ...I'm glad you asked.
- man - format and display the on-line manual pages
Before we move on, you should copy this document onto your desktop:
curl --location goo.gl/NU44jC > ~/Desktop/unix.txt
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.
I got you. -Steven Kneiser
Finally! Time to do something both tangible and dope. First thing we're gonna do is remote into a school server:
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:
mkdir web
cd web
This seems like the PERFECT place to dump my mysterious & undisputably dope file:
curl --location goo.gl/W5GHZd > index.html
Rubs hands together with a devilish grin
Now before I give anything away, I want you to run these two commands:
chmod -R a+rX ~/web
chmod 701 ~/
Congratulations, you've officially setup your very own student homepage! Don't believe me? Visit:
cse.msu.edu/~your_net_id
- ls & cd
- touch & rm
- cp & mv
- mkdir & rmdir
- cat & editors (nano, vim, emacs)
- understanding flags
- tab-completion & clear
- finding help (man, apropos, ...then google)
- piping
- less/more & head & tail
- grep
- sort & awk & wc
- find
- reading access rights
- chmod
- sudo & su
- jobs (listing and suspending)
- fg & bg
- ps
- sending signals
- environmental variables (echo & printenv)
- .profile's & rc's (SHELL-DEPENDENT)
- aliases & functions
- SSH & simplifying (.ssh/config)
- package-management
- keyboard shortcuts (reverse-i search)
- curly brace completion
- bash scripting
- crontab