The Command Line

Viking Code School

Web Development Basics

  1. What is the command line?
    A way to communicate with your computer by typing in lines of text.
  2. How do you open it on your computer?
  3. What is Bash?
    Bash is a Unix shell and command language
  4. How can you navigate into a particular file directory?
  5. How can you create a directory?
  6. How can you destroy a directory or file?
    rm test.html
  7. How can you rename a directory or file?
    mv test.html index.html
    test.html being the original file name
    index.html being the new file name
  8. Why are file permissions important?
    To keep your data secure.
  9. How do you view hidden files in a directory?
    ls -a
  10. How do you find information about a particular command?
    <command> –help
  11. What is a “Superuser” and how do you execute commands as this user?
    Execute commands as a superuser using ‘sudo’.
    This permits a user to execute a command as another user.
  12. What is Vim?
    A text editor in your Terminal
  13. How do you quit Vim if you get stuck in it?
  14. What is the .bash_profile file and what is it used for?
    Bash will check .bash_profile to get more details of the user like user specific environment and startup programs.
  15. What is the $PATH variable?
    It specifies the directories in which executable programs are located on the machine so that they can be started without knowing the whole path to the file in the command line.
  16. Why might you need to add onto your $PATH variable?
    So that you can list multiple programs and start them without knowing the whole path to the executable file in the command line.
  17. What are alias commands?
    Commands you can save to a shortened string.
    Like if you are tired of typing ‘pwd’ all the time, you can set an ‘alias p = pwd’ so now you just need to type ‘p’.

Vim on Windows 10

I’ve just installed Vim on Windows 10. I’m completely new to Vim so if you have any great resources for learning, please leave a comment!

Vim is a text editor for your Command Prompt (or Terminal).

To install Vim on your Windows machine, you will have to download the executable file here.

To start up Vim, you can open your Command Prompt and type vi

Vim commands:

  • Switch between command mode and insert mode.
    • To switch from command mode to insert mode and insert text at the current cursor position, pressi.
    • To switch from command mode to insert mode and insert text at the beginning of the line, pressI.
    • To switch from command mode to insert mode and insert text at the end of the line, press A.
    • To switch from insert mode back to command mode use Esc.
  • Opening new lines
    • To open a new line after the current one and begin inserting text (switching to insert mode) use o.
    • To open a new line before the current one and begin inserting text (switching to insert mode) useO.
  • Navigating in the source using hjkl
    • Navigate up a line, press k.
    • Navigate down a line, press j.
    • Navigate left a character, press h.
    • Navigate right a character, press l.
  • Save
    • To save current edits use :w (short for write).
  • Exit
    • To exit, type :q (short for quit).
    • To save and exit, type :wq.
    • To force exit without saving, type :q!.
    • To force save and exit, type :wq!.
  • Undo
    • To undo last edit use u.
  • Redo
    • To redo use CTRL + r.
  • Copy and paste
    • To select a block of a text, Ctrl + v to switch to the visual mode, then select a block using the directional keys (hjkl).
    • To copy the selected block, yy (yank line).
    • To paste the selected block, p (paste).
    • To paste before cursor,P.
  • Tab complete
    • To use tab completion, CTRL + p.
  • Move to beginning and end of a file
    • To move to the beginning of the line, 0.
    • To move to the end of the line,$.
  • Substitute/Replace
    • To substitute the character under the cursor, type r followed by the character you will substitute.
    • To switch to replace mode use Shift + r and start typing.
  • Combine operators (like delete) with motions (like end of word)
    • As mentioned, Vim commands are composable. So you can combine operations like delete/change/copy with motions like beginning/end of word/line.
    • To delete to the end of the word, type dw.
    • To delete to the end of the line, type d$.
    • To delete the text within quotes, double quotes, parentheses, brackets use di', di", di(, di{, respectively.
    • To copy to the end of the word, type yw
  • You can type a number before the command to execute it multiple times
    • To delete 4 lines, type 4dd.
  • Repeat last command by typing ..
  • Jump to specific position in a file.
    • To jump to the beginning of a file use gg.
    • To jump to the end of a file use G.
    • To jump to the specific line in a file use 8gg (8 is the line number).
  • Search forward and backward.
  • Match parentheses and brackets.
    • To match the current parentheses or bracket use %.
  • Split horizontally and vertically.
    • To split the screen horizontally use :sp.
    • To split the screen vertically use :vs.
  • Switch between splits.
    • To switch to the next split screen use CTRL + ww.
  • Jump forward and backward.
    • To jump forward a page use CTRL + f.
    • To jump backward a page use CTRL + b.
  • Modify your environment via dotfiles.
    • You can do that after reading this tutorial 🙂 An easy way to edit your .vimrc file is :e $MYVIMRC.
  • Execute a shell command.
    • To execute a shell command simply type :sh followed by the command.

 Here is a cheat sheet for all commands:

This getting started guide by SitePoint provided the above information and goes more in-depth.

Vim Tutorial

How the Web Works

Viking Code School Prep Work Q’s

Web Development Basics

  1. What is the internet?
    The internet is just billions of computers connected through wires run all over the Earth.
  2. How is information broken down and sent?
    Information is sent in packets to an IP address.
  3. What are packets?
    Packets are small bits of information sent over the internet.
  4. What is a “client”?
    You! Your browser or computer. Something that’s able to communicate with a server.
  5. What is a “server”?
    Server is where information is stored.
  6. What is HTTP and how does an HTTP request work?
    Hypertext Transfer Protocol. Protocol browsers and servers use to communicate. Browser will send a GET message across the internet when you enter a web address.
  7. What are DNS servers?
    Domain Name Servers are like a phone book. They hold all the domain names and match them with their IP addresses.
  8. What is HTML and how is it used?
    HTML (Hypertext Markup Language) is used to identify and display content.
  9. What is CSS and how is it used?
    CSS (cascading stylesheets) is used to style content.
  10. What is your browser’s Web Inspector (aka Developer Tools) and how can you use it to poke around in a page’s HTML?
    I use Chrome to see what the content and styling is for each HTML element
  11. What happens behind the scenes after you click “search” on
    Great explanation here:

    Unnamed QQ Screenshot20151209030654