By the end of the lab, you should be able to navigate the file system using the CLI, manage files and directories, manipulate text files, understand basic file permissions, and utilize process management commands.
Reminder: All file system names a case-sensitive.
Now, let’s practice adding and removing files and directories using the CLI.
mkdir
- Make Directoryrmdir
- Remove Directoryrm -r
- Remove Directory and its contents recursively. WARNING: This is going to delete the directory and everything below it recursively. Linux does not have ‘undelete’, so be very careful with this command!The commands below have a #
character, which indicated the beginning of a comment. # comments
are there for clarification and you do not type them.
cd # switch to your home directory
mkdir MyLab
ls # You should see the new MyLab/ directory.
cd MyLab
ls # You will not see anything. The directory is empty.
cd ..
rm -r MyLab
ls # MyLab should now be gone
cp
- Copy Files and Directoriesrm
- Remove Filesmv
- Move or Rename Filescd ~ # go to your home directory
ls
touch sample.txt # Create blank file
ls
cp sample.txt sample_copy.txt
ls
mv sample.txt renamed_sample.txt
ls
rm sample_copy.txt
ls
cd ~ # go to your home directory
ls
echo "hello" > sample.txt # create a text file containing the string "hello"
ls
cp sample.txt sample_copy.txt
ls
mv sample.txt renamed_sample.txt
ls
rm sample_copy.txt
ls
LabDirectory
cd
commandLabFile.txt
inside this directory. Use touch
LabFileCopy.txt
. Use cp
LabFileCopy.txt
. Use rm
Move on to Text files.