Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

The Tools for Learning Puppet: Command Line, VIM & GIT


Published on

Get some cheat sheets and a short guide to additional references for learning command line, Vim and Git...with cats.

Get the full ebook with tutorials for learning command line, Vim and Git at

Published in: Software
  • Be the first to comment

  • Be the first to like this

The Tools for Learning Puppet: Command Line, VIM & GIT

  1. 1. The Tools for Learning Puppet A SlideShare guide to getting started with command line interface, Vim and Git
  2. 2. Here’s a quick reference guide of basic commands and shortcuts for the common tools that Puppet users work with on a routine basis — command line interface (CLI), Vim and Git. Keep this SlideShare handy, and for more details on using these tools, see the full guide to getting started with Puppet in our downloadable ebook, The Tools for Learning Puppet. So you want to learn how to use Puppet? Perfect!
  3. 3. The 3 tools to train on: Command line (interface) Vim (text editor) Git (versioning control)
  4. 4. Command line is the language used to communicate with the computer through the keyboard, rather than through a mouse-icon interface. Think of the command line terminal as a chat room/instant message conversation between you and your computer. Command line (interface)
  5. 5. Command line 5 things to remember 1. Press Enter after each command or nothing will happen. 2. If you ever get lost in the terminal, don’t panic. Just use pwd to show your current location, or present working directory. 3. If you are completely lost, or just want to go back to the home directory, use the cd command. 4. When creating new files, remember to add the file type at the end of the new file name, like this: new_file.txt. 5. There are many resources for help with CLI when you are stuck or confused, including StackOverflow and FossWire’s Unix/Linux command cheat sheet.
  6. 6. Command line Basics & common commands pwd show present working directory mkdir make a directory/folder in the location cd change directories — allows movement from one directory to another; goes to home directory if no directory specified after command cd.. change directory one level up ls shows a list of all the files and folders in the current directory. cp copy file mv move/rename file
  7. 7. Vim (open source text editor) You are going to need a text editor for any computer you plan to use for programming. Technically you could use Notepad, but don’t use Microsoft Word, or similar programs used to type up documents — these programs actually put invisible code around your words to format text and make it look pretty. This formatting code will get jumbled with the code you are writing, making for an angry kitty.
  8. 8. Vim (open source text editor) Instead of a graphical user interface (GUI), where you click an icon around to do things, Vim uses a text interface. This means you’ll save a lot of time by not moving and clicking the mouse constantly, but you will have to memorize (or make a cheatsheet of) keyboard shortcuts to make things happen.
  9. 9. Vim 5 things to remember 1. Vim is in its Normal mode when it begins with an intimidating black screen. This mode is for taking action to a file. Enter Insert mode with i to type within the file. 2. While in Insert mode, you can move the cursor below a character you want to delete and then use the X command. Remember that dw deletes the whole word. 3. If you are unhappy with the changes you made, use command ZQ to exit Vim without saving the bad changes. 4. You can copy text from one section and paste it to another section with the y, or yank, command. Other options for yanking are available, like yy to yank the whole line. 5. Vim has a built-in tutor that you can access by typing vimtutor -g. It will give you some practice and teach you the next few steps.
  10. 10. Vim Basics & common commands i Insert mode enabled :w Write file and save — :w newfilename.txt will save as a new file :q! Quit (yes, I’m sure) :wq! Write file, save file, and quit (yes, I’m sure) ZZ Quick save and quit ZQ Quit without save cat “concatenated” — combine files or copy contents between files cat ball_of_yarn.txt calls up contents of file ball_of_yarn.txt
  11. 11. Vim Basic commands: moving around h Move cursor one space left w Move forward one word j Move cursor one line down b Move back one word k Move cursor one line up 0 Move to beginning of line l Move cursor one space right $ Move to end of line gg Move to start of file G Move to end of file Multiply any of the above commands with a number. For example: • 3h — move 3 characters left • 10j — move 10 lines down • 3b — move back 3 words • 2$ — move to t he end of the line below the cursor
  12. 12. Vim Basic commands: making the things happen v — Enter visual mode for moving cursor around to make selections i — Enter insert mode for making changes to selections u — Undo previous; ctrl+r — Redo previous X Delete/cut character at cursor y yank (copy), ends selection dw Deletes a word yy yank full line dd Delete full line yap yank all paragraph d% Delete from cursor to line end p Paste last yank/cut at cursor dgg Delete from cursor to file start /text phrase Enter: Find phrase. Use n to move to next instance, N for previous
  13. 13. Vim Advanced command: Find & replace :%s/old text/new text/gc Enter Initiate command; search entire document; find old text and subsititute new text for it; check each instance and confirm. : Enter Command mode % Perform on entire document (replace % with numbers to search lines) s Substitute g Global c Check (at each instance, respond with y — yes, n — no, a — all, q — quit)
  14. 14. Git (versioning control) Git keeps track of all changes you make to your files and enables you to share your code, allowing it to be used on any computer. You can create several copies (branches) of your original file, make changes to each of the branches, and then seamlessly merge everything back together into the original file (called a repository or repo). An easy way to think of using Git for versioning: Packing for a trip!
  15. 15. Git Basics When you pack, you lay out (stage) all your items on the bed (working directory) until you have everything you need. Then you fold your items and pack (commit) them in your suitcase (repo). git init turn working directory into repository git add FILE_NAME.txt stage file, to be added to repo on commit git commit commit all staged items to new version; prompts for comment about changes git commit -m ‘added sandals’ skip going into Vim, and add text inside quotes as your commit message
  16. 16. Git Basics You’ll also want to add an ID tag to your suitcase so people know whose luggage it is. You do the same in Git by globally applying your username and email address: git config --global your_name git config --global
  17. 17. KitTub GitHub (versioning control) GitHub is the website that runs Git, the open source version control system. It is where you can write or upload code right in the browser, and allow others to use and contribute to that code. You can create your own account and start using Git at For more on using GitHub to work with others, see the guide, The Tools for Learning Puppet.
  18. 18. Git Whenever you git init or git clone a repo, that repo is called the origin. Within a repo are branches, and the first branch is called the master branch. To make changes without affecting the master branch, create a new branch. git branch new_branch create a new branch (use any name you like for your new_branch) git checkout new_branch lets you begin making changes to the new branch git merge new_branch pushes everything in the new branch to the master branch git push origin master push changes from new branch to master repo on GitHub git branch -d branch_name delete a branch
  19. 19. For more instruction on using command line, Vim and Git — and more cat photos — check out our full guide, The Tools for Learning Puppet at And if you need more catnip after the full guide, check out the resources on the following slides. That’s it for meow!
  20. 20. Resources General / Puppet-related Download VirtualBox so you can host a VM on your computer. It’s free! Download the Learning Puppet VM — also free! • If you’re looking for enterprise-level configuration management software that’s fully tested, scalable and fully supported, you can download and try out Puppet Enterprise for free. • Once you’ve downloaded Puppet Enterprise, learn foundational Puppet concepts and best practices for managing your infrastructure with Puppet Fundamentals. • Learn how to manage all aspects of a Windows system configuration with Puppet Enterprise, leveraging existing Puppet modules with Puppet Essentials for Windows. • Learn Code the Hard Way: Slightly sassy dude tells you to, “Shut up and shell.” • The Puppet blog has lots of helpful technical posts
  21. 21. Resources Command Line Interface Linux • Learning the terminal: Let Lifehacker help you choose a Linux terminal emulator. • Learning the Shell — A darn good resource to learn Linux, period. Cheat sheets: • Dave Child’s Linux command line cheat sheet • Linux command line reference for common operations • Linux bash shell cheat sheet Windows (Powershell) • Get instructions for installing and getting started with Powershell. • Check out the Learn and Library sections on
  22. 22. Resources Vim & Git Vim • Vim has a built-in tutor that you can access by typing vimtutor -g in the VM command line. It will give you some practice and teach you the next few steps. • Vimdoc — The manual written by Bram Moolenaar, the author of Vim. If you want to jump straight to the review and new stuff, go to this page. Git • Git cheat sheet — A cool interactive cheat sheet to learn the different places where you do things or put things in a Git workflow. It’ll show you some useful next-level commands, which you can then review more thoroughly with git help <command name>. • Git Tutorial — A good reference for visual learners from Atlassian (which makes Bitbucket, an alternative to GitHub). • Pro Git — The entire Pro Git book written by Scott Chacon. Scott goes into far more depth than what is covered here. Thankfully, this wonderful resource is available for free.