DEV Community

Aaron McCollum
Aaron McCollum

Posted on • Originally published at

Three nifty shortcuts on the Command Line

The command line is a very useful tool to use to navigate and perform actions on your computer. You can find it by opening the ‘Terminal’ application on your Linux or Mac computer, or by opening the ‘Command Prompt’ or ‘Powershell’ applications on your Windows machine. Today’s article will only apply for Linux and Mac users and will not be written for Windows users (since the command vocabulary and syntax will be different).

Here are three shortcuts that are useful using the command line:

  1. Typing in a period “.” is a shortcut for opening all the files in the current directory you are in. If you navigate to your project folder and type code . it will open all the files at once in VS Code (if VS Code is downloaded). This is useful when you are opening your project to continue working on it – why click on all the multiple files once at a time on your GUI when you can open VS Code and all your files at the same time?

  2. You can automatically open VS Code by typing code in your terminal. This should be automatic for Linux users, however for Mac you can set this shortcut up by opening VS Code, using the cmd+shift+p combination to open up program commands, and clicking Shell Command: Install ‘code’ command in PATH. This will allow you to open VS Code on Mac with the code command in your terminal.

  3. Using the tab key can auto-complete the command in your terminal. This only works once you have typed in enough information manually for the terminal to have only one option to choose from. But this can save you time and potential headaches by reducing typing errors in your terminal.

  4. Bonus! You can create multiple files at once by using the touch command with various new file names after it. You will need to separate out each new file with a space. If you are just starting web development, this is a great shortcut for creating your HTML, CSS, and JavaScript files at the same time. Example: touch index.html style.css script.js

I’m still at the beginning of learning the terminal, however I found these shortcuts to be pretty awesome and will be inserting all of them into my work flow this week. If you have any additional shortcuts, I’d love to hear about them!

Discussion (0)