Most people are scared when they first see black command line with blinking cursor and zero information. Here you will learn basic commands in command line to simplify your web development workflow.
Here are some typical things that you do with command line:
- starting your web server
- using framework tools to generate new components or modules
- run any scripts
- using git with every project
- install packages, libraries, programs
So first of all you need a command line. In linux and mac you have a good command line by default but not in Windows. There you need to install additional program like cmder or git bash which are 2 most popular solutions to get nice console.
The most useful command is pwd which means "print working directory". It's especially useful for beginners if you don't understand in what folder you are.
Now we need to learn how to move between folder. For this we have cd command. All command work with relative path or absolute path. If we want to jump 1 folder up we put .. after cd.
You can check where you are with pwd again.
if we want to return back to our child directory we type the name of it.
We also want to see the list of files and folders in the current directory. For this we have ls or list.
We might want to create a new directly. For this we have mkdir command.
and create a new file.
Obviously for most people it's more comfortable to create files and folders in their editor which is fine.
Really often we want to remove a file or a folder. For example node_modules.
rm test.js rm -rf node_modules
Here rm is used to remove and we provide attributes r for recursive remove and f to remove folders also
Sometimes we want to copy the file
cp test.js test2.js
Again in all commands you can use any path. Either relative or absolute.
If we want to copy a directly we need to add a recursive attribute.
cp -r foo bar
This will copy a folder with all files recursively.
If you want to move a file or folder you just use move command.
mv test.js foo
This will put test.js file inside foo folder.
One more important thing is tilde. It is a reference to your home directory which can simplify the commands that you run.
Goes to my home directly. Also you can use it while writing path for any other commands like cp, mv, rm.
And the last thing that you might need is actually a way to change file in console directly. You can use for this nano editor which is available there by default
To open a file with nano we can write
Change it like in normal editor and click ctrl+o to save and ctrl+x to exit. Or if you don't need to save it just ctrl+x.
So this were basic commands which you need to know to work with command line.
Also if you want to improve your programming skill I have lots of full courses regarding different web technologies.