Linux/Mac Terminal Tutorial: Navigating your Filesystem
Skills:
Linux & CLI90%
Key Takeaways
This video tutorial by Corey Schafer covers the basics of navigating the filesystem in the Linux/Mac Terminal using commands such as PWD, LS, and CD, as well as understanding relative paths.
Full Transcript
hey everybody how's it going in this video we will begin learning how to run commands from within the terminal and we'll start by learning how to navigate the file system so learning to navigate the file system is a great way to get your feet wet in the command line uh because there aren't any commands that we're going to run in this tutorial uh that have any side effects on your system so while navigating through your terminal you can run these commands and get comfortable without worrying about accidentally uh deleting import certain folders or files or changing something that you shouldn't be changing um also in this walkthr I will have this finder window open here on the right side of the screen so that you can see exactly where we are uh as if we were navigating through finder so this will help us better visualize where we are and what's going on as we navigate through the terminal so to do this we basically only need three commands PWD LS and CD and we also need to understand relative paths so let's go ahead and open up the terminal and see how we use these so the First Command we'll run is PWD which stands for print working directory so this will print where we currently are on the file system and currently we're in our home directory so on a Mac this is a user's folder followed by your username uh if you're on a Linux machine this will be a directory called home followed by your username so we're on a Mac so you can see here that we are currently in this users directory followed by our username so if I look over here in the finder window then we're in the same place we're in this uh Corey shaer home directory and if we look at the bottom here you can see that we are in this users directory within this user name folder so now let's say I want to view the files and folders within this directory just like we can see over here in the finder window and to do that we use the ls command now if we compare everything that just popped up with the ls command you can see that it matches what we see over here in our finder window so now let's say that we want to navigate to this navigation demo folder here um So within finder we can just double click on this and it takes us with that within that folder but over here in the terminal we're going to do this by doing a CD command and CD stands for change directory so if I do a CD and navigation demo and hit enter then it will take us with within that folder now if I do a PWD which is print working directory which we used before within here then we can see that we're now in this users Corey and then navigation demo so now just same as before if I do an LS command then it will list all of the same files and folders that we can see over here in the finder window now one thing that doesn't show up from within our finder window uh is hidden files so there are hidden files in this directory that we can't can't currently see now to view these files from within the terminal it's as easy as adding a Tac a after the ls command so if I do an LS space and then- a then hit enter it's going to show me all the files including those that are hidden so you can see here not only do we have the uh directories and the text files that we can see over here within finder but we can also see these hidden files which you can tell are hidden files because they begin with a DOT so now what if we want to see more information about our files and our folders we can add the dasl command onto the end of our LS command and this will list the long form which displays the uh permissions the uh user and group owners of the files and folders uh some sizes and also some date information now we can combine those options and do the long form of the files by doing a-la so we're using the L and the a options and this will list the long forms of the files which does all the extra information plus you can see here up at the top that we have our hidden files listed as well so I mentioned before that we should also understand relative paths uh what I mean by that is that we should understand what Dot and what dot dot are uh in relation to where we currently are so one dot is the current directory and two dots is our Parent Directory um so what do I mean by Parent Directory if I do a PWD here to print the working directory it will make a little bit more sense so here we are within this navigation demo directory and our Parent Directory would be one above this so This Corey schaer directory is the navigation demo Parent Directory Parent Directory for this folder is the users directory now you can kind of see the same setup over here within finder down here at the bottom so users Cory schaer and then in the navigation demo uh now let's navigate to this subur one right here so we just navigated there from within finder and to do this within terminal we're going to navigate to subur One change directory there let's do a PWD just to make sure we got that right and you can see now we're in this subur one so now let's say I wanted to navigate back to this navigation demo folder now I can't do a CD and then navigation demo because there's not a navigation demo from within this directory what we do to do that is to use our Parent Directory so we're going to navigate using CD do Dot and that's going to take us up One Directory to our Parent Directory so if I type that in then type in PWD then you can see that we just navigated up to our Parent Directory now we can also put in folders uh we can also put in multiple folders at once so if I do an LS on this subdirectory one uh this will show us the files and folder folders from within subdirectory one even though we aren't currently in that directory so we can see here that there is a folder within uh subur one called subur 2 now even though that is down two directories we can navigate there by typing in subur one and then followed by subur two so we're doing it all in one command and now if I do a PWD you can see that we navigated down into both of these directories in one command now this works with the relative paths as well so if I want to get back to this navigation demo folder then I can do a CD dot dot to go back to our subur one and then I can do another dot dot to go back to navigation demo so if I hit enter with that CD command then do a PWD and you can see that now we're back in our navigation demos folder that would be the same if I'm over here in finder that would be the same as navigating up to uh my sub dur one and then I can go to navigation demo and now I'm back in the navigation demo folder now lastly let's say that we want to uh go back to our home directory now there's two ways we can do this we can just type in CD and hit enter and it will assume that we want to go to our home directory or we can do a CD with this Tila here and if we do that and then we do a PWD you can see that now we're back in our home directory now we can also use that Tilda as a starting point so if I did a CD and then the Tilda then I can navigate anywhere within my home directory so from here I can type in navigation demo and if I do a PWD here then we navigated into that navigation demo folder using that Tilda so that about does it for this video uh play with these three commands and learn how to navigate your system and once you're more cover comfortable with uh navigating through your file system and the relative paths then we can start using more advanced commands which will actually alter your file system and create files and create directories and and so on so I know this was a pretty basic tutorial but if you're new to uh navigating through the terminal then I hope that you found it useful if you do have any questions just ask in the comments section below uh be sure to subscribe for some more advanced terminal tutorials and thank you all for watching
Original Description
The Terminal can be an intimidating place for people who are just beginning to learn how to use it. There is a fear that you will type the wrong command and somehow mess everything up.
In this video, we will begin learning how to use the Terminal by navigating through your filesystem. This is a great way to get comfortable within your terminal, because the commands we will be learning won't have any side-effects on your system. You can't accidentally delete files or modify important documents. Learning these basics will provide us with a great starting point for more advanced commands. Let's get started.
✅ Support My Channel Through Patreon:
https://www.patreon.com/coreyms
✅ Become a Channel Member:
https://www.youtube.com/channel/UCCezIgC97PvUuR4_gbFUs5g/join
✅ One-Time Contribution Through PayPal:
https://goo.gl/649HFY
✅ Cryptocurrency Donations:
Bitcoin Wallet - 3MPH8oY2EAgbLVy7RBMinwcBntggi7qeG3
Ethereum Wallet - 0x151649418616068fB46C3598083817101d3bCD33
Litecoin Wallet - MPvEBY5fxGkmPQgocfJbxP6EmTo5UUXMot
✅ Corey's Public Amazon Wishlist
http://a.co/inIyro1
✅ Equipment I Use and Books I Recommend:
https://www.amazon.com/shop/coreyschafer
▶️ You Can Find Me On:
My Website - http://coreyms.com/
My Second Channel - https://www.youtube.com/c/coreymschafer
Facebook - https://www.facebook.com/CoreyMSchafer
Twitter - https://twitter.com/CoreyMSchafer
Instagram - https://www.instagram.com/coreymschafer/
#Linux #Mac
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from Corey Schafer · Corey Schafer · 55 of 60
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
▶
56
57
58
59
60
Web fonts using CSS Font Face
Corey Schafer
Using Font Awesome in Desktop Applications (OS X)
Corey Schafer
Sublime Text 2: Setup, Package Control, and Settings
Corey Schafer
ArcGIS API for JavaScript Part 1: Our First Web Map
Corey Schafer
Mac Tip: Windows' Snapping Feature on Mac with HyperDock
Corey Schafer
Linux/Mac Terminal Tutorial: Creating Aliases for Commands
Corey Schafer
ArcGIS API for JavaScript Part 2: Starting Templates
Corey Schafer
Paver Patio Time Lapse
Corey Schafer
Mac Tip: Ways to perform Screen Capturing and Screenshots
Corey Schafer
WordPress Plugins: Imsanity
Corey Schafer
WordPress Tips: Test your theme with Theme Unit Test and Monster Widget
Corey Schafer
Sublime Text 3: Setup, Package Control, and Settings
Corey Schafer
Understanding Binary, Hexadecimal, Decimal (Base-10), and more
Corey Schafer
Mac Tip: Adding Folder Stacks to the Dock
Corey Schafer
CSS Tips and Tricks: Add External URLs to Print Stylesheets
Corey Schafer
JavaScript Arrays: Properties, Methods, and Manipulation (Part 7 of 7)
Corey Schafer
JavaScript Arrays: Properties, Methods, and Manipulation (Part 1 of 7)
Corey Schafer
JavaScript Arrays: Properties, Methods, and Manipulation (Part 5 of 7)
Corey Schafer
JavaScript Arrays: Properties, Methods, and Manipulation (Part 4 of 7)
Corey Schafer
JavaScript Arrays: Properties, Methods, and Manipulation (Part 3 of 7)
Corey Schafer
JavaScript Arrays: Properties, Methods, and Manipulation (Part 2 of 7)
Corey Schafer
JavaScript Arrays: Properties, Methods, and Manipulation (Part 6 of 7)
Corey Schafer
Python Tutorial: if __name__ == '__main__'
Corey Schafer
Sublime Text Quick Tip: "Go To Definition" Click Shortcut
Corey Schafer
How to quickly create favicons for the desktop, Apple/Android devices, tablets, and more
Corey Schafer
Easily Resize Multiple Images Using Picasa
Corey Schafer
Easily Resize Multiple Images Using the Mac Terminal
Corey Schafer
Python Tutorial: virtualenv and why you should use virtual environments
Corey Schafer
Python Tutorial: pip - An in-depth look at the package management system
Corey Schafer
Git Tutorial: Using the Stash Command
Corey Schafer
How Software Engineers, Developers, and Designers can volunteer their skills
Corey Schafer
Git Tutorial: Diff and Merge Tools
Corey Schafer
Git Tutorial: Change DiffMerge Font-Size on Mac OSX
Corey Schafer
Sublime Text Quick Tip: Launch Sublime Text from the Terminal
Corey Schafer
Python Tutorial: str() vs repr()
Corey Schafer
Programming Terms: DRY (Don't Repeat Yourself)
Corey Schafer
Programming Terms: String Interpolation
Corey Schafer
Programming Terms: Idempotence
Corey Schafer
Python Tutorial: Namedtuple - When and why should you use namedtuples?
Corey Schafer
Programming Terms: Mutable vs Immutable
Corey Schafer
Python Tutorial: Else Clauses on Loops
Corey Schafer
Overview of Online Learning Resources
Corey Schafer
Mac OS X Terminal Tutorial: Time-Saving Keyboard Shortcuts
Corey Schafer
Git Tutorial for Beginners: Command-Line Fundamentals
Corey Schafer
Quickest and Easiest Way to Run a Local Web-Server
Corey Schafer
Python Tutorial: Generators - How to use them and the benefits you receive
Corey Schafer
Python Tutorial: Comprehensions - How they work and why you should be using them
Corey Schafer
Chrome Quick Tip: Quickly Bookmark Open Tabs for Later Viewing
Corey Schafer
Programming Terms: Combinations and Permutations
Corey Schafer
Git Tutorial: Difference between "add -A", "add -u", "add .", and "add *"
Corey Schafer
Preparing for a Python Interview: 10 Things You Should Know
Corey Schafer
SQL Tutorial for Beginners 1: Installing PostgreSQL and Creating Your First Database
Corey Schafer
SQL Tutorial for Beginners 2: Creating Your First Table
Corey Schafer
SQL Tutorial for Beginners 3: INSERT - Adding Records to Your Database
Corey Schafer
Linux/Mac Terminal Tutorial: Navigating your Filesystem
Corey Schafer
Python: Ex Machina Easter Egg - Hidden Message within the Code
Corey Schafer
Mac Tip: New Split Screen Feature in El Capitan
Corey Schafer
Setting up a Python Development Environment in Eclipse
Corey Schafer
Git Tutorial: Fixing Common Mistakes and Undoing Bad Commits
Corey Schafer
SQL Tutorial for Beginners 4: SELECT - Retrieving Records from Your Database
Corey Schafer
More on: Linux & CLI
View skill →Related Reads
📰
📰
📰
📰
Ruby ecosystem is growing and changing. It is adapting to the AI era very quickly.
Dev.to AI
AIOps Certification and Courses for Intelligent IT Operations Transformation
Dev.to · manshi kumari
Integrating AI Drafts: Polishing AI-Generated Text for Technical and Legal Precision
Dev.to AI
5 AI Tools Every Investor Should Use in 2026
Medium · AI
🎓
Tutor Explanation
DeepCamp AI