04 Making Directories and Understanding Filepaths
- Creating Directories with
mkdir
mkdir
(Make Directory) creates new folders.- Requires an argument (folder name) to specify the directory to create.
- Can create folders using relative paths (within the current location) or absolute paths (specifying the full location).
- Absolute vs. Relative Paths
- Absolute Paths begin with
/
, referencing the root of the file system (e.g.,/home/sandbox/Desktop/Folder
). - Relative Paths do not start with
/
, assuming the current directory as the starting point. - Knowing whether to use an absolute or relative path is crucial for efficient navigation.
- Absolute Paths begin with
- Verifying Directory Contents
ls
lists the contents of directories.- You can check the contents of a directory without navigating into it by using
ls <directory-path>
. - Tab completion (
Tab
key) helps avoid typos when typing long paths.
- Navigating and Understanding File Structure
- GUI requires navigation to a folder before creating files, but the command line allows creation anywhere.
- Tilde
~
represents the user's home directory, making it a shortcut for specifying locations.
Next in Playlist: 05 Moving and Copying