terminal.cab

All commands

rm

Topic: Files and folders

Program: rm

Removes files and directories.

Package: core-nav

Usage

rm [OPTION]... [FILE]...

Description

Remove each FILE. Directories only with -r (with all they contain) or with -d (when empty).

Options in the simulator

5 more options of the real program, not in the simulator yet
  • --interactive value optional not in the simulator yet

    On a real system --interactive=WHEN chooses when rm asks (never, once, always). The simulator knows only the short forms.

  • --one-file-system not in the simulator yet

    Explanation to come

  • --no-preserve-root not in the simulator yet

    Explanation to come

  • --preserve-root value optional not in the simulator yet

    Explanation to come

  • --version not in the simulator yet

    On a real system it prints the version of the program.

Examples

From the lesson Deleting without regrets
rm Downloads/invoice.pdf
ls Downloads
photo.jpg

Try it in the terminal

From the lesson Deleting without regrets
ls projects/website
index.html  server.log  style.css
rm -r projects/website
ls projects

Try it in the terminal

From the lesson Delete, link, measure
ls projects/shop/*.log
projects/shop/build.log  projects/shop/test.log
rm projects/shop/*.log
ls projects/shop
README.md  app.conf  releases

Try it in the terminal

From the command of the day: ls first, then rm -i
ls Downloads
manual.pdf  photo.jpg  setup.sh
rm -i Downloads/setup.sh
rm: remove regular file 'Downloads/setup.sh'? y
ls Downloads
manual.pdf  photo.jpg

Try it in the terminal

Where you learn it

Lessons

Command of the day

All commands