August 21, 2024

Navigating and Creating New Folder and Files Using Terminal

Warp is currently my terminal of choice. It's the first terminal I started using when I started coding a month ago. I found the default mac terminal not even worth trying out.

Commands

These commands help me navigate to the main folder for my projects and create a folder with an HTML, CSS and JS file.

  • `cd ~/Desktop/"01. Projects"/Coding/"01. freeCodeCamp JavaScript"`
  • `mkdir dietguage && cd dietguage && touch index.html styles.css script.js`

Detailed

Here's a detailed explanation for the commands, and some more commands that come in handy.

  • `cd` (change directory) to go to the root folder, if not there already. `cd ..` to back one directory
  • `cd/~Desktop` to go to Desktop
  • `ls` (list) to view list of folders (directory) and files in the current directory
  • `cd ~/Desktop/"01. Projects"/Coding/"01. freeCodeCamp JavaScript"` to go to my main coding project folder.
  • `mkdir folderName` or `mkdir "folder name"` (make directory) to create a folder
  • `cd folderName` to go the created  folder
  • `touch index.html styles.css script.js` to add files in the current folder
  • One or more commands can be combined with the `&&` operator between the commands. Eg. `mkdir dietguage && cd dietguage && touch index.html styles.css script.js`