>_ IzzyLab

Hands-on task

This task is step 5 of the course “First steps in Linux”

Copy a config and rename a file

easy~4 min

There are two files in /root/app that need sorting out.

  1. config.example.ini is a sample config. Turn it into a working one: copy it to /root/app/config.ini. The sample must stay where it is.
  2. notes.txt.txt holds some notes, but there's a typo in its name. Rename the file to notes.txt without changing its contents.
What you'll practise:
  • cp
  • mv
  • copying files
  • renaming

Topic breakdown

Copying and moving work the same way: the command, from where, to where.

cp makes a copy, and the original stays. mv moves the file, and the original is gone. Linux has no separate "rename" command: renaming is just mv into the same directory under a new name.

cp /etc/hostname /tmp/hostname.bak    # a copy, /etc/hostname is still there
mv /tmp/hostname.bak /tmp/host.txt    # was hostname.bak, now host.txt

Careful: if a file with the destination name already exists, cp and mv silently overwrite it.

What's checked

  1. config.ini created and matches the sample
  2. The sample is still in place
  3. The notes are in notes.txt with the same text
  4. The file with the typo in its name is gone

What it looks like