What is the command line used for in web dev?

I learned the basics of git bash but i don’t fully understand what I will be using the command line for, what are some practical applications of the command line in web development?

The command-line interface is a tool into which you can type text commands to make the computer perform specific tasks in contrast to using a graphical user interface through pointing and clicking on menus and buttons with a mouse. Hope this Helps! :smile:

what would be an example of those specific tasks in web development? Thanks in advance :smiley:

Hello!

I would say there’s two especially common examples:

  • Quite often when doing projects (particularly larger, more complex ones) you would use a tool like Git & GitHub to store and manage different versions of your code, now while there are GUI versions such as GitHub Desktop, the main way you would interact with Git is via executing commands though the command line, i.e git push publishes your code up it’s respective GitHub repository.
  • When you want to run a JS file locally (i.e not on the browser directly), then you’ll have to use a tool like Node.JS that runs on your PC and is interacted with entirely though the command line (i.e node file.js runs the JS file file.js). This is especially relevant with frameworks like React as they cannot run directly in the browser and must be compiled locally first (which again is done though the command line).

Happy coding! :slight_smile:

When you are a (back end) developer and your website/application crashes the terminal/command line becomes your invaluable friend.
Example: you go to your website url and see a blank white page. You open up console.log and it is empty. You still want to find out what whent wrong. Opening up the command line and looking into the logs can help you determine the issue.

2 Likes

In addition to all of the above answers, I’d like to add that the command line is something you don’t think you’ll use that much when starting out, but becomes an invaluable resource as you progress, regardless of the language. In C++ you can use the GNU compiler, for JS you can run files locally using node, for Python basically everything is done command line unless you build your own GUI.

The benefit of a GUI is that things are visual, easy to see and tell what’s going on, the drawback is it takes significantly more processing power than using the command line. Take Github for example, by the time you have loaded onto the browser, logged in, navigated to the correct project, and added the new files, you could have uploaded it three times over using the command line. It’s worth learning the commands like git push, git commit, git checkout etc as once they are in your toolbox you’ll never know what you did without them.

3 Likes

Makes sense, thanks!

1 Like