Headlines
Loading...

How-To-Delete-Files-In-Linux

Delete file in linux terminal 

The rm and rmdir commands help us to delete file and directory. These commands are similar to del and deltree commands in windows and DOS. If we use rm or imdir command the file or directory is not moved in trash it permanently deleted from system.
In case you accidentally deleted files by using these commands then only way to get back files from backup.

Delete files with rm


1). In case you want to delete file from current directory then type rm command then space  and file name which file you want to delete.

rm  file_1.txt

2).  If file you want to delete is not in current directory then you have to mention path of the file you want to delete.

rm ./ path to the file/ file_1.txt

3). You also delete multiple files at same time by entering name of file you wanted to delete.

rm  file_2.txt  file_7.txt

4). If you want to delete all files with same extensions in current directory then use *.
Suppose you want to delete all txt files from current directory then use

rm  *.txt

Note: If file is write protected then terminal prompts before delete the file. You want delete file anyway then press y otherwise press n and hit enter button.


Delete files in linux using desktop file manager 


1). First you have to open desktop file manager and then the file location where from file you want to delete.
2). You simply delete the file by hitting the delete button on your keyboard after selecting a file you want to delete.
3) Another method is by right click on file and then select "Move to Trash" from the menu.
How-To-Delete-Files-In-Linux
You can select multiple files if you want to delete multiple files.
4). Once files are in trash you have to empty trash by right clicking on trash container and click an "Empty Trash" option.
How-To-Delete-Files-In-Linux

0 Comments: