This week’s quick guide is a further practical exploration of the filesystem navigation of our most recent episode. In this one, our goal is instead the crude creation and manipulations of files within that filesystem. We cover a lot of stuff, but seeing someone doing this stuff with your own eyes if often the best way to really get a handle on it. The video:
The Commands We Used
mkdir foldername
We use mkdir to make a few different directories in this video. Basically it just makes a directory when passed the name. In the example above, that would be foldername
, but that could obviously be anything.
touch file.ext
Touch is a simple command that creates a file you specify. Per common convention, your argument will generally be a filename, a period, and a file extension.
cp original.txt copy.txt
Copy a file from an old location to a new one. The biggest gotcha here is if you want to move a folder which has contents, you’ll need to use the -r
flag. The video goes into more detail on this.
mv orginal-name new-name
The move command is easier to understand as “rename”. But it does just that, changes the name of a file or folder when invoked.
rm file.ext
rm
is how you delete a file. If you need to remove a folder, as with cp
you’ll want to use the -r
flag if that directory has anything inside of it.