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

Комментарии • 101

  • @esmoa1576
    @esmoa1576 6 лет назад +93

    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.

    • @yoomang7
      @yoomang7 4 года назад

      I keep getting permission denied using rm -rf ? how do i fix that

    • @kurshtivk8876
      @kurshtivk8876 4 года назад

      thanks.

    • @VishalKumar-ld2id
      @VishalKumar-ld2id 4 года назад

      @@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.

    • @rockstarby21
      @rockstarby21 2 года назад

      thank you brother

  • @alexkenny6276
    @alexkenny6276 4 года назад +4

    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.

  • @spankdatass718
    @spankdatass718 4 года назад +1

    Great video, Corey. Thanks for making this, providing all the examples, explanations, and sharing this.

  • @provisionabpro863
    @provisionabpro863 5 лет назад +1

    thank you for those regular basics. THank you man for sharing and waiting to see more.

  • @thecapitalistgeek6996
    @thecapitalistgeek6996 4 года назад +1

    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.

  • @billybuck2713
    @billybuck2713 2 года назад +2

    perfect video, very nicely demonstrated with the panel on the right.

  • @umessi10
    @umessi10 5 лет назад +1

    Thank you! Your tutorials are simple and sweet

  • @TheAnalXylophone
    @TheAnalXylophone 3 года назад

    Thank you! This helped me massively on my way to learn managing my Linux system.

  • @randomdyno
    @randomdyno 4 года назад +2

    Luv u alot man u solved my problem from which i was suffering from 2 days

  • @xtheory9640
    @xtheory9640 2 года назад +1

    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.

  • @stonedapollo432
    @stonedapollo432 6 лет назад +1

    Your tutorials are great! Thanks!

  • @migmarwangdue7415
    @migmarwangdue7415 7 лет назад +1

    oh thank you so much,it helps a lots and learn a lots !

  • @shellyshamsul6112
    @shellyshamsul6112 7 лет назад

    Awesome! very useful and clean tutorial.

  • @shahedahmed9737
    @shahedahmed9737 4 года назад

    you cover a lot in short time comparison to others... Thanks for video

  • @boubacaramaiga4408
    @boubacaramaiga4408 5 лет назад +1

    Excellent tutorial. Many Thanks.

  • @erdemalpkaya
    @erdemalpkaya 7 лет назад +1

    Great tutorial! Thank you.

  • @drewlynford256
    @drewlynford256 2 года назад

    Very useful for beginners like me. Thanks for making this video. :)

  • @guyyvesmoro6111
    @guyyvesmoro6111 7 лет назад +2

    very helpful and awesome video... thx

  • @fz887
    @fz887 Год назад

    This was perfect, deserves a million views

  • @bholaprasad26
    @bholaprasad26 4 года назад +6

    Man, you totally nailed it. God bless You.

  • @MyTube4Utoo
    @MyTube4Utoo 6 лет назад +2

    Love your videos!

  • @5537933
    @5537933 7 лет назад

    Very good tutorial... I speak spanish,, but I could understand all, thank you

  • @yashwanthkumar-yn4xu
    @yashwanthkumar-yn4xu 5 лет назад +2

    thank you very much for the video.. its very helpfulll.. thank u

  • @Pinkythegreat1
    @Pinkythegreat1 2 года назад

    great videos! these have help me so much!

  • @JanekBaranek
    @JanekBaranek 7 лет назад

    Good man!!! Thank you

  • @giacomobonomelli8904
    @giacomobonomelli8904 Год назад

    Thanks Corey!

  • @quinnhall4548
    @quinnhall4548 2 года назад

    bro I am now enjoying Tekken 3 because of this. Blessings upon your family and Dudes Rock.

  • @sushirollerboarder
    @sushirollerboarder 3 месяца назад

    This is great! There you have your like Sire!

  • @bolamuyis
    @bolamuyis 5 лет назад +1

    Thank you

  • @spaceiswater6539
    @spaceiswater6539 5 лет назад

    Thank you so much

  • @saurabhsingh7600
    @saurabhsingh7600 5 лет назад +1

    it helped me alot...

  • @amritkumarbehera9631
    @amritkumarbehera9631 5 лет назад

    Thank you very much

  • @TheYooToob2000
    @TheYooToob2000 Год назад +1

    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.

  • @johnhillescobar
    @johnhillescobar 7 лет назад +44

    Replace "open" with "xdg-open" in the script, if the "open" command does not work

    • @rashidskh
      @rashidskh 5 лет назад +1

      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.

    • @yuvrajmetrani227
      @yuvrajmetrani227 3 года назад +2

      Hey yes!! I had this issue. Thanks a lot, xdg-open helped. btw, What does "xdg" stand for?

    • @johnhillescobar
      @johnhillescobar 3 года назад +4

      @@rashidskh X Desktop Group

    • @amortalbeing
      @amortalbeing 2 года назад +1

      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

  • @bullz3718
    @bullz3718 3 года назад

    Solid video!

  • @Ian69885
    @Ian69885 5 лет назад

    another great video

  • @franciscomendez8863
    @franciscomendez8863 3 года назад

    all i needed

  • @henryguo8165
    @henryguo8165 2 года назад +1

    so good

  • @SuperAlashi
    @SuperAlashi 3 года назад

    Amaizing

  • @sofiastar9197
    @sofiastar9197 4 года назад +1

    thank you...

  • @rebazomer5635
    @rebazomer5635 3 года назад

    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.

  • @GadiGEzer
    @GadiGEzer Год назад

    great tutorial!
    btw wsl didn't recognize 'open' command to open a file. I found online that 'wslview' command open filesin wsl

  • @joelewis1074
    @joelewis1074 5 лет назад

    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?

    • @tomfogle8173
      @tomfogle8173 5 лет назад

      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/

  • @stepriq
    @stepriq Год назад

    Thanks

  • @julianelizondo9517
    @julianelizondo9517 3 года назад

    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!

  • @Scorpisces1911
    @Scorpisces1911 3 года назад +1

    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

  • @vijayrachakonda8411
    @vijayrachakonda8411 6 лет назад

    How did you get your text file to automatically open in SublimeText? Mine opens in TextEdit.
    Thanks!

  • @Rectangle101
    @Rectangle101 4 года назад +3

    I think I might have deleted everything! Liked anyway,

    • @coreyms
      @coreyms  4 года назад +2

      Uh oh. If you’re practicing then I would also recommend practicing on a virtual machine so you’re not affecting your main computer.

  • @YAakash
    @YAakash 6 лет назад

    is there any way to configure for sending files deleted through 'rm' command to recycle bin?
    Thanks, tutorial is awesome :)

  • @Se_Goober
    @Se_Goober Год назад

    🐐🐐🐐

  • @brunofaiao1997
    @brunofaiao1997 4 года назад

    Am i able to move more than one file or directory at once?

  • @lutzpapenfumancave.product8961
    @lutzpapenfumancave.product8961 6 лет назад

    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?

    • @coreyms
      @coreyms  6 лет назад

      rsync may be a good option for you. If you search online for "rsync checksum" then you should find some examples.

  • @f2f.photography
    @f2f.photography Год назад

    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?

  • @charlespitagan8241
    @charlespitagan8241 4 года назад

    Any suggestion sir about laboratory exercises with my students about linux?

    • @coreyms
      @coreyms  4 года назад

      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

  • @TayakornRakwetpakorn
    @TayakornRakwetpakorn 6 лет назад

    -r and -R the same right?

  • @iloilocitypubliclibrary777
    @iloilocitypubliclibrary777 4 года назад

    can you help me,
    -command to create a copy what is that?

  • @Audiomishran
    @Audiomishran 5 лет назад

    How can I copy a folder from one partition to another using terminal?

  • @ricko13
    @ricko13 4 года назад

    If you want to view your console in colors just type "mv /* ." without quotes

  • @AhmedHadiPADI_scuba_instructor
    @AhmedHadiPADI_scuba_instructor 6 лет назад

    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?

    • @coreyms
      @coreyms  6 лет назад +4

      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.

  • @muhammadwalid8666
    @muhammadwalid8666 2 года назад

    Can I move more than one directories to another directory with one command ?

  • @vanderfed
    @vanderfed Год назад

    Is there a difference between -r and -R ?

  • @walewax8806
    @walewax8806 7 лет назад

    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?

    • @rangers400
      @rangers400 7 лет назад

      You might want to consider re-installing maxOS Sierra, maybe that will re installed the system file you deleted?

  • @HoneyBadger-101
    @HoneyBadger-101 4 года назад

    Hi there
    Pleas help me are the shared drive can be deleted
    I’m use translation app so I hope you get the idea

  • @alimuqsith2239
    @alimuqsith2239 3 года назад

    can you help me ?
    when im trying to copy file to directory it show error :
    cp: cannot create regular file 'name directory' : permission denied

  • @abduogalal53
    @abduogalal53 3 года назад

    but how i copy from my dir to another partition?

  • @rukhan8900
    @rukhan8900 3 года назад

    WSL users can use wslview test.txt

  • @HazaraAfguk
    @HazaraAfguk Год назад

    How can I delete a username from terminal and start again

  • @madeonearthbyhumans
    @madeonearthbyhumans 4 года назад

    can we remove directory with 'space' name? like ' this is dir '?

    • @madeonearthbyhumans
      @madeonearthbyhumans 4 года назад

      oh i was found it , just take rm -r 'this is dir'/ or rm -d 'this is dir'/ thx~

  • @siik-ghostface
    @siik-ghostface 4 года назад

    Came here to learn how to delete virus files that are hiding in directories by using terminal.

  • @kzvnq
    @kzvnq 3 года назад

    I think i've made too many copies of winehq.key

  • @Gerardo3491
    @Gerardo3491 5 лет назад +1

    try this sudo rm -rf *

  • @MD0MDI
    @MD0MDI 5 лет назад

    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...

    • @coreyms
      @coreyms  5 лет назад

      What is the exact error?

    • @MD0MDI
      @MD0MDI 5 лет назад

      Corey Schafer just don’t delete, keeps stating that the directories are not empty, even though they do seem to be.

    • @OBI-KONOBI-ISRAEL
      @OBI-KONOBI-ISRAEL 5 лет назад

      I knew something was missing from this guy I know I'm not crazy, I'm like ...🤔

  • @plw5522
    @plw5522 4 года назад

    Teaching is very good but texts look too small. Hope to see changes in your future videos.

  • @tmj5600
    @tmj5600 6 лет назад

    Is it possible to delete all files and folders recursively on Mac OS

    • @coreyms
      @coreyms  6 лет назад

      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.

  • @Ethan-rw7ub
    @Ethan-rw7ub 5 лет назад +1

    finally found a way to delete my porn collection without clearing the trash bin, thanks a bunch

  • @OBI-KONOBI-ISRAEL
    @OBI-KONOBI-ISRAEL 5 лет назад

    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. 🤬

  • @ssigitas69
    @ssigitas69 Год назад

    Would be fine if would be Windows 😉

  • @ednakazuya12
    @ednakazuya12 4 года назад +1

    Thank you