CentOS Debian Mint Scripting Ubuntu

rm command in Linux

rm command in Linux

Introduction

rm stands for remove. It is a command that allows you to remove files, folders, symlinks from the system. Deleted files and folders will not be moved to the recycle bin, but the rm command will delete them immediately. You must be careful before using this command.

And we will show you how to check the manual by using the rm command in Linux as you go through it below.

The syntax of rm command

$ rm [option]... file...

For example, I have 2 files: a.txt and b.txt

Now, I will remove file a.txt:

$ rm a.txt

Output:

As you can see. the a.txt file has been lost.

Or you can remove multiple files:

$ rm b.txt datefile.txt

Output:

Options

1. -i: must confirm before deleting

For example, I will remove file c.txt:

$ rm -i c.txt

Output:

You must press y to confirm.

2. -r: remove a directory

For example, I will remove directory snort3:

$ rm -r snort3

Output:

3. –version: check your version

$ rm --version

Output:

Conclusion

Hope you understood the tutorial on how to use the rm command in Linux.

Thanks for reading!

Similar Posts