16.7. Exercises: TerminalΒΆ
Launch the terminal application and perform the following tasks:
Using your terminal, navigate to your
Homedirectory usingcd ~.Use
lsto view the contents of your Home directory.Use
cdto move into yourDesktopdirectory.In the terminal, use
mkdirto create a folder on theDesktopcalledmy_first_directory. Look on your Desktop. Do you see it?Use
cd my_first_directoryto move inside that directory.pwdto check your location.Create a file called
my_first_file.txtwithtouch my_first_file.txt.Use
lsto prove thatmy_first_file.txtappears inmy_first_directory. (Bonus: Open the file in a text editor and write yourself a message!)Make a copy of
my_first_file.txtonto the Desktop withcp my_first_file.txt ../my_first_copy.txt.Tip
Notice the different file name in the command! This keeps us from making two files that have the same name.
Move up to your Desktop directory with
cd ...Use
lsto verify thatmy_first_copy.txtappears on your Desktop. (Bonus: Open it up. Is it the same as your first file?)Move your copied file into
my_first_directorywithmv my_first_copy.txt my_first_directory/.Use
lsto see that the copied file is no longer on your Desktop.Type
cd my_first_directory, followed bylsto confirm thatmy_first_copy.txthas been moved into that folder.Type
rm my_first_copy.txtfollowed byls. Congratulations, you just deleted the file!cd ..to get back to your Desktop.Type
rm -r my_first_directory/. Uselsand a visual check to verify that you removed the directory.
