Find the file in your file manager and move it to Trash, or use a terminal command if you want to remove it directly. To delete one file in Linux, first confirm its name and location. The two methods differ in what happens afterward: Trash offers a way back, while the terminal command below bypasses it.
Move a File to Trash
If you are learning how to remove a file in Linux with a graphical desktop, open your file manager and navigate to the folder containing it. In GNOME Files, click the file once, then press Delete or choose Move to Trash from its context menu. The file disappears from its original folder and appears in Trash.
Open Trash in the sidebar to review it. If you changed your mind, select the item and choose Restore to return it to its original location. Emptying Trash removes its contents from that recovery location, so inspect it before doing so. Menus and Trash behavior can differ across file managers and storage locations; if the system warns that an item cannot be moved to Trash, read the prompt before confirming deletion.
This is a convenient way to remove an individual Linux file when you may need it again. It does not immediately free the space occupied by a file still in Trash. GNOME’s file deletion guide describes its desktop behavior.
Remove One File in the Terminal
To see how to remove a file in Linux from a terminal, begin by identifying the directory and filename. The following examples use a file named draft.txt in the current directory. They are examples: substitute the exact name of your own unwanted file.
pwd
ls -l -- draft.txt
pwd shows the current directory, and ls displays the matching item so you can check its name and details. Linux filenames are case-sensitive: Draft.txt and draft.txt are different names. Once you have confirmed the target and no longer need it, use:
rm -i -- draft.txt
The -i option asks for confirmation. Answer y only if the displayed filename is the one you intend to remove; otherwise answer n. The -- separates options from the filename, which also helps if a name begins with a hyphen. The command removes the directory entry directly rather than sending the file to Trash. Treat it as permanent for ordinary use, and keep a backup if the contents matter. The GNU manual explains the confirmation option.
Names With Spaces and Paths
For a file called meeting notes.txt in the current directory, use quotes so the shell treats the name as one argument:
ls -l -- 'meeting notes.txt'
rm -i -- 'meeting notes.txt'
To understand how to remove a file in Linux when it is in another folder, use its full path. For example, /home/sam/Documents/meeting notes.txt names a file under Sam’s Documents folder. Replace that example with your own actual path and put the entire path in single quotes. Check it with ls -l -- before passing the same path to rm -i --. Single quotes also prevent the shell from interpreting spaces and many special characters in the name.
If the File Is Not Found
If you know how to remove a file in Linux but see No such file or directory, check pwd and compare the filename, capitalization, and extension with the output of ls. You may be in the wrong folder, or the path may contain a typo. Navigate to the correct folder or use the confirmed full path, then check the target again before deleting it. If you see Permission denied, stop and check whether you have authority and the necessary permissions for that file; do not change permissions blindly.