Where would all the computer science students that didn't know a lot about the practical stuff prior to studying computer science be without people like you? Seriously, CS is such a hard field because there is tons of stuff University will not teach you but people expect you to know. Thank you very much for this introduction to the terminal!
An old dilemma, or if it is an dilemma at all? I remember when a friend was looking to hire a coupple of people to their computer company some 20 years ago. After a lot of interviews of applicants from university as well as pure home hackers the only ones qualified for the task were the home hackers without any formal education in the matter. Titles are NOT a guarantee for competence. I usually say that the world have never been ruled by so many stupid people with fine titles as today, not impliing that everyone with a fine title is stupid.
You don't have to worry much because I am a computer engg graduate and ended up detailing cars for years.Nowadays, I would say that whom you know is better than what you know. I am not that dumb but I can pretend. Haha
There actually is a way to "go back" using cd command that is completely equivalent to what the "back" button does in Finder (which is that actually goes to previous location you've been to, not necessarily to the parent directory). It's cd - (minus). Just leaving it here cause I found it useful from time to time.
Thank you for uploading this video, have been looking for something like this since a long time, your way of explaining things makes it extremely easy for the viewers to understand.
great video for beginners , I am taking my first course for coding and the clases are for windows system but I use Mac , I am also taking them in spanish cause my lenguage is spanish , i speak some english better than I can understand , but your speech was very clear for me to understand this class , thank you so much i really appreciate to people like you that helps studentes like me with this stuff!! thank you thank you!!
This video is awesome Percy. I was very frustrated with Terminal as I am just getting familiar and after watching this video I feel much better. it was eye opening. Thank you very much!
Percy could you please do more videos just watch this and love it and would love to see even more advanced lessons you give amazing explanation would love to see more of your videos. I’ll be start my IT school in month and wanted get familiar with terminal and Vim and other stuff.
Thank You very much for this tutorial video. Im a beginner to this top and this video gave me full understanding and ability to work through Terminal. 🙏🙏
The video is amazing, super helpful thank you so much!!! Just one thing, I learned on another video the 'rmdir' command, to remove directory, which is clearly more intuitive and easy to remember than rm -r (regarding mkdir to make directory, rmdir is straightforward i think!) But anyway, thank you so much again!
Really appreciate the positive feedback, thank you. You're right about `rmdir` being an alternative with an easier name to remember. One gotcha about `rmdir` compared to `rm -r` is that `rmdir` will not delete a directory with anything inside it (files, other directories, etc.), it has to be completely empty, which might be extremely inconvenient to achieve. `rm -r` is able to remove directories containing files and/or directories.
Yes, that's correct, `rmdir` behaves roughly the same as `rm -r`, except that `rmdir` will only delete empty directories (whereas `rm -r` will remove everything inside a directory and the directory itself). Thank you for adding info 🙏
Hi Luke, glad it was fun. You can write code in the terminal by using a command line based text editor like nano or vim to create a script file in your language of choice, then run that code. For example, if you want to write a shell script and execute it, you can do the following: 1. Create a new file called "test_script" with nano text editor: ``` nano test_script ``` 2. Add a simple loop to the file: ``` for i in {1..5}; do echo "Hello $i"; done ``` 3. Make the script "runnable" (executable) ``` chmod +x test_script ``` 4. Run the script ``` ./test_script ``` You should see: ``` Hello 1 Hello 2 Hello 3 Hello 4 Hello 5 ``` You can do a similar process with other scripting languages like Ruby and Python on most systems. Hope that helps.
Hi, thanks for the video now I am a little better with terminal. I just got one problem, when I press tab I have a list of possible commands instead of navigating through directories. How is it possible to fix it, so I tab key would give suggestions, as it gives in your video?
It should only show commands if your command line is currently completely empty and you press tab. If you already typed a command, then space, then press tab it should autocomplete files and directories within the current directory.
Well spotted, both Linux and Mac OS are "POSIX-oriented" (i.e. UNIX-like) operating systems, so I would expect a lot of overlap in the commands. Some interesting reading on the subject: en.wikipedia.org/wiki/POSIX#POSIX-oriented_operating_systems. Thanks for your comment.
To open the Mac terminal press command and the space bar at the same time or Navigate in Finder to Applications then to Utilities and double click on Terminal How to see where you are (print working directory) pwd How to open window in finder... copy the address then type open followed by the address that you can paste open /Users/(your name here) To see all the folders in the directory (list) ls This will give you a list of all the folders at your location Desktop Downloads Movies Pictures Documents Library Music Public How to change directory cd then add the name of the directory cd Movies/ How to take a step back from the current folder (.. means parent directory) cd .. One dot refers to the current directory cd . To clear the text type clear or Shortcut would be command K (on the keyboard) To get to the main directory type cd ~ The Tilde key ~ is typed by pressing Shift and the key on the left side next to the 1 key To create a new file type touch then name the file touch test_file.txt To open a file you created type open then the name of the file open test_file.txt To edit a file in Nano type nano then the name of the file nano test_file.txt In the terminal press the up key on the keyboard to go through the history of your commands To get a list of commands used type history To remove a file type rm then type the name of the file rm test_file.txt To create a new directory at your current location type mkdir then the name you want to give the directory mkdir test_directory To remove the directory type rmdir then type in the name rmdir test_directory To create both a folder and file at the same time type touch then name both the new directory and new file within the directory touch test_directory/test_file.txt To delete directory and all contents type (-r stands for recursive) rm -r then name the directory rm -r test_directory IMPORTANT rm does not move deleted items to the trash
Hello friend, your video tutorials are very good, I have a question, how can I recover or change the password of the terminal, I do not remember it ???
Thank you for your comment. Your terminal password should be the same as your user password for logging in in Mac OS. If you forgot your user password, there is a guide here from Apple: support.apple.com/en-us/HT202860 Hope that helps
Can someone explain why do we need terminal for this purpose if we can do all of this while just being on computer, for example, just right click and create directory and so on. Thanks!
The actions in this tutorial are very basic and a lot of them are more convenient in GUI applications like Finder and TextEdit, but we have only scratched the surface of what you can do in the Terminal in this video. Some examples of things that you can do in the terminal that are no possible in a UI: • Changing certain advanced Mac OS system settings • Using a package manager like Homebrew (brew.sh/) • Executing "shell scripts" to automate actions • Logging into remote servers with SSH • Compiling and/or running programs in various programming languages A lot of these are much more advanced skills that require some basic familiarity with how to use the Terminal.
This might be a good starting point: en.wikipedia.org/wiki/POSIX#POSIX-oriented_operating_systems MacOS is POSIX certified, while Linux is "mostly POSIX compliant". In my experience using Mac OS and various distributions of Linux, they are "mostly the same", with the variation existing mainly in the installed services and "standard" way of managing things for that operating system. One example is "package management". MacOS has no default package manager installed by default, but many people use Homebrew, which must be installed manually. Debian Linux and Ubuntu use the `apt` package manager and have it installed by default, whereas Red Hat/CentOS/Fedora all use the `yum` package manager. There are also differences in things like the default firewall, service management etc.
Hi, I'm a bit late to your channel. Like this video. I was following alone and when I used ls in my user directory it listed the folders but it listed "Desktop" which wasn"t listed in finder. Could you tell me why?
It may be that the Desktop directory is "hidden" in your Finder window (although I can't think of why). Usually the "Library" directory is not shown in Finder, but is shown when you run `ls` because Finder hides the "Library" directory by default.
Both programs have the same purpose (edit text files), but have different interfaces. I believe nano was the default when I created this video and it can be easier to use in some ways. Both work fine for the things covered in this video.
The `-r` is the option for "recursive" (meaning it will go and delete files and directories recursively inside the directory, as well as the directory itself). You can find out more by running the command `man rm` (the `man` command is for "manual"). Scroll with your arrow keys and quit the `man` command by pressing `q`.
Hello Sir..my macbook terminal showing this error([forkpty: Device not configured] [Could not create a new process and open a pseudo-tty.] ) i can i figure out this ..m not able to type anything on it
Great tutorial!! But I have a problem. My Volumes have names with blanks: /LaCie 40TB. Terminal.app can not find it even when I coded it in unicode Hex. Am I to dizzy?!
Hi SuperMac1963, this is a problem that I had when I started working on the command line as well. There are 2 common solutions to this problem: 1. Use a backslash to "escape" the space so that each space becomes "\ " (without quotes). This tells the shell to interpret the space as part of the argument to the command, instead of a separator between different arguments. When using autocomplete, the shell usually does this. Some examples in your case: cd /Volumes/LaCie\ 40TB You can also test the autocomplete by typing the following and then pressing the "tab" key: cd /Volumes/LaCie The shell should autocomplete the same as the first example I gave: cd /Volumes/LaCie\ 40TB 2. Use quotation marks (" or ') to surround the path: cd "/Volumes/LaCie 40TB" The quotations marks force the shell to interpret everything between the quotes as a argument. Some background to what I mean about "arguments". Most commands follow a similar format like this: command [options] [arguments] command --option1 --option2 argument1 argument2 ls -l /Volumes (command = "ls", options = ["-l"], arguments = ["/Volumes"] As you can see, the thing the shell uses to distinguish between options and arguments is a space. If the argument value contains a space, you need to use one of the techniques I showed above to make sure the shell doesn't think the space is a separator between arguments. In your example above: cd /Volumes/LaCie 40TB (command = "cd", options = [], arguments = ["LaCie", "40TB"] cd /Volumes/LaCie\ 40TB (command = "cd", options = [], arguments = ["LaCie 40TB"] cd "/Volumes/LaCie 40TB" (command = "cd", options = [], arguments = ["LaCie 40TB"] Hope this is clear, thank you for your comment.
Dear Percy, I have a command line I need to enter and it looks like this, bless --folder /Volumes/WINSTALL/efi/boot --label "Install Windows" mkdir /Volumes/WINSTALL/label bless --folder /Volumes/WINSTALL/label --label "Windows" My question is, do I need to eliminate all but the $ sign in order to get the first line to fit? Is it even necessary to form it this way or may I just type it out and ignore the need for 3 separate lines of code? Thanks!
Yeah, you shouldn't include any preceding "$" from any commands you're taking from a guide or something like that. The "$" in the guide is just there to show you that anything following the $ should be executed on the command line as a single command
This app randomly opened on my macbook and im just curious as to WHY or for what types of reasons someone would want to use this application? Can it do things differently than if I were to just go in and create a folder, or navigate my mac using finder? Like what is its purpose??
That's a good question, certainly the things I covered in this video are probably easier and more convenient to do in a UI, but as you get deeper into programming, automation/scripting, system administration, DevOps, etc. these basic steps form the foundation of interacting with your (and other) computer(s) in a programmatic way or without a GUI. For example, I'm currently working as a DevOps engineer and none of the servers I deal with have GUIs, so if I need to do _anything_ on those systems, it needs to be done on the command line. The things I cover in this video are still things I do on a daily basis on these systems (often in scripts or other automation). Maybe some others can chime in and let us know how you use these skills to do cool things either professionally or in your personal life.
For most average computer users, the command line has no real purpose. Most people aren't interested in learning cryptic looking commands. However, like the video poster mentions, it is used extensively by IT professionals for various tasks. Some programs make extensive use of commands whereas others are exclusively command line based. Troubleshooting certain computer programs can be done only through the command line or more efficiently that way. To give you a real world example: If you wanted to create let's say 20 folders for whatever reason, you would have to create them individually. Its not super difficult to do, but it will get tedious really quickly. On the other hand, with the terminal, you can run the following command: mkdir Folder{1..20} and it will automatically create 20 folders for you instantly. There are a lot of really cool things you can do through a command line if you know what you're doing. For most people, there's usually no need to use it for most use cases.
Awesome tutorial! I am able to open the finder, but for some reason when I use the cd command for Movies I get the following "cd: no such file or directory: Movies" even though I see it in the finder window. Any ideas on how to fix this?
Hi Alex, I'm not 100% sure why, but my guess is that you have already moved to another directory before issuing the `cd` command. If you issue the command `cd Movies`, the `Movies` directory _must_ be inside the directory you are currently in. You can move to `Movies` from any directory you're currently in by using the "absolute path" for the directory: `cd ~/Movies` (`~` means your home directory). Another thing you can do is check what directories are available in the current directory with `ls`. Here's an article on relative and absolute paths: www.geeksforgeeks.org/absolute-relative-pathnames-unix/ Hope that helps, thanks for your comment.
Well spotted, Finder hides this directory because I believe it considers it a "system directory". You can access the ~/Library directory in Finder by going to the "Go" menu in the title bar and holding the "Option" key. The "Library" menu item will show up and if you click it it will open the directory.
This is related to Mac OS changing the the default shell from "bash" to "zsh" since I made this video. This shouldn't affect any of the commands covered in the video. More info here: www.makeuseof.com/customize-zsh-prompt-macos-terminal/
I wrote a C program and it runs fine in a terminal window. However when I double click the icon from Finder it will not run. Any idea what the issue could be?
I'm not sure about the exact reason, but my guess is that MacOS expects binaries that are launched via the UI are GUI applications compiled in a certain way. A way around this might be to wrap the compiled C binary in a shell script, which MacOS should launch in a new terminal window.
@@toptechskills I tried wrapping it in a shell script but that did not work either. It works correctly If I drag it into a terminal window. Thanks for looking at this :-)
hi Percy ,noticed the you did not go through any file finding features. may I know the difference between mdfind / find / locate? which is the best way to search for stuff in my Mac. Thanks!
Hi Bobby Q, great question. My understanding of the 3 tools and their use cases: mdfind - A command line interface into Mac OS's Spotlight database. Should be very fast because it's using Spotlight's file index, which indexes not only file name, but also file contents and file metadata. I rarely use this on the command line, since it's not available on other OS's and I spend most of my command line time in Linux systems. I would generally interact with this index via Finder or Spotlight, since it would give me more visual context locate - Generally use this to quickly find the location of a program or log file when I know for a fact it exists on a system, but forgot where exactly it's installed or where it stores its file (e.g. "locate elasticsearch" to find everything file path with "elasticsearch" in the path) find - Generally use this for all complex queries (e.g. "recursively find all files [not directories] in some directory that have not been modified for the last X days and then delete them"). Find is the most complex and most powerful, with very advanced filtering. Thanks for the great question.
The prompt may be different in a newer version of Mac OS, since the shell program has changed. It's nothing to worry about. There are more details here: scriptingosx.com/2019/07/moving-to-zsh-06-customizing-the-zsh-prompt/
This will sometimes vary in newer versions of Mac OS, it's not a problem, all the commands in the tutorial will work exactly the same. If you want to change your prompt, check out ss64.com/osx/syntax-prompt.html.
The most common cause for autocomplete not working is that there isn't actually a file/folder/command that starts with what you have already typed. Can you show me the output of "ls" and then the autocomplete that isn't working?
Nope, newer versions of Mac OS just have a different default "shell" program that has a different prompt. Nothing is wrong and it won't affect anything covered in the video.
It will work roughly the same way as previous versions of Mac OS, but I believe Big Sur uses zsh as the default shell, so the "startup" file to prepare the environment is ~/.zshrc and not ~/.bashrc or ~/.bash_profile as it was in previous versions that used bash as the default shell.
In Terminal, you can increase the size of the text with Command + = (equals key). This will change the font size for that window for that session. If you close and reopen the window the size will return to the default. To change the default, go to settings (Command + ,) > Profiles and go to the "Text" tab. You can change the size of the font by clicking "Change..." under the "Font" section. Hope that helps.
You can press "Control + C" to stop running a program that's running in the terminal. Quitting the terminal window will also interrupt any commands running in that terminal window.
Wow. I just started taking a Python Bootcamp an hour ago, and it mentioned the Terminal. I came here and was amazed by how fast you can learn a new skill that you never knew existed. Great video Percy. I am a new fan of yours now.
I also started learning python some days ago and they mentioned command prompt, I had to Google for mac and found out its terminal and I found myself on this channel
JESUS CHRIST I am going for IT security and hacking, I did one IT internship while ago and I wish I knew this before my internship and this is why I’m learning cuz I’m going in the tech industry like coding, IT and more
@@zuberkariye2299 what do you use it for? I’ve only ever used it to open files and such. I don’t even do that too often as I don’t like the UI as much as say the finder or text editor. I assume you can use the terminal to access the system and do some cool stuff but I’m just curious what you do in it.
@@theknightikins9397 you can install more tools that don’t have GUI support besides cli(command line based). I will suggest you learn Linux such as Ubuntu and you will like the terminal
I didn't know anything about MacOS terminals at all and you broke it down for me so simply. Thank you so much. I screamed when I saw you could edit text on the terminal. I was shocked.
I’ve had a Mac for years and all this time I’ve been using the GUI to navigate and only recently been exposed to using the terminal, your tutorial is so easy to follow and understand. Thank you.
Honestly the terminal is the only reason mac is better then windows. Yes, i use linux btw (not arch btw, but hey i write code in neovim btw, so that's already some good bragging rights there ;-)
Where would all the computer science students that didn't know a lot about the practical stuff prior to studying computer science be without people like you? Seriously, CS is such a hard field because there is tons of stuff University will not teach you but people expect you to know. Thank you very much for this introduction to the terminal!
Thank you for the kind comment Herr Hurbig, I'm so glad the video was useful for you.
An old dilemma, or if it is an dilemma at all? I remember when a friend was looking to hire a coupple of people to their computer company some 20 years ago. After a lot of interviews of applicants from university as well as pure home hackers the only ones qualified for the task were the home hackers without any formal education in the matter. Titles are NOT a guarantee for competence. I usually say that the world have never been ruled by so many stupid people with fine titles as today, not impliing that everyone with a fine title is stupid.
You don't have to worry much because I am a computer engg graduate and ended up detailing cars for years.Nowadays, I would say that whom you know is better than what you know. I am not that dumb but I can pretend. Haha
I made a career off videos like these
Agreed!!! Awesome stuff!!! ❤❤
Just switched to a Macbook Pro that my new job gave me, always been a Windows guy. This was super helpful and not unlike windows so that was a relief.
Thanks for the comment, glad it was helpful. You may not want to go back!
There actually is a way to "go back" using cd command that is completely equivalent to what the "back" button does in Finder (which is that actually goes to previous location you've been to, not necessarily to the parent directory). It's cd - (minus). Just leaving it here cause I found it useful from time to time.
Very nice, I had forgotten about that, thanks for sharing.
oh nice, It also outputs the working directory. Appreciated.
Thank you for uploading this video, have been looking for something like this since a long time, your way of explaining things makes it extremely easy for the viewers to understand.
Hi Bibek Singh, thank you for taking the time to leave a kind comment like this. I'm very glad the video was valuable for you.
I agree with you , its just amazing 🙏❤️
it is truly a good tutorial that I had ever found, quite easy to learn and useful during working, appreciate it! hope to learn more from you
Thanks for your kind comment, glad the video was useful 🙏
great video for beginners , I am taking my first course for coding and the clases are for windows system but I use Mac , I am also taking them in spanish cause my lenguage is spanish , i speak some english better than I can understand , but your speech was very clear for me to understand this class , thank you so much i really appreciate to people like you that helps studentes like me with this stuff!! thank you thank you!!
Thank you very much for this comment, I'm very happy to hear video was helpful and easy to understand. Good luck with your course!
This is really really helpful for me as a beginner .It cleared lot of my doubts . Thank u so much for making this video.
I'm very glad it was helpful, thank you very much for your comment 🙏
Very helpful. I've used these commands before, but didn't know what they meant, just saw it in a guide (and probably why I forgot them).
This is the best straight-to-the-point bash beginner tutorial that I've found, thanks so much!
This video is awesome Percy. I was very frustrated with Terminal as I am just getting familiar and after watching this video I feel much better. it was eye opening. Thank you very much!
all confusion sorted out .thank you very much for this wonderful beginners tutorial on terminal!
You're welcome, thank you for your comment!
Excellent video! Super Easy! Thanks A LOT!
Hey hi✋🏻
Thanks for developing interest on learning terminal to someone who really finds hard /uninterested in learning command line interfaces
You're welcome, thank you for your comment Priya 🙏
This video just made EVERYTHING im doing sooo much easier dude Thank you
Yep this very much got me on track. Explained eloquently!
Thank you for your comment 🙏
Percy could you please do more videos just watch this and love it and would love to see even more advanced lessons you give amazing explanation would love to see more of your videos. I’ll be start my IT school in month and wanted get familiar with terminal and Vim and other stuff.
Thank You very much for this tutorial video. Im a beginner to this top and this video gave me full understanding and ability to work through Terminal. 🙏🙏
I'm so pleased it was useful for you, thank you so much for your comment. Good luck! 🙏
The video is amazing, super helpful thank you so much!!! Just one thing, I learned on another video the 'rmdir' command, to remove directory, which is clearly more intuitive and easy to remember than rm -r (regarding mkdir to make directory, rmdir is straightforward i think!)
But anyway, thank you so much again!
Really appreciate the positive feedback, thank you. You're right about `rmdir` being an alternative with an easier name to remember. One gotcha about `rmdir` compared to `rm -r` is that `rmdir` will not delete a directory with anything inside it (files, other directories, etc.), it has to be completely empty, which might be extremely inconvenient to achieve. `rm -r` is able to remove directories containing files and/or directories.
@@toptechskills Ohhhhh i see... thanks for the clarification!!
thanks for the video , you made it very easy to understand
Fantastic tutorial, thank you very much.
Press the 'Up arrow' will auto input ' cd .. '
And
'Ctrl + L' will auto clear the terminal...
Shortcuts make life a little easier
Useful. Great explain approach.
It's really a nice tutorial! Thanks a lot!
Thanks, It was really good espicily with mentioneing the shortcuts
Appreciate the comment, thank you
do you have a javascript course? i would love to learn from your video tutorial. your explanation is perfect.
Thank you for your comment, I don't currently have any courses but I would love to release some courses in the future. I will let you know if I do.
Thank you so much! you are an awesome teacher!!
You're very welcome, thank you for the kind comment 🙏
You the man for this. Thank you!
Thank you 🙏
as a nontechnical navy person this was fun, Thank you
That's great to hear, glad it was enjoyable, thank you for your comment 🙏
Thanks for the video tutorial. Much appreciated for the basic skills and advice
Thanks for the comment M Mikey, hope it was useful 🙏
Thank you so much, excellent video!
Thank you so much for this... Thank you.
Thank you so much! Your video was tremendously helpful! That's absolutely a resourceful guide for beginners like me!
Thank you very much for your comment Jobastien, I'm really happy to hear the video was helpful for you.
Good one! I believe RMDIR is also used to remove the directories. (Just adding some info!)
Yes, that's correct, `rmdir` behaves roughly the same as `rm -r`, except that `rmdir` will only delete empty directories (whereas `rm -r` will remove everything inside a directory and the directory itself). Thank you for adding info 🙏
damn it's really easy to understand macos as a linux user
Fantastic video. Thank you!
Thank you!
This helped me a lot. Thank you very much!
You're welcome, thank you for your comment 🙏
this is life-saving
Glad it helped Ainsley, thank you for your comment 🙏
Great video!!!
Great tutorial!
Thank you Erwin 🙏
Great tuto thanks for sharing. For cleaning the terminal CTRL + l works in Mac OS and also Linux. Maybe someone else can find it usable as well
Thanks for the tip 🙏
I wish you would of shown how to move files from one directory to another... or how to move them up to a higher level folder within the directory.
Thanks for the feedback. If anyone is curious how to do this, it's with the `mv` command: www.geeksforgeeks.org/mv-command-linux-examples/
Love this, thank you!
Awesome, thank you so much
so usefull thank you man
the notes, just keep experinting until the notes harmonise and soft good together.
Thank you,great help
You're welcome, thank you for your comment 🙏
Thanks a lot sir, it was really really helpful ✌🏼❤️
Thank you Prabh Beniwal, I'm very glad it was helpful 🙏
Omg thank you so much !!!!!!! 😊
Awesome 👏🏻
Simple and great 👍
Thank you Jeetendra Sabat 🙏
identical to linux. great video.
Thanks for the kind comment John 🙏
This is a great tutorial thank god i found you
Thank you for your kind comment Ali Razi
Thank you it was fun learning. How do i use terminal to write code?
Hi Luke, glad it was fun. You can write code in the terminal by using a command line based text editor like nano or vim to create a script file in your language of choice, then run that code. For example, if you want to write a shell script and execute it, you can do the following:
1. Create a new file called "test_script" with nano text editor:
```
nano test_script
```
2. Add a simple loop to the file:
```
for i in {1..5}; do echo "Hello $i"; done
```
3. Make the script "runnable" (executable)
```
chmod +x test_script
```
4. Run the script
```
./test_script
```
You should see:
```
Hello 1
Hello 2
Hello 3
Hello 4
Hello 5
```
You can do a similar process with other scripting languages like Ruby and Python on most systems. Hope that helps.
@@toptechskills Thanks :)
Is this the only video you made about the use of a Mac OS terminal?
P.S. thanks for sharing these contents!
Yes, this is currently the only video I have about the use of a Mac OS terminal. Thank you for your comment 🙏
I enjoyed watching the video and I wish you happiness , saudi arabia
Thank you, and the same to you 🙏
Hi, thanks for the video now I am a little better with terminal. I just got one problem, when I press tab I have a list of possible commands instead of navigating through directories. How is it possible to fix it, so I tab key would give suggestions, as it gives in your video?
It should only show commands if your command line is currently completely empty and you press tab. If you already typed a command, then space, then press tab it should autocomplete files and directories within the current directory.
I use Linux, terminal commands are really similar in both the OSs
Well spotted, both Linux and Mac OS are "POSIX-oriented" (i.e. UNIX-like) operating systems, so I would expect a lot of overlap in the commands. Some interesting reading on the subject: en.wikipedia.org/wiki/POSIX#POSIX-oriented_operating_systems. Thanks for your comment.
@@toptechskills Ohh thanks, I never knew of that 😁👍🏼
To open the Mac terminal press command and the space bar at the same time
or
Navigate in Finder to Applications
then to Utilities
and double click on Terminal
How to see where you are (print working directory)
pwd
How to open window in finder... copy the address then type
open
followed by the address that you can paste
open /Users/(your name here)
To see all the folders in the directory (list)
ls
This will give you a list of all the folders at your location
Desktop Downloads Movies Pictures
Documents Library Music Public
How to change directory
cd
then add the name of the directory
cd Movies/
How to take a step back from the current folder (.. means parent directory)
cd ..
One dot refers to the current directory
cd .
To clear the text type
clear
or Shortcut would be
command K (on the keyboard)
To get to the main directory type
cd ~
The Tilde key ~ is typed by pressing Shift and the key on the left side next to the 1 key
To create a new file type
touch
then name the file
touch test_file.txt
To open a file you created type
open
then the name of the file
open test_file.txt
To edit a file in Nano type
nano
then the name of the file
nano test_file.txt
In the terminal
press the up key on the keyboard to go through the history of your commands
To get a list of commands used type
history
To remove a file type
rm
then type the name of the file
rm test_file.txt
To create a new directory at your current location type
mkdir
then the name you want to give the directory
mkdir test_directory
To remove the directory type
rmdir
then type in the name
rmdir test_directory
To create both a folder and file at the same time type
touch
then name both the new directory and new file within the directory
touch test_directory/test_file.txt
To delete directory and all contents type (-r stands for recursive)
rm -r
then name the directory
rm -r test_directory
IMPORTANT rm does not move deleted items to the trash
Great transcript/summary, thank you!
Hello friend, your video tutorials are very good, I have a question, how can I recover or change the password of the terminal, I do not remember it ???
Thank you for your comment. Your terminal password should be the same as your user password for logging in in Mac OS. If you forgot your user password, there is a guide here from Apple: support.apple.com/en-us/HT202860
Hope that helps
Can someone explain why do we need terminal for this purpose if we can do all of this while just being on computer, for example, just right click and create directory and so on.
Thanks!
The actions in this tutorial are very basic and a lot of them are more convenient in GUI applications like Finder and TextEdit, but we have only scratched the surface of what you can do in the Terminal in this video. Some examples of things that you can do in the terminal that are no possible in a UI:
• Changing certain advanced Mac OS system settings
• Using a package manager like Homebrew (brew.sh/)
• Executing "shell scripts" to automate actions
• Logging into remote servers with SSH
• Compiling and/or running programs in various programming languages
A lot of these are much more advanced skills that require some basic familiarity with how to use the Terminal.
nice tutorial
Thank you 🙏
I am so new to this. I loved the video. Can someone help me with the restore command?
I'm glad you enjoyed the video, thank you for your comment. Which restore command do you mean?
I was just wondering what are the differences between the Linux and MacOS
This might be a good starting point: en.wikipedia.org/wiki/POSIX#POSIX-oriented_operating_systems
MacOS is POSIX certified, while Linux is "mostly POSIX compliant". In my experience using Mac OS and various distributions of Linux, they are "mostly the same", with the variation existing mainly in the installed services and "standard" way of managing things for that operating system. One example is "package management". MacOS has no default package manager installed by default, but many people use Homebrew, which must be installed manually. Debian Linux and Ubuntu use the `apt` package manager and have it installed by default, whereas Red Hat/CentOS/Fedora all use the `yum` package manager. There are also differences in things like the default firewall, service management etc.
bro thank you so much
Hi, I'm a bit late to your channel. Like this video. I was following alone and when I used ls in my user directory it listed the folders but it listed "Desktop" which wasn"t listed in finder. Could you tell me why?
It may be that the Desktop directory is "hidden" in your Finder window (although I can't think of why). Usually the "Library" directory is not shown in Finder, but is shown when you run `ls` because Finder hides the "Library" directory by default.
thank you this is awesome
Thanks for your kind comment Yolande
What’s the difference between opening in nano and vi ?
Both programs have the same purpose (edit text files), but have different interfaces. I believe nano was the default when I created this video and it can be easier to use in some ways. Both work fine for the things covered in this video.
Thank you, thank you, thank you muah
You're very welcome!
thank you
what does "-r" mean? does that means letting terminal know this is a whole folder ( and it is an option) and it can be removed?
🤔
The `-r` is the option for "recursive" (meaning it will go and delete files and directories recursively inside the directory, as well as the directory itself). You can find out more by running the command `man rm` (the `man` command is for "manual"). Scroll with your arrow keys and quit the `man` command by pressing `q`.
Hello Sir..my macbook terminal showing this error([forkpty: Device not configured]
[Could not create a new process and open a pseudo-tty.]
) i can i figure out this ..m not able to type anything on it
Great tutorial!! But I have a problem. My Volumes have names with blanks: /LaCie 40TB. Terminal.app can not find it even when I coded it in unicode Hex. Am I to dizzy?!
Hi SuperMac1963, this is a problem that I had when I started working on the command line as well. There are 2 common solutions to this problem:
1. Use a backslash to "escape" the space so that each space becomes "\ " (without quotes). This tells the shell to interpret the space as part of the argument to the command, instead of a separator between different arguments. When using autocomplete, the shell usually does this. Some examples in your case:
cd /Volumes/LaCie\ 40TB
You can also test the autocomplete by typing the following and then pressing the "tab" key:
cd /Volumes/LaCie
The shell should autocomplete the same as the first example I gave:
cd /Volumes/LaCie\ 40TB
2. Use quotation marks (" or ') to surround the path:
cd "/Volumes/LaCie 40TB"
The quotations marks force the shell to interpret everything between the quotes as a argument.
Some background to what I mean about "arguments". Most commands follow a similar format like this:
command [options] [arguments]
command --option1 --option2 argument1 argument2
ls -l /Volumes (command = "ls", options = ["-l"], arguments = ["/Volumes"]
As you can see, the thing the shell uses to distinguish between options and arguments is a space. If the argument value contains a space, you need to use one of the techniques I showed above to make sure the shell doesn't think the space is a separator between arguments. In your example above:
cd /Volumes/LaCie 40TB (command = "cd", options = [], arguments = ["LaCie", "40TB"]
cd /Volumes/LaCie\ 40TB (command = "cd", options = [], arguments = ["LaCie 40TB"]
cd "/Volumes/LaCie 40TB" (command = "cd", options = [], arguments = ["LaCie 40TB"]
Hope this is clear, thank you for your comment.
@@toptechskills Many, many thanks, Percy. I will test ist!!
Hi Percy, The second tip worked!! "cd" / Volumes / LaCie 40TB " is running! Thank you again!
Dear Percy, I have a command line I need to enter and it looks like this,
bless --folder /Volumes/WINSTALL/efi/boot --label "Install Windows"
mkdir /Volumes/WINSTALL/label
bless --folder /Volumes/WINSTALL/label --label "Windows"
My question is, do I need to eliminate all but the $ sign in order to get the first line to fit? Is it even necessary to form it this way or may I just type it out and ignore the need for 3 separate lines of code? Thanks!
Yeah, you shouldn't include any preceding "$" from any commands you're taking from a guide or something like that. The "$" in the guide is just there to show you that anything following the $ should be executed on the command line as a single command
helpful video
Thank you!
Any type of cd command gives me command not found.
Any suggestions?
Can you share the full command and error?
This app randomly opened on my macbook and im just curious as to WHY or for what types of reasons someone would want to use this application? Can it do things differently than if I were to just go in and create a folder, or navigate my mac using finder? Like what is its purpose??
That's a good question, certainly the things I covered in this video are probably easier and more convenient to do in a UI, but as you get deeper into programming, automation/scripting, system administration, DevOps, etc. these basic steps form the foundation of interacting with your (and other) computer(s) in a programmatic way or without a GUI. For example, I'm currently working as a DevOps engineer and none of the servers I deal with have GUIs, so if I need to do _anything_ on those systems, it needs to be done on the command line. The things I cover in this video are still things I do on a daily basis on these systems (often in scripts or other automation).
Maybe some others can chime in and let us know how you use these skills to do cool things either professionally or in your personal life.
For most average computer users, the command line has no real purpose. Most people aren't interested in learning cryptic looking commands.
However, like the video poster mentions, it is used extensively by IT professionals for various tasks. Some programs make extensive use of commands whereas others are exclusively command line based. Troubleshooting certain computer programs can be done only through the command line or more efficiently that way.
To give you a real world example: If you wanted to create let's say 20 folders for whatever reason, you would have to create them individually. Its not super difficult to do, but it will get tedious really quickly. On the other hand, with the terminal, you can run the following command:
mkdir Folder{1..20}
and it will automatically create 20 folders for you instantly.
There are a lot of really cool things you can do through a command line if you know what you're doing. For most people, there's usually no need to use it for most use cases.
any chance that you know how to get rid of the new MacBook Pro feature where clicking any key turns on the computer?
Sorry Edgar, I don't know of any way to do this, hope someone else can chime in if they have been able to.
Hello can I make my terminal think my MacBook pro 2011 is a 2015 + so I can download big Sur as I want to get the latest garageband and iMovie
Hmm, I'm not sure but that doesn't seem like something that you would be able to do via the terminal (to my knowledge at least).
@@toptechskills thanks anyway
Awesome tutorial! I am able to open the finder, but for some reason when I use the cd command for Movies I get the following "cd: no such file or directory: Movies" even though I see it in the finder window. Any ideas on how to fix this?
Hi Alex, I'm not 100% sure why, but my guess is that you have already moved to another directory before issuing the `cd` command. If you issue the command `cd Movies`, the `Movies` directory _must_ be inside the directory you are currently in. You can move to `Movies` from any directory you're currently in by using the "absolute path" for the directory: `cd ~/Movies` (`~` means your home directory). Another thing you can do is check what directories are available in the current directory with `ls`. Here's an article on relative and absolute paths: www.geeksforgeeks.org/absolute-relative-pathnames-unix/
Hope that helps, thanks for your comment.
@2:48
there's no "Library" in the finder. Why?
Well spotted, Finder hides this directory because I believe it considers it a "system directory". You can access the ~/Library directory in Finder by going to the "Go" menu in the title bar and holding the "Option" key. The "Library" menu item will show up and if you click it it will open the directory.
how do i find my login for terminal
The password should be the same as the one you use to log in to your Mac OS account.
my terminal doest use & but uses %
is that normal or am I missing something?
This is related to Mac OS changing the the default shell from "bash" to "zsh" since I made this video. This shouldn't affect any of the commands covered in the video. More info here: www.makeuseof.com/customize-zsh-prompt-macos-terminal/
I wrote a C program and it runs fine in a terminal window. However when I double click the icon from Finder it will not run. Any idea what the issue could be?
I'm not sure about the exact reason, but my guess is that MacOS expects binaries that are launched via the UI are GUI applications compiled in a certain way. A way around this might be to wrap the compiled C binary in a shell script, which MacOS should launch in a new terminal window.
@@toptechskills I tried wrapping it in a shell script but that did not work either. It works correctly If I drag it into a terminal window. Thanks for looking at this :-)
hi Percy ,noticed the you did not go through any file finding features. may I know the difference between mdfind / find / locate? which is the best way to search for stuff in my Mac. Thanks!
Hi Bobby Q, great question. My understanding of the 3 tools and their use cases:
mdfind - A command line interface into Mac OS's Spotlight database. Should be very fast because it's using Spotlight's file index, which indexes not only file name, but also file contents and file metadata. I rarely use this on the command line, since it's not available on other OS's and I spend most of my command line time in Linux systems. I would generally interact with this index via Finder or Spotlight, since it would give me more visual context
locate - Generally use this to quickly find the location of a program or log file when I know for a fact it exists on a system, but forgot where exactly it's installed or where it stores its file (e.g. "locate elasticsearch" to find everything file path with "elasticsearch" in the path)
find - Generally use this for all complex queries (e.g. "recursively find all files [not directories] in some directory that have not been modified for the last X days and then delete them"). Find is the most complex and most powerful, with very advanced filtering.
Thanks for the great question.
Percy Grunwald from TopTechSkills thank you for your in-depth explanation Percy. Really loving your tutorials
my promt ends with a % and not a $ so what should I do
The prompt may be different in a newer version of Mac OS, since the shell program has changed. It's nothing to worry about. There are more details here: scriptingosx.com/2019/07/moving-to-zsh-06-customizing-the-zsh-prompt/
why my terminal doesn't end with the dollar sign it ends with the percentage sign
This will sometimes vary in newer versions of Mac OS, it's not a problem, all the commands in the tutorial will work exactly the same. If you want to change your prompt, check out ss64.com/osx/syntax-prompt.html.
Auto complete is not working on my mac! What's wrong
The most common cause for autocomplete not working is that there isn't actually a file/folder/command that starts with what you have already typed. Can you show me the output of "ls" and then the autocomplete that isn't working?
hello there, i want to know how can i remove the PBC is performed? it keeps on flashing my mac book air screen. it won’t go away. help please
Sorry, not sure what PBC is, can you give more details? Someone might be able to help
Is it possible to get rid of this, because every time I log in it’s on my screen
DurrellOfficial command and q
my prompt ends in a "%" am I doing something wrong...?
Nope, newer versions of Mac OS just have a different default "shell" program that has a different prompt. Nothing is wrong and it won't affect anything covered in the video.
how to setup environment variables in Bigsur
It will work roughly the same way as previous versions of Mac OS, but I believe Big Sur uses zsh as the default shell, so the "startup" file to prepare the environment is ~/.zshrc and not ~/.bashrc or ~/.bash_profile as it was in previous versions that used bash as the default shell.
@@toptechskills I am new to Mac and don't know what's the difference while using zsh or bash. Can you create a video on this.thanks
How to make terminal letters size bigger
In Terminal, you can increase the size of the text with Command + = (equals key). This will change the font size for that window for that session. If you close and reopen the window the size will return to the default. To change the default, go to settings (Command + ,) > Profiles and go to the "Text" tab. You can change the size of the font by clicking "Change..." under the "Font" section. Hope that helps.
@@toptechskills thanks. For your help
i do exactly like the video but the result is " does not exist" any one know why
Can you share the full error?
How I stop to run a program in the terminal?🥲 so I can close terminal and Tun off my computer?😅
You can press "Control + C" to stop running a program that's running in the terminal. Quitting the terminal window will also interrupt any commands running in that terminal window.
Wow. I just started taking a Python Bootcamp an hour ago, and it mentioned the Terminal. I came here and was amazed by how fast you can learn a new skill that you never knew existed. Great video Percy. I am a new fan of yours now.
Thank you very much for your comment John, I'm really happy this was helpful, good luck in your bootcamp
@@toptechskills Your video is really helpful
I also started learning python some days ago and they mentioned command prompt, I had to Google for mac and found out its terminal and I found myself on this channel
Great information. this was very useful. Thank you
Thank you for the kind comment, very glad it was useful 🙏
Bro, this is beautiful. I have zero computer skills but you made it easy to grasp. Thoroughly enjoyed this lesson.
Thanks so much for your comment, I'm really happy it was easy for you grasp. Good luck! 🙏
I’m glad I found your channel. I can’t say I’ve found a use for terminal yet but I can say I now understand what it does. I thank you, sir.
JESUS CHRIST I am going for IT security and hacking, I did one IT internship while ago and I wish I knew this before my internship and this is why I’m learning cuz I’m going in the tech industry like coding, IT and more
@@zuberkariye2299 what do you use it for? I’ve only ever used it to open files and such. I don’t even do that too often as I don’t like the UI as much as say the finder or text editor. I assume you can use the terminal to access the system and do some cool stuff but I’m just curious what you do in it.
@@theknightikins9397 you can install more tools that don’t have GUI support besides cli(command line based). I will suggest you learn Linux such as Ubuntu and you will like the terminal
@⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻ sudo same I am here trying to create a zip file with a password and then crack it
@⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻ sudo I seen you on SecurityFWD channel yesterday
I didn't know anything about MacOS terminals at all and you broke it down for me so simply. Thank you so much. I screamed when I saw you could edit text on the terminal. I was shocked.
This was really well done! would be amazing to see a guide to installing software (pip, python etc) and talk about bash and shell
Thanks for your kind words, Snow. Hope to get back into making content like this in future.
I’ve had a Mac for years and all this time I’ve been using the GUI to navigate and only recently been exposed to using the terminal, your tutorial is so easy to follow and understand. Thank you.
Honestly the terminal is the only reason mac is better then windows.
Yes, i use linux btw (not arch btw, but hey i write code in neovim btw, so that's already some good bragging rights there ;-)