Final Notes
This video explains why I typically use Camel Case in the command line, and how to work with files and folders that contain a "space" character
Why I typically use Camel Case in the command line
As I mentioned in the section on renaming folders, I use "Camel Case" almost exclusively in the command line (with the exception being when dealing with websites, whose files and folders should always be all lower case for best compatibility). The reason I use "Camel Case" is that the "space" character is used to perform various functions in the command line.
You've actually already seen this in action during this series, but to demonstrate more clearly, I'll make a copy of the Tested.txt file and name it "File1.txt" and I'll make a new directory named "Example".
The commands I'll use are these: "cp Tested.txt File1.txt"
and: "mkdir Example"
Now, we can utilize the "space" character to delete the new folder and the new file in one command. I'll still use the "rm -rf" command, but this time I'll tell it to delete both of them at the same time by separating their names with a space.
The command I'll use is this: "rm -rf Example File1.txt"
If you aren't aware of the "space" character's special function, you might think that I deleted a single file named "Example File1.txt", but as we saw, I actually deleted a folder and a file.
Including spaces in file names
You can include white spaces in file and folder names as long as you escape the "space" character. To demonstrate, I'll make a copy of the "Tested.txt" file and name it "Tested Backup.txt" (with a space between the words.)
The command I'll use is this: "cp Tested.txt Tested\ Backup.txt"
You'll notice the "\" before the space. That tells the terminal that I want to include an actual space in the file name.
we can view the new file with the "ls" command, but "ls -al" makes it more obvious that the space is in the filename.
To delete files with a space, you also need to escape the "space" character (so that you don't delete more than one item like we did in the last section). I'll delete this file to demonstrate.
The command I'll use is this "rm Tested\ Backup.txt"
Now, when we type "ls" we'll see that the file is gone.
This is why I usually stick to "Camel Case" when working in the command line.