How To Delete Files And Folders Or Directories In Ubuntu Linux Command Line

How To Delete Files And Folders Or Directories In Ubuntu Linux Command Line

HomeOther ContentHow To Delete Files And Folders Or Directories In Ubuntu Linux Command Line
ChannelPublish DateThumbnail & View CountActions
Channel AvatarPublish Date not found Thumbnail
0 Views
How To Delete Or Remove Files And Folders Or Directories In Ubuntu Linux Command Line

In this video I will show you how to permanently delete or remove files and folders or directories in Linux. The operating system I installed on my Server during this video tutorial was Ubuntu Linux. These commands will work on other Linux operating systems too.

Commands To Remove Files:

There are two ways to delete or remove files in Linux. You can use either /”unlink/” or /”rm/”.

unlink filename.extension
rm filename.extension

You can delete or remove multiple files in a single command using /”rm/” and separating your each file you want to delete with a space. The files you delete do not have to have the same extension to be deleted using a single command. You can’t use the /”unlink/” command to remove multiple files.

rm filename.extension filename.extension

Commands To Remove Directories or Folders:
rm -rf directoryname or foldername

To remove files or folders beginning with a letter such as /”b/” type the following command:

rm -rf b*

You can also add more letters or even words to the above command before the star (*)

To remove files with a specific file extension such as /”.json/” type the following command:

rm -rf *json

Command Syntax: rm -rf *extension

To delete an entire directory or folder, leaving it empty, type the following command:

rm -rf *

To list all the files and folders in your current directory type the following command:

ls

Abbreviation Key
rm = Remove
r = Recursive (Remove files and folders without being prompted)
f = Force (Remove files and folders with write-protection)
-rf = Recursive Force
* = Wildcard
ls = List

Timestamps:
0:00 Intro & Context
0:10 How To List Files In Current Directory (ls)
0:25 unlink and rm Commands To Delete A Single File In Terminal
1:44 How To Remove Directories Or Folders In A Linux Terminal
2:36 How To Delete An Entire Directory to Empty It Completely

Need A Cheap Server To Practice Linux Commands On?
Get $100 free Vultr cloud credits https://www.vultr.com/?ref=8941242-8H

What is Vultr?
Vultr is a Cloud Hosting company. Vultr allows customers to deploy a cloud server in 15 Cities around the globe in less than 60 Seconds.

Grow your YouTube Channel with vidIQ https://vidiq.com/70s

Ubuntu Linux Tutorials (Playlist) https://www.youtube.com/playlist?list=PLco3v23oibTXMcX9Eh80_8OcnVs1SqsR2

Social Media
SUBSCRIBE https://www.youtube.com/@Websplaining?sub_confirmation=1
Instagram (Thumbnail Collection) https://www.instagram.com/websplaining
Twitter (For Newest uploads) https://twitter.com/websplaining
Reddit (Discussions) https://www.reddit.com/r/Websplaining
Personal Website https://www.websplaining.com

#DeleteFoldersInLinux #DeleteFilesinLinux #DeleteDirectoriesinLinux

DONT FORGET TO LIKE COMMENT AND SUBSCRIBE!

Please take the opportunity to connect and share this video with your friends and family if you find it useful.