Shells provide a command-line interface for running operating-system programs and development tools, analogous to browser consoles for JavaScript. Node.js runs JavaScript outside browsers, enabling server-side scripts and various development tasks. File system paths locate files and directories using absolute paths (full locations) or relative paths (interpreted from a current directory). Unix-like systems use forward slashes (/) while Windows commonly uses backslashes (\\) but also accepts slashes. Combining a current directory path with a relative path yields an absolute path. Example relative paths include main.js and ../notes.txt. Examples are available in the learning-web-dev-code GitHub repository.
A shell is like browser console, but for the operating system instead of for JavaScript. It helps us with programming by running the tools (programs) we need to get things done. Node.js is a program that lets us run JavaScript code outside browsers - which we can use for a variety of things.
Let's quickly review how file system paths work. They specify where files and directories are located. There are two kinds of paths: absolute paths and relative paths. Absolute paths directly specify where a file is located - e.g., the following absolute paths refer to the home directory of a user robin (where their own files are stored; each user of a computer has such a directory): We can see that the Unix operating systems MacOS and Linux separate path segments (names of directories with potentially a file name at the end) with slashes (/) while Windows uses backslashes (\). Windows is also accepts slashes as separators, which is why we often use slashes from now on.
Roughly, relative paths are paths that don't start with C:\ (Windows) or / (Unix). They are interpreted relative to the absolute path of a current directory. If we combine the path of the current directory and the relative path, we get an absolute path and therefore a precise location of a file or directory. These are examples: Refers to a file in the current directory: main.js Special relative path the refers to the parent of the current directory: ..Refers to a file in the parent directory: ../notes.txt
Collection
[
|
...
]