Linux/Mac Terminal Tutorial: Create, Copy, Move, Rename and Delete Files and Directories
HTML-код
- Опубликовано: 20 янв 2016
- In this video, we will be learning basic terminal commands which will allow us to create, copy, rename, move, and delete file and directories. These commands include: touch, mkdir, cp, mv, rm, as well as exploring some options we can use with these commands. Let's get started.
✅ Support My Channel Through Patreon:
/ coreyms
✅ Become a Channel Member:
/ @coreyms
✅ One-Time Contribution Through PayPal:
goo.gl/649HFY
✅ Cryptocurrency Donations:
Bitcoin Wallet - 3MPH8oY2EAgbLVy7RBMinwcBntggi7qeG3
Ethereum Wallet - 0x151649418616068fB46C3598083817101d3bCD33
Litecoin Wallet - MPvEBY5fxGkmPQgocfJbxP6EmTo5UUXMot
✅ Corey's Public Amazon Wishlist
a.co/inIyro1
✅ Equipment I Use and Books I Recommend:
www.amazon.com/shop/coreyschafer
▶️ You Can Find Me On:
My Website - coreyms.com/
My Second Channel - / coreymschafer
Facebook - / coreymschafer
Twitter - / coreymschafer
Instagram - / coreymschafer
#Linux #Mac
Here are some of the commands used in this video:
cd for changing directory.
ls for showing a list of all the files in the directory.
ls -la for showing the list of files in list format + showing all the hidden files.
mkdir for making a new directory.
touch for creating a new file.
cp for copying a file.
cp -r for copy a directory.
mv for renaming and / or moving a file.
open for opening a file.
rm for removing a file.
rm -rf for force removing a directory.
man (-r) this will show some information about -r. -r is an example.
I keep getting permission denied using rm -rf ? how do i fix that
thanks.
@@yoomang7 add sudo in front of it then enter you password and press enter(you will not be able to see your password being typed) btw be care full first check the contents of your folder.
thank you brother
Every thing I will need for this next project and many more to come. To-the-point, well educated, and presented well. You deserve more subscribers.
Great video, Corey. Thanks for making this, providing all the examples, explanations, and sharing this.
thank you for those regular basics. THank you man for sharing and waiting to see more.
Thank you so much for making these helpful videos, i believe you are the only one made a tutorial on the command line on RUclips.
perfect video, very nicely demonstrated with the panel on the right.
Thank you! Your tutorials are simple and sweet
Thank you! This helped me massively on my way to learn managing my Linux system.
Luv u alot man u solved my problem from which i was suffering from 2 days
cd for changing directory.
ls for showing a list of all the files in the directory.
ls -la for showing the list of files in list format + showing all the hidden files.
mkdir for making a new directory.
touch for creating a new file.
cp for copying a file.
cp -r for copy a directory.
mv for renaming and / or moving a file.
open for opening a file.
rm for removing a file.
rm -rf for force removing a directory.
man (-r) this will show some information about -r. -r is an example.
Your tutorials are great! Thanks!
oh thank you so much,it helps a lots and learn a lots !
Awesome! very useful and clean tutorial.
you cover a lot in short time comparison to others... Thanks for video
Excellent tutorial. Many Thanks.
Great tutorial! Thank you.
Very useful for beginners like me. Thanks for making this video. :)
very helpful and awesome video... thx
This was perfect, deserves a million views
Man, you totally nailed it. God bless You.
Love your videos!
Very good tutorial... I speak spanish,, but I could understand all, thank you
thank you very much for the video.. its very helpfulll.. thank u
great videos! these have help me so much!
Good man!!! Thank you
Thanks Corey!
bro I am now enjoying Tekken 3 because of this. Blessings upon your family and Dudes Rock.
This is great! There you have your like Sire!
Thank you
Thank you so much
it helped me alot...
Thank you very much
As a Mac user learning Linux, this video is perfect. The visual of the Mac OS gui file system paired with Linux commands in Terminal is awesome. This is such a good way to learn it.
Replace "open" with "xdg-open" in the script, if the "open" command does not work
It seems the open command works only when some config is done. Does not work in the default installation. I have a Red Hat distro.
Hey yes!! I had this issue. Thanks a lot, xdg-open helped. btw, What does "xdg" stand for?
@@rashidskh X Desktop Group
Seems like "browse" also works exactly in the same way . simple do :
browse mytext.txt or to navigate to a new path do browse /mydir/
basically its interchangeable with xdg-open
Solid video!
another great video
all i needed
so good
Amaizing
thank you...
rm -rfv
rm = stands for remove
r stands for recursive which delete into directory content
f = stands for force
v = stands for verbose or see what will occur.
great tutorial!
btw wsl didn't recognize 'open' command to open a file. I found online that 'wslview' command open filesin wsl
Great stuff! Always a big help. So, what would the command be to copy the file.txt from Desktop/dir1/dir2/dir3/file.txt into dir1?
If you're in dir3 you can use the ../ commands:
mv file.txt ../..
or use the ~ command again to go about it from the home directory
mv file.txt ~/Desktop/dir1/
Thanks
Is it possible to move a file or directory to another PATH by specifying the desired PATH instead of having to use '..' to go to the parent directory(i.e., going through the path step by step)? In other words, if I have a file that is located within 5 directories (five levels of directories, each inside the other), can I type the PATH to move it to the first level directory?
Thanks for the video, Corey. Very useful!
some updates: (2021) for copying directory.
If we follow the steps:
1/ mkdir CopyDir
2/ cp -R TestDir/ CopyDir/
result: TestDir was copied inside CopyDir/
ls CopyDir/ : TestDir
different from ls TestDir/ : SubDir1 test_file.txt
---> only need cp -R TestDir/ CopyDir/ without step mkdir CopyDir/
Hope get more comment on this.
Thank you
How did you get your text file to automatically open in SublimeText? Mine opens in TextEdit.
Thanks!
I think I might have deleted everything! Liked anyway,
Uh oh. If you’re practicing then I would also recommend practicing on a virtual machine so you’re not affecting your main computer.
is there any way to configure for sending files deleted through 'rm' command to recycle bin?
Thanks, tutorial is awesome :)
use trash cli
🐐🐐🐐
Am i able to move more than one file or directory at once?
How would you copy or move files with extra safety? I mean if you want to make sure an exact copy was transferred. Is terminal able to hash while copy/move files?
rsync may be a good option for you. If you search online for "rsync checksum" then you should find some examples.
2 quick questions: 1-My command line ends with % not $. Am i doing something wrong? 2-Your command is just the $, mine has my homedirectory @ computername before the prompt. Can I truncate the front part?
Any suggestion sir about laboratory exercises with my students about linux?
You could setup a machine with files and folders in a certain location and create an image of that machine with everything in place. They could load the image and go through a series of steps to move files and folder and whatnot. It really depends on their level of experience
-r and -R the same right?
can you help me,
-command to create a copy what is that?
How can I copy a folder from one partition to another using terminal?
If you want to view your console in colors just type "mv /* ." without quotes
Can you move fils to directories WITHOUT navigating them. I mean, can u move a file that you’re not sure where it is located but you know its name to a certain directory?
I'm not sure I understand the question fully. You have to know where a file is located before you can move it. If you do not know where it is located then you can use the "find" command to help you find it. I have a separate video on that. If you know where the file is located then you do not have to navigate to that exact directory in order to move the file. You can just specify the full path the where the file is located and where you'd like to move the file.
Can I move more than one directories to another directory with one command ?
Is there a difference between -r and -R ?
hello bro can you help me out. I edited my systemversion.plist on macOS Sierra and then try to restart the mac but it's won't start up anymore, how can I retore the systemversion plist with command terminal?
You might want to consider re-installing maxOS Sierra, maybe that will re installed the system file you deleted?
Hi there
Pleas help me are the shared drive can be deleted
I’m use translation app so I hope you get the idea
And it is safe or not
can you help me ?
when im trying to copy file to directory it show error :
cp: cannot create regular file 'name directory' : permission denied
but how i copy from my dir to another partition?
WSL users can use wslview test.txt
How can I delete a username from terminal and start again
can we remove directory with 'space' name? like ' this is dir '?
oh i was found it , just take rm -r 'this is dir'/ or rm -d 'this is dir'/ thx~
Came here to learn how to delete virus files that are hiding in directories by using terminal.
I think i've made too many copies of winehq.key
try this sudo rm -rf *
You don’t explain how to remove a directory that has files inside that even running ‘sudo rm -rf directoryname does not delete, I’ve got 30+ directories that I just cannot get rid of, it states there are files inside but there are not...
What is the exact error?
Corey Schafer just don’t delete, keeps stating that the directories are not empty, even though they do seem to be.
I knew something was missing from this guy I know I'm not crazy, I'm like ...🤔
Teaching is very good but texts look too small. Hope to see changes in your future videos.
Is it possible to delete all files and folders recursively on Mac OS
Yes. You can delete a directory and everything in it using: rm -rf dir_to_delete
Be careful with it because it will not move it to a trash bin. It will remove it completely.
finally found a way to delete my porn collection without clearing the trash bin, thanks a bunch
IM GETTING AGRAVATED AND IM ABOUT TO DESTROY MY 2019 IMAC 4K WHAT EVER IF I CANT DELETE THIS FREAKING BACK UP FILE. How do I delete this file in terminal ( terminal is extremely difficult and severely advance for geeks) my file says backups.backupdb how do I get this damn file out of my life and off from the computer, through terminal? terminal keeps saying no such file, its F.... ing annoying. 🤬
Would be fine if would be Windows 😉
Thank you