Working with Files and Directories
Moving between Directories
When working with your terminal, you can move between directories using the cd
command.
Examples
cd github-projects
Above code will move to the folder named github-projects
cd ..
The above code will move out of your current folder.
cd github-projects/iris/project-one/project-one-point-three
The above code will move to the folder named project-one-point-three
Creating a directory
You can create a directory with the mkdir
command.
Examples
mkdir project-from-iris
The above code makes a directory named project-from-iris
mkdir projects/some-project
The above code makes a directory names some-project inside of a new directory named projects.
Removing a folder
The command for removing something is rm
but you can change its way of working by adding flags. To remove just a folder, use the -rf
flag.
Examples
rm -rf project-for-iris
The above command removes the folder called projects-for-iris.
Creating a file
You can create anything with touch
. Just be sure to add the file name and its file extension.
Examples
touch text.txt
touch script.js
touch index.html
Deleting a file
You can delete the file with the rm
command, you do not need to use the flag.
Example
rm text.txt
The above command removes the text file named text