Sunday, January 01, 2012

How to delete a file from the current directory in linux

To delete a file from the current directory:

Type rm filename and press enter. This permanently deletes filename from the current directory.

Type rm -i filename and press enter. You see the message, rm: remove regular empty file 'filename'?

Type y for yes and press enter.

To delete a group of files using wildcards:

You can specify multiple file names as arguments to the touch command. Type touch file1 file2 file3 and press enter. This command creates these files: file1,file2,file3.

Type ls file* and press enter. You see the listing for the files you just created.

Type rm file* and press enter.

Type ls file* and press enter. The file have been erased.

No comments:

Post a Comment