Intro to the command line

785 views
688 views

Published on

Presented to attendees of RailsGirls Sydney Nov 2013.

The command line. Developers' attitudes and common usage. How to improve your experience with it, from a beginner's perspective.

Published in: Education, Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
785
On SlideShare
0
From Embeds
0
Number of Embeds
36
Actions
Shares
0
Downloads
16
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Intro to the command line

  1. 1. The Command Line Your next best friend that you kinda still hate
  2. 2. What is it? • Windows: cmd.exe
 
 C:Usersmyusername>
 • OSX/Linux: Terminal
 
 
 
 computername:~ username $

  3. 3. What is it?
  4. 4. What do programmers use it for? In order of most frequent to least frequent: git git git git git git git git git git git status
 grep
 diff
 add
 log
 checkout
 commit
 push
 pull
 show
 rebase
  5. 5. What else? rails rails rails rails new myapp
 g model Blog title:string
 console
 db

  6. 6. What else? rake routes
 rake db:setup
 rake db:migrate

  7. 7. Much Less Frequently brew install rename # Mac
 gem install rails
 gem list -d
 gem list -r
 bundle
 rvm use 1.9
 rvm use 2.0

  8. 8. Why should I care? One year from now you can automate your whole job... git log $(git merge-base master branch)..branch cut -f1,2 -d’ ’ ~/.bash_history | sort | uniq -c | sort -nr | head -n 30 wget -mk http://www.stuff.to/read/on/the/train/ rsync -rvP myproject/ username@myhost/myproject.com/ pg_dump --clean -Z 9 app_master | ssh user@apphost ‘zcat | psql -h localhost -U app appdb’
  9. 9. Don’t Panic
  10. 10. Basics cd projects/railsgirls/ cd .. pwd ls -l # # # # change into a directory
 get out of a directory
 print current directory 
 list the files here ! • • Pay attention to the “current directory” • Press tab to complete filenames Press the up and down arrows to run previous commands
  11. 11. Get Unstuck man wget
 (spacebar for next page, q to quit) rails --help Most reliable: Google “wget command”
  12. 12. Stay Focused As a Rails developer, there are only a handful of commands you’ll use regularly. git
 rspec
 rake
 rails
 gem
 bundle
 irb
 ruby
 subl / vim
 open
 sudo
 ssh

  13. 13. Next Steps Incrementally improve your
 command line capability
  14. 14. git config --global color.ui true
  15. 15. echo "alias ls='ls -ohG'" >> ~/.bash_profile
  16. 16. Shortcuts up, down, tab up, down, tab up, down, tab up, down, tab up, down, tab
  17. 17. Ctrl-A Ctrl-E Alt-Delete 
 start of the line
 end of the line
 delete previous word
 
 Works virtually anywhere! * ** * Terminal, Chrome, Sublime, Evernote, Keynote, XCode, LibreOffice, System Preferences, Gnome, KDE, XFCE4…
 ** Windows? Not sure.
  18. 18. More Shortcuts Ctrl-C Ctrl-R Alt-B Alt-F Alt-D stop current command (e.g. rails server)
 search for a previous command
 go back one word
 go forwards one word
 delete next word
  19. 19. Ctrl-R 1. Ctrl-R 2. Start typing (e.g. type “rebas”) 3. Ctrl-R to jump to next oldest match 4. Ctrl-S to jump to next newest match 5. Return to run, Esc to cancel
  20. 20. Configure Terminal
  21. 21. Configure iTerm2
  22. 22. Text
  23. 23. There Must Be a Better Way! There usually is
  24. 24. @gregmcintyre microcourses.info

×