Langsung ke konten utama

Command Line Basics


The command line (Terminal on a Mac, Command Prompt on Windows) is your window into your computer and your home base for doing development work. It's how you'll be able to jump between files and directories, open stuff up, run simple scripts and check the status of things.

The Command Line is fully text-based, so you'll need to type everything in and can pretty much forget about the mouse.

Graphical User Interface

We often access computer programs through their Graphical User Interface (or GUI, for short). This is simply the visual component of a computer program.
For instance, word processing software (Microsoft Word, Google Docs, etc.) generally offers a GUI with whitespace to type in, a cursor to indicate where we're typing, and a variety of buttons, menus, and options to format our text. This is a GUI. It's the visual portion of a program we see and interact with.

The Terminal

However, when we are developing code we often use our computer's terminal interface. The terminal is an area of the computer that allows us to do things (like create or delete a new file) with text-based commands, instead of by clicking options in a graphical user interface. These text-based commands are typed into something called a command line.

A graphical user interface (GUI) allows users to interact with a computer through menus, buttons, and other visual options on the screen. The terminal, on the other hand, allows us to interact with a computer by typing text commands directly into the command line, which is housed in an area of the computer called the terminal.

The Prompt

When you first open the terminal, you should see a short snippet of text followed by a grey or blinking rectangle. This rectangle is your cursor. Where the cursor is located is the command line. The command line is where we will type and execute our text commands.

First, a few notes about the command line:
  • Whenever we talk about the command line, we'll use the dollar sign $ to indicate the prompt. If you need to type something, only type the stuff after the dollar sign. For instance, if we say to type $ echo "hello world", you just type echo "hello world". Often there is other information to the left of the prompt (which we'll help you set up shortly), so it's conventional to abbreviate the prompt as $.
  • Type commands directly after the prompt and hit enter to execute them.
  • Many commands will have options that you can specify, which are preceded by a dash -, e.g. $ ls -a, where -a is an additional option for the ls command. Options are, well, optional, so you don't always see them.
  • Many commands will take arguments, which come after any options (if present).
  • When you run commands, there is rarely any feedback that you were successful. If the prompt just shows up again on the next line, that's a good sign -- it was successful. This takes some getting used to!
  • Capitalization matters! Documents and documents are not the same thing.
  • Spaces matter! You'll quickly learn to omit spaces in your file and folder names because they're a pain to type on the command line -- you have to "escape" them with an extra backslash \, so My Folder Name becomes My\ Folder\ Name. Otherwise it'll think you're passing multiple arguments or commands.

The snippet of text left of the cursor is the command line prompt. It contains brief contextual information, such as the user account you're logged into the computer with, and your current location.

epicodus-5:~ Guest$

In the example above:
  • epicodus-5 is the nickname of the computer we're using.
  • ~ denotes that our current location is the home directory. (In programming, the ~ symbol usually refers to 'home'.)
  • Guest informs us we're logged into an account named Guest.
  • This is all followed by a dollar sign $. This symbol denotes the end of the prompt and the beginning of the command line.
  • Command Notation
  • When command line commands are written, they are often preceded by a $. This means the command is meant to be executed in the command line. The dollar sign is the common notation to communicate this because, as we just learned, most terminals display a dollar sign $ at the end of their prompt, like this: epicodus-5:~ Guest$.

When you see this symbol preceding a command in one of our lessons, know that you are not required to literally type a dollar sign into the command line. You will only type the command listed after the dollar sign. The dollar sign simply denotes that the command is meant to be executed in the command line.


Terminology
Graphical User Interface (GUI): An interface that allows users to interact with the computer through graphics and buttons and other visual, dynamic options.

The Terminal: The area or program in our computer that allows us to access the command line.

Command Line: A text-based interface that allows users to interact with the computer by entering text commands at a prompt. Also known as the terminal interface.

Terminal Interface: Another name for the command line.
Prompt: The portion of text that precedes the cursor in the command line. It provides contextual information, including the account you're currently logged into the computer with, and your current location in your computer's directories. The prompt and command line are separated by a $ symbol.

Tips
When you see this symbol preceding a command, know that you are not required to literally type a dollar sign into the command line. You will only type the command listed after the dollar sign. The dollar sign simply denotes that the command is meant to be executed in the command line.

Overview
A graphical user interface (GUI) allows users to interact with a computer through menus, buttons, and other options we can see on the screen. The terminal, on the other hand, allows us to interact with a computer by typing text-only commands directly into the command line.

Komentar

Postingan populer dari blog ini

Introduction to Web Development

Web developers, the people responsible for coding, building, analyzing, and maintaining all those websites. In short: web developers build and maintain websites. Web developers will often work for clients who are trying to get their product/service onto the web.   Types of Web Developers Front-End Developer The “Front End” is the stuff you see on the website in your browser, including the presentation of content and the user interface elements like the navigation bar. The front end of a website is the part that users interact with. Everything that you see when you’re navigating around the Internet, from fonts and colors to dropdown menus and sliders, is a combo of HTML, CSS, and JavaScript being controlled by your computer’s browser. Front-end developers are responsible for a website’s user-facing code and the architecture of its immersive user experiences. In order to execute those objectives, front-end devs must be adept at three main languages: HTML, CSS ...

The Web

Internet: The internet is a network of linked computers from around the globe. Each of these computers communicate with each other in a specific format. Packets: Packets are the information of the internet. Packets are sent from the sender to the receiever in a specific format which contains all the information needed to communicate. The differences between a webpage, web server, web browser and search engine: A webpage is the page you look at in your browser. A web server is the computer that has the code for how the webpage should look and act. A web browser is a program on a computer that displays the web page. A search engine is a web server that searches all other web servers for information. A user can then pull up the webpage on their web browser and search for a site. Clients: A client is the computer or internet device that requests information from the server. Server: A server is the computer that rece...