You should see a copy of the files the officetxt and shrektxt in this directory

You should see a copy of the files the officetxt and

This preview shows page 12 - 16 out of 25 pages.

You should see a copy of the files the-office.txtand shrek.txtin this directory. I'll explain how this works in the next exercise. 5.Here's another way to use cp. Navigate to the action/directory. Type cd ../../action/ Here we navigate up two directories, and then into the action/directory. 6.Type
Background image
cp m*.txt scifi/ 7.Change directories into scifi/. List all files and directories in the working directory. You should see a copy of all text files starting with "m": matrix.txt, matrix-reloaded.txt, and matrix-revolutions.txt. Let’s learn how this works.Wildcardscp * satire/ In addition to using filenames as arguments, we can use special characters like *to select groups of files. These special characters are called wildcards. The *selects all files in the working directory, so here we use cpto copy all files into the satire/directory. cp m*.txt scifi/ Here, m*.txtselects all files in the working directory starting with "m" and ending with ".txt", and copies them to scifi/. 1.In addition to copying files, we can move files from the command line. Change directories into the action/directory. cd ../ 2.Type mv superman.txt superhero/ 3.Navigate to the superhero/directory.
Background image
List all files and directories in the working directory. You should see superman.txtin it. 4.Here's another way to use mv. Navigate up one directory from action/superhero/to action/. 5.Then type mv wonderwoman.txt batman.txt superhero/ 6.Navigate to superhero/again. List all files and directories in the working directory. You should see wonderwoman.txtand batman.txtin it. 7.Here's one more way to use mv. Type mv batman.txt spiderman.txt 8.List all files and directories in the working directory. You should see the file batman.txthas been renamed as spiderman.txt. Let’slearn how these commands work. mvThe mvcommand moves files. It's similar to cpin its usage. mv superman.txt superhero/
Background image
To move a file into a directory, use mvwith the source file as the first argument and the destination directory as the second argument. Here we move superman.txtinto superhero/. mv wonderwoman.txt batman.txt superhero/ To move multiple files into a directory, use mvwith a list of source files as the first arguments, and the destination directory as the last argument. Here, we move wonderwoman.txtand batman.txtinto superhero/. mv batman.txt spiderman.txt To rename a file, use mvwith the old file as the first argument and the new file as the second argument. By moving batman.txtinto spiderman.txt, we rename the file as spiderman.txt. 1.Change directory to comedy/slapstick. List all files and directories in the working directory. cd ../../comedy/slapstick/ 2.Type rm waterboy.txt 3.List all files and directories in the working directory. You should see that waterboy.txthas been removed. 4.Navigate up one directory from comedy/slapstick/to comedy/.
Background image
Image of page 16

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture