Posted on

Learn Python Episode #4: Running Scripts in Terminal

Enroll in The Complete Python 3 Course: Beginner to Advanced!

Click here to subscribe for more videos like this!

So, let’s go ahead and create a Python script and learn how to run it. So, I’m going to be doing this in terminal completely we will discuss other options later, what I need to do first is change directory into “pycharm projects” and there’s nothing really in here so I’m going to create a file using the nano text editor, you guys don’t have to follow along, however if you want to that’s great too. I’m just going to call it test.py. Now all Python scripts need to have the .py extension. So, what we’re going to do is just a simple, simple script it’s going to print “hello world” So, I’m going to control + O to save, and control + C to exit, control + X to exit. Alright, now if we just type “test.py” you’ll see BASH doesn’t know what to do with this command because test.py is not an installed program. So what we need to do is run “python3 test.py” and it will return the result of anything in that script. So, that’s how to run python scripts, in the next video what we’re going to be doing is setting up an actual work environment using an IDE, and get you guys all ready to start with the basics.

Posted on

Learn Python Episode #3: Interpreted vs Compiled Programming Language

Enroll in The Complete Python 3 Course: Beginner to Advanced!

Click here to subscribe for more videos like this!

So, the interpreter, and this is going to be a short video I think, but we’re basically going to talk about the difference between an interpreted programming language and compiled programming language, and this might be a little adept for the novice programmer but just stick with us again if you have any questions or not sure if you completely understand it, there’s a discussion section to the right of this video, yes should be right to the right of this video, so use that and I will try and clear up any confusion. So, first, with a compiled programming language you write your code and you save it into this file, and you can’t run that file yet. Let’s say you’re writing C++ code, so you write a function, you write a script that will do something. If you try and open that file with the .cpp extension, which is for C++ files, it is just going to open that in a text editor or code editor because that’s not an executable file. What you need to do with a compiled programming language is once you save your file you need to compile it into a language that the computer can read, so binary ones and zeros, and by compiling this file into an executable file, then you can double click it and it will run. So, if you’re on Windows building executable files for windows they will have a .exe extension. If you’re on Linux I don’t believe they have an extension. So, the difference here is with Python when you write a script you can instantaneously run that script without having to compile it into binary and because we can do that what’s actually happening is when you run the Python command you’re not running the file standalone. So, when you compile a programming file into a binary file you can just type the name of that file in the terminal or command prompt and hit enter and it will run that program as a standalone program because the computer already knows how to run it, but when you run Python scripts you’re going to run it with the Python command and then the name of the file, and what basically happens is you’re running the program Python which is interpreting your code and running that. So, what happens is it does compile into binary but it does what’s called just-in-time compilation, and what that does is every time you run its going to parse all the code and it’s going to convert it into a temporary file and then run that temporary file. So, let me break out of this, there. So, how you would run a script and we’re going to talk about that later but basically how to enter the interpreter on its own you just type python3 to use the three version of Python you can see the version we are using Python 3.5.1. So, basically in the interpreter you can run real time code, so if I were to type “print hello world” it’s going to instantaneously run that line of code. If I run “4 + 6” it’s going to return 10 because that’s the sum of four and six, and so the interpreter is great to use if you want to test something really quick, if you want to debug a few lines of code, or if you just want to see if something would actually work. So, we’re going to be starting out using the interpreter but as things get a little more complex we’re going to get into writing scripts and executing those scripts. So, now we need to learn how to run a Python script.

Posted on

Learn Python Episode #1: Mac/Linux Installation

Enroll in The Complete Python 3 Course: Beginner to Advanced!

Click here to subscribe for more videos like this!

So, the first thing that we need to do to get into programming in Python is installing it. So, let’s go ahead and discuss about the three different ways that you’re going to be installing it. First, we’re going to cover Mac because that’s what i’m using and so it’s easiest to show you how to do it. So, what you’re going to do is open up terminal which I’ve moved into that folder and put right here. Now, if you haven’t installed Homebrew, what you’re going to do is run a Ruby command that’s going to download and set it up. So, basically what Homebrew is, is a package manager that you can use to install a lot of packages. So, if you’re used to Linux basically on Linux if you want to install a package you don’t need to go all around the internet and search for packages on websites and then download from shady sources and get viruses, that’s just a bad construct of computer operating systems, but unfortunately that’s how Windows works and so i’m going to show you guys the right way to install in Windows as well. Using Linux or OS 10 you’re going to be installing through terminal. So, first setup Homebrew, this is how you do it, come to brew.sh and it’s going to give you this line of code here. You just paste this in terminal, run it, it’s going to install brew. Once you’ve got brew installed what you’re going to do is run “brew install python” Now that’s how easy it is. OS 10 does ship with a version of Python but the the version included in OS 10 is 2.7 series and I think it’s actually an old really something that’s like to 2.7.5 or something like that so it’s pretty old. At least I think it was that. We can actually run “–python version” here, so okay so the version that OS 10 El Capitan ships with is 2.7.10. When you run brew install Python it’s going to install python 3, that’s the command that we’re going to have to be using because there’s already a Python version installed, so we’re going to be using Python 3 and you can check the version we’ve got 3.5.1 that’s the version that homebrew is going to install for you. Now similarly if you’re on Linux what you would do there’s a few different ways because there’s a few different package managers. So if you’re on Arch Linux I don’t think you’re gonna need help setting it up, and actually a lot of Linux distributions have Python/Python 3 pre-installed, so you can just run “python –version” and “python3 –version” and see what version you have installed, you might need to upgrade, it it might be fine. If you have 3.4 you can follow along with this course I don’t think there’s that many differences between the two versions and there’s definitely not code-breaking differences, so that shouldn’t be a problem. However, if you do notice that you’re having a problem you could upgrade the version of Python either through the repository or otherwise. If you’re on Ubuntu you’re gonna be using the apt-get command, so you’d run “sudo apt-get install python3” That’s going to install Python 3 for you. If you’re on Fedora I believe it used to be yum, I think it’s dnf now. Yeah, so let’s just review exactly what commands you’re going to be using, I think it’s like dnf install. So, you can still use yum I guess, ok so you can use yum to install. So, what you’re gonna do is we’re gonna run “sudo yum install” and then I believe the package is just called python3, Python 4 is going to be pretty amazing but right now we’re using Python 3. So, there we go. Now if you’re on Arch and I said I don’t think you need any help getting it setup but just for you know if you are new to Arch you’d run “sudo pacman -S python3” but again python3 should be pre-installed, so you shouldn’t even need to do any of this but if you do that’s gonna do it. Now on Windows you do need to go download a file from the internet and run it, the the difference between what I said before what I’m saying now is this is not a shady location. So, what you’re going to do is go to python.org, go to the download sections, and if you just hover over this it’s actually going to show you a drop-down and you can choose what platform you’re on. So you would choose windows and they actually have a 3.6 which we’re not going to we’re not going to be using because this is in alpha. So, click latest python3 release python 3.5.1, it’s going to take you to this page and basically give you a changelog and whatnot. If you go down here make sure you get the version that’s compatible with your system. If you have a computer that is not obsolete it should be running a 64-bit operating system which means it has a 64-bit processor. So you would download this one right here, Windows x86 64 executable and what that’s going to download is an .exe file which you can use to install the program. If you’re running a 32-bit system you’re going to download this one just the x86, and yeah just install it. Now, there is one note on the installation, when you run the installation there’s going to be a certain step where you have some checkboxes and one of them is going to say add python to the path variable, make sure that’s checked because if it’s not checked if you try to run Python in the command line you won’t be able to because it won’t know where to find this mysterious Python command. So, by checking that box basically it tells windows where the Python binary file is located, so you want to make sure Windows is aware of where that file is. And that’s all there is to installing it. To confirm that you’ve got it installed open up a command prompt to terminal and just type Python3 and it should drop you down into the interpreter, which we’re going to be discussing in the next video.

Posted on 1 Comment

Complete Meteor.js Web Development Tutorial

Enroll in the complete course for only $9!

https://josephdelgadillo.com/product/ubuntu-linux/

Click here to subscribe for more videos like this!

Hey guys, I want to touch briefly on Meteor.js, today in this video, and a little bit about how to use it. First thing you’re going to do is in a Google search just type “install meteor.” It’s going to give us the location of the Meteor installer to download. If you’re on OSX or Linux, just copy this command “curl https://install.meteor.com/ | sh“ open up Terminal, clear it out, and then paste it in here. If you get this error, it means that you don’t have curl installed so you need to install it. So sudo apt-get install curl” and once curl is setup you can run the previous command again. And it’s going to download Meteor and install it. I already have Meteor installed and so it’s removing my existing meteor installation, and it’s going to download a new one. So, when Meteor is done installing it gives you a notice here, how to get started. So, let’s just create an app, do I have a projects directory already, I do. So, I want to change directory to projects and I’m going to type, Meteor, create to do and it’s going to create project and a project directory in my current directory called “to do”. So, I’m going to change directory, and then if I list the directory Meteor has created the three files to get you started. So I can type “meteor” and it’s going to launch the program on port 3000, there we go. So, once again, this message means the app has been launched, so you can go to local hosts on port 3000 and this is our Meteor app. It’s got an event handler here for the click me button, which counts the times it’s been pressed, but that doesn’t really look to great. So I’m going to close this here, show you how you add packages to Meteor. So you type “meteor add” and then the package name. So you can browse Meteor packages by going to Atmospherejs.com, and if I were looking for say, bootstrap, I would…there is a lot here. However, the official bootstrap module or package is “add twbs:” stands for twitter bootstrap and then “bootstrap”. So, when I add that to my project like this, and let me go into the filemanager here, into projects, and to do, and you’ll going to see these three files that it created for us. But if you hit Control+H you’re going to also see a hidden directory entitled Meteor, and this is where it stores the packages that we add, and some internal Meteor stuff as well. So, I’m not going into that. These are the files that you’ll be working in with Meteor so you can open for instance, the HTML file with the “gedit” here we go. And you’ll see, this is the mark up. So, Meteor works with templates a lot. This isn’t an in depth tutorial, but more about how to get started. Meteor has a pretty awesome tutorial on their website. Just go to meteor.com and you can access the documentation, reference points, and the tutorial to get you started. So, that’s the basic usage of Meteor in the command line. Typically, it’s just Meteor create in the App name, and once you’re on the app directory just run Meteor to run the application, and you can use the Meteor add or Meteor remove, if you want to remove a package, add to add a package and then the package name. So, thanks for reading this and I hope you guys found it informative and a good place to start with Meteor. A selling point for Meteor is the fact that realtime interactions are built into its core. So, you no longer have to fake it, with Javascript, Ajax calls to PHP scripts, everything is done in Javascript, it’s all realtime. So, It’s awesome to work with and it makes things easy as well. So, check that out, if you’re into web application development at all.

Posted on 2 Comments

Complete Linux Networking Tutorial

Get The Complete Linux Administration Course Bundle!
https://josephdelgadillo.com/product/linux-course-bundle/

Enroll in the courses directly on Udemy!

A Beginner’s Guide to Linux System Administration!
http://bit.ly/2gHV6dD

CentOS and Red Hat Linux to Certified System Administrator!
http://bit.ly/2h7ONwE

BASH Programming Course: Master the Linux Command Line!
http://bit.ly/2y4GyY8

The Complete Wireshark Course: Go From Beginner to Advanced!
http://bit.ly/2yLpqIy

In this video we’re not going to be doing anything, we’re not gonna be learning about networking specifically on Linux. We need to understand a few general concepts before we get to that. So, this video is going to be a sort of introduction to networking on Linux. An introduction to networking in general. So, right now you are on a computerized device watching this video which is on the Internet. And the way that’s happening is basically you’re connected to a router, or a modem router all-in-one device, and the router is connected to your internet service provider, and your internet service provider has devices that are connected to the bigger world of the internet. So, you send a request, if you open up a browser and type in google.com and then hit enter, your web browser sends that as a request. It’s basically saying okay this is the web page that this computer wants to look at right now. It sends that through your router, which sends it to your internet service provider, and your internet service provider has all these fancy computers that properly route certain requests to DNS servers, any requests actually. What a DNS server does is it says okay, you gave me this string of text, a domain name or URL, and I have a record here that shows this domain or string of texts is supposed to serve up the content at this IP address. And so how the internet works is it doesn’t understand Google.com or Facebook.com. The internet uses network addresses, right, and so think of it like each web server, each server out there has and address just like every house on your street has an address. So, if you were gonna send somebody down the street to Joe’s place, you would say okay well go to this address, then you would give them the address of Joe’s place and they would be able to find it. The same thing is happening on a DNS server. You give the DNS server a domain name that you want to look at, and then th the DNS server takes that and says okay well I know this domain name is supposed to route to this IP address. So, you request, you need to go over to the server to get that content, and so your request then gets translated to an IP address and other information, and it gets to the web server that it’s supposed to be at. And then the web server running Apache or anything really nginx, I’m sure there’s tons out there that I don’t know about, but the web server receives requests, it receives all of the information related to it. So, cookies you know session variable stuff like that as well as the exact item you want to look at it. So, if you go to website.com/something /something else, everything after the .com/ is called a URI and that indicates what piece of content on the server you want. So, think of the first part domain.com as what server you need to be communicating with, and then afterwards you know /about.php or something that’s gonna tell the server once it gets the request what page it needs to send you. And then it does it’s you know rendering process and it sends you that page in the exact same route that your request took to get there. So, it’s like when you send your friend down the street to Joe’s place to pick up a box of pizza. So, your friend walks down the street he turns left you know maybe turns right, he gets to Joe’s place, he walks in says hey I need to get a pizza, Joe gives him the pizza, then he walks same way back to your house, and before you know it a web page has loaded within your computer box. That’s how that happens. I hope you guys understood that. In the next video we’re actually gonna cover a few more concepts before we dive into you know really understanding to the point that we can use applications to do certain things. So, I hope you guys found that informative. If you didn’t, if there’s any point in this video that you felt lost, or confused, or even that I was just rambling, or even if you just want to tell me you know a few more web server applications aside from Apache, there is a comment section to the side of this video. You just leave a comment I will reply and get you whatever information you need, and hopefully this will make sense to you. So, in the last video we described how the internet works, what the internet is, is technically an interconnected collection of networks. So, all these little networks all over the world can now be connected to other networks in the world, and so we have the internet which is just that. So, to understand the network here we’re bringing it down from you know the top level stuff, down to a more localized thing. And so a local network is the type of network that you have set up in your house, where you connect to the router, the router then you know can interact with the internet for you, and then return the information to you computer. Now, I wanted to talk for a moment about IP addresses and the current issues that face them, while still using ipv4. So, let’s open up a document here. So, an IP address looks like this. This is an IP address of a server somewhere, probably, if you put this in your browser…actually let’s try. That was just a random one that I just wrote up, let’s see what happens. This is probably the address of somebody, somebody you know, somebody is connected to an internet service provider and they get one IP address for all their computers, and the reason why that happens is because these IP addresses can go from 1.1.1.1 all the way to 255. So, as you can imagine the range is pretty big but it’s not quite big enough for the human population, and so we’ve been running out of IP addresses for the last fifteen or twenty years. And, multiple solutions have been brought into the equation to try and solve this problem. One of them was called a NAT. What this is is a network address. Basically, you have one router you have one IP address. So, the IP address you have let’s say is this one up here at the top, this is your IP address that the internet service provider has given you. Without the use of a router you can plug one device into the modem and your computer will use this IP address in requests, so basically when you send a request to google.com to load a page or to load a search what happens is your IP address gets sent to Google as well so that Google can return this data to your device. But, what happens when you only have one IP address and seven computers, that’s when the NAT comes into play. So, this IP address now is the IP address of your modem or router, and it assigns NAT addresses to all the devices on your network. So, let’s say you just have two devices on the network. The first one, actually the IP address of your actual router is likely this. I’ve seen one instance where a network did not use this IP address as its routers IP address. The IP addresses that your router will assign to computers in your home all begin with 192. So, basically it would be something like that, right, that would be the IP address, actually hold up I got this wrong. This is the IP address of your router, this is the IP address of your first computer. So, it always begins with 192.168 Your second computer might be this, and your 3rd computer might be this. So, now you have three IP addresses, three devices on your network and your router here is keeping track of them. So, from this device I type google.com into the address bar, what happens is this IP address along with the request gets sent to my router, the router then sends the request off to the ISP and then over to the internet and stuff, with the IP address of the router which internally is this and externally this is our ISP IP address they gave us. So, what happens this gets sent to google.com, google.com sends the page back to this IP address connected to the router here, the router then takes that request and connects it with the device that requested it, and then it sends it back to that device. And so that’s how a router interfaces between a local network and the internet. So, in the olden days before the NAT address and routers really took off each one of these computers would have had a different IP address, so it would have looked something like this. So, that would have been 3 actual IP addresses when we found a way that you actually only need one IP address for our network, and so that’s what a router does and so these IP addresses are local and you’re gonna see these in terminal. Now, one other special IP address is 127.0.0.1 On every computer this means this computer. It’s basically a self identifying IP address. If I were to type this into my browser I would see my localhost, where if you put this in your browser you would see your localhost. The NAT IP address basically works the same way. So, if I were to go to 192.168.0.3 it would try to find a computer only on my network that has this address and then connect to it. So, that’s how a router works, in the next video we’re getting into the ifconfig. On Windows you have an ipconfig command, on Linux here you’ve got ifconfig and we’re gonna cover that in the next video, and a a few other commands as well. So, thank you guys so much for watching, and I’ll see you guys soon.

Posted on 2 Comments

Complete Python 3 Programming Tutorial

Enroll in The Complete Python Course: Beginner to Advanced on Udemy
http://bit.ly/2yMsS7v/

Check out the Learn to Code Course Bundle!
https://josephdelgadillo.com/product/learn-to-code-course-bundle/

Hello everyone and welcome to the Python tutorial that we’re going to be doing. My name is Nick and I’m going to be the instructor for this course, and it’s going to be my job to get you completely immersed in the Python programming language. Now, this course is going to be aimed at somebody who may have basic knowledge about what a programming language is but this would be your first programming language, and this is a great programming language to start with. It does have some limitations and sometimes this is not the right tool for the job, but a lot of times this offers people who have no experience programming a really great way of understanding what a programming language is and how to use one. So, the main differences between Python and other languages like C++, or C, or Java is that Python is built around two main focal points which I believe are code readability and simplicity. So, we’re gonna jump into the language here and in a few videos but we need to do a few things first. First we need to discuss what Python is, and then we need to get it installed, and then we can start discussing you know what’s an interpreter, how do you run a Python script, and then get into the language itself. Now, the language is different but it’s easy, and once we get past an understanding of how the programming language works, and the syntax, and all the different stuff you do with it, we’re going to move on to actually programming real applications and showing you guys different practical applications of the Python programming language. So, for instance, we’re going to be building a website, we’re going to be building a web scraper, and a graphical utility we’re actually going to be building multiple graphical tools because there are a few different graphical or GUI, GUI, whatever you want to call it there’s a few different frameworks for Python that we could use. So we’re going to explore three of them. So, right off the bat here’s a fun fact if you didn’t know python is actually named after Monty Python who’s made some great films, so if you if you haven’t seen Search for the Holy Grail or the Life of Brian go do it, they’re great movies, which is completely beside the point. So, Python is actually a pretty old programming language. It was first introduced in 1991 which makes it 25 years old. There’s two current versions, now this may be confusing as well, so there’s a Python 2 series and there’s a Python 3 series. The Python 2 is currently at 2.7.11 and the 3 series is at 3.5.1. Now we’re going to be using Python 3 in this course however Python 2 shouldn’t be much different if afterward you want to explore using Python 2 that’s completely acceptable. Now as I said Python is based around simplicity and readability and this means that when you look at Python code it’s all indentation based. So, if you looked at another code like Java you would see a lot of curly braces, and brackets, and a lot of things that are just there to confuse the novice programmer. Python is based on indentation so you don’t need to wrap blocks of code in curly braces and you guys will see what I mean coming up in the next few videos. So, that’s all we’re going to talk about today. I hope you guys enjoy this course and find it useful. There’s a comment section to the right for each video if you guys ever feel that you’re not too sure on something that I explained, or maybe you had some input in addition to what I explained, feel free to use that. So, yeah, let’s get started!

Posted on

How to Setup an SSH Host on Your Local Machine

Click here to subscribe for more videos like this!

So, the last video that we’re doing is setting up an SSH host on our local machine, and it’s really simple. So, let’s go ahead and open up terminal. We need to install openssh-server. So, go ahead and run “sudo apt-get install openssh-server” I believe it is. We’ll get an error message if that’s not it’s been awhile since I did this, so. Once we have it installed you’re basically good to go, however we are going to make it a little more secure. We’re gonna change the port that this runs on and so there is an SSH deconfig file now. Let’s go ahead and run “sudo nano /etc/ssh/ssd_config” So, we can go ahead and make this more secure by changing the port and also changing the authentication stuff. So, let’s go ahead and change the port to 2212 instead of the default 22, and then we’re going to scroll down here a bit, and under authentication here we’re going to change permit root login to no, so nobody’s gonna be able to login as root. Scroll down a bit here as well, and we’re going to add a line this is allow users, and this is going to take basically a list of usernames of users who are allowed to log in through SSH. So, I’m going to make my user account able to login through SSH and this is going to restrict all other users from connecting to this machine via SSH. So, I’m going to save it and exit, gonna clear this up, and then what we need to do is restart the SSH service. So, run “sudo systemctl restart ssh” and you’re good to go. And so now if I were on a different machine here, actually let’s see if I can get my external IP address here, I don’t think I can get it through here, no. Alright, clear this. I’m gonna open up network-tools and I’m gonna do something like if you guys have seen the movie Inception, this concept that I’m about to do will feel a little little bit familiar to you. This by the way when you go to network-tools.com the IP address that pops into the input field by default is your external your public facing IP address. This is the IP address that your internet service provider gives to you. Now, actually in order for this to work, this would have to be the only machine or I would have to set up through the router DMOZ port forwarding or a host forwarding, but what we can try, we’re gonna try it anyway. I’m going to
“ssh [email protected]” and then from here I’m going to ssh into this machine. It probably won’t forward that port. So, I would have to go through my router at this point to configure port forwarding for that port 2212 in order to be able to connect from an external host to this host. If you only have one machine, so basically like the IP address of my server when I, when I go to the IP address, it goes directly to my server. It’s not configured through NAT addresses my server actually has five IP addresses, and those IP addresses go directly to my server, and that’s why I can access SSH on that server without having to configure any routers or anything. I think actually the server provider manage that in some way. So, anyway you know if I were to go into my router and configure DMOZ or port forwarding, what I was just doing would in fact work. So, thank you guys so much for watching, and I will see you guys again soon.

Posted on

How to Transfer Files Between 2 Computers Using SFTP

Click here to subscribe for more videos like this!

Hey guys, let’s go over some SFTP. So, first what is SSTP? Well first before we answer that question, let’s ask a similar but different question, what is FTP? FTP is an acronym for the term file transfer protocol and it uses the port 21, and basically what it does is it transfers files between two machines. So, SFTP, because in regular FTP everything is transferred in clear text, so if anybody is sniffing packets on your network like we learned in a previous video, they would be able to read all those packets, basically. So, we’re not going to use FTP, I actually recommend never use FTP. SFTP is just easier anyway, and so we’re just going to use SFTP. So, similarly to the “ssh” command, you’re gonna write “sftp” and then the connection string. So, in my case it’s exactly the same as before. Then it asks for my password for the remote host, so I’m gonna put that in here, and now I can list what’s on the remote host by typing “ls” but we also have a few different commands to list what’s on the local host. I’m actually gonna exit here. I’m going to make a directory called “sftp-demo” I’m going to change into sftp-demo, and I’m going to “touch” a file called “names.txt.” Now, I’m going to reconnect while in this directory, to my server. Now, if I run “ls” I get the remote directories current directory listing, if I type “lls” I get the local listing of the directory that I’m in on the local host. And so here we can actually, we can grab files and transfer them to and from both machines. So, if I wanted to put names.text on to the server in the current directory, what I would do is type “put names.txt” and it’s going to upload it to my remote host with the same name. So, that’s when you would use “put” if you want to push a file from from your local machine to the remote host. Similarly, use the command “get” to get files. So, I’m going to, I really don’t recall any of these files, I’m just gonna get the composer.json file. So, I’m going to type “get composer.json” and if I run “lls” on my local machine I can now see that I have that file there. So, if I exit and then run “ls” I’ve got that file there. So, that is how you would use SFTP to transfer files to and from machines, and also a few commands there that can help you see what files are available. So, thank you guys so much for watching, and I will see you guys again soon.

Posted on

Using SSH to Access the Command Line of a Remote Host

Click here to subscribe for more videos like this!

Hey guys, in this video it’s all about SSH. So, first what is SSH? It’s an abbreviation that stands for Secure Shell and it basically allows you to access the shell or the command line of a remote host that has an SSH server setup. So, in one of the previous videos I connected via SSH to my own server and so I’m gonna do that again, and I’m going to explain exactly what I’m doing as I’m doing it. So, the way to get connected to a remote host through command line is using the “ssh” command, and then the only argument it’s gonna take is the connection string. So, in this case it’s my username on my remote host at, and then the remote host. So, I can use this or any other domain name that points to that server or I could use the server’s IP address, and when I hit enter it’s gonna ask for my password on that machine, so I’m gonna put it in and you’re gonna see that the prompt is gonna change. I’ve actually got this machine named the exact same thing is I have my server name, so it’s nick@voltron here, and I’m on my local machine. So, if I were to go to “var/www/html” and then run the “ls” command, I’m gonna see that I’ve got a lot of directories here actually, and a lot of these are actually unused and old projects that I worked on. But, anyway, basically once you get connected all the commands are the exact same because it’s essentially just a remote Linux shell. So, I could return to my home directory, then list those files, and you’ll see that again I’ve got just a bunch of random files. So, that is how to connect to SSH, when you’re done just type exit the connection will be closed. So, that was a really short video just to recap how to get connected is type “ssh” your remote user name at the name of the remote host, and hit enter and its gonna ask for your password. So, thank you guys for watching this video. In the next video we are going to be going over some SFTP, which is a bit bigger.

Posted on

How to Scan External Host Names & IP Addresses using Nmap

Click here to subscribe for more videos like this!

So, now you don’t only have to scan devices on your local network, you can
also scan external IP addresses or host names. So, I’m going to scan my server here by typing “nmap pointybracket.net” and then the host name of my server. It’s gonna take a moment and I’ve got a lot of open ports just because I have so many different things running. I’ve got, there’s a lot of things that run on it and some things that I just setup that I’ve never really used and haven’t bothered to shut them down, and so what we get here is my host and we can see that I’ve got FTP, SSH, SMTP, we’ve got the standard domain in HTTP, pop3, there’s a bunch of stuff here and I’m not going to go into what all those are but we can see that these are everything that the server has. You can also set a file, so let me clear this. Let’s open up gedit. So, we’re going to create a file of of hosts that we want to regularly scan and this can save time when we scan them if you’ve got like you know a few hosts that you regularly check on. So, I’m going to put “pointybracket.net” “192.168.0.1” and “192.168.0.100” and I’m gonna save this as “networks.txt” So, what we can do there is we can type “nmap -iL -/networks.txt.” so it’s a lowercase “i” and a capital “L” and then the location of that file, so it was “networks.txt” in my home directory. This is going to scan each of the hosts that is in that networks file. It returns in the order that they were scanned in, so that’s pretty neat. I want to go over a few more things with you guys regarding this command it does get pretty big there’s so much so that you can do with this, and so I really urge you guys to go and explore this if networking is one of your interests, if you want to really you know follow that. One of the things I want to show you guys is how we can turn on OS inversion detection during the scan, and so what we’re going to do is type “nmap -A 192.168.0-100” and this is going to scan, oh I had a little typo in the IP address there so I had just fix that, so this should tell me the operating system versions that are running on the devices on my network, and you can also find this information about other hosts. Aside from this, just while this is running you can scan aa network and find out which servers and devices are up and running by using the flag “-sP” You can display the reason that a port is in a particular state by having the flag “–reason” You can choose to only show opened ports which appears to be the default functionality here, it doesn’t show the closed ports. You can actually also show all of the host interfaces for a machine by typing “–iflist” in the list of arguments for this command, and I mean again it’s really big so go ahead and look this up. If you wanna type in google.com “nmap commands” there’s a bunch of different ones that you guys should play around with, this was more of an introduction onto the most common or basic functionalities of this program. I’m going to cancel this here and I’m just going to restart. This will go a bit faster, I’m just going to target my own IP address here so we can get this done and you guys can see the example output that this is gonna do when adding the “-A” slag in here. So, here you can see a lot of information about this machine. Let’s go to the top here. We’ve got the port, the state, and the service, as well as the version of the service. So, I have Apache 2.4.12 installed and that’s also the same one here. If we go down we get more information about the host cell, so we have OS UNIX, we’ve got the computer name, the domain name if anything is configured, the fully qualified domain name, and just a lot more information. So, that is the nmap command and it would be useful if you’re trying to just scan your network, and one of the examples that comes off the top of my head that would be you know when I would use command is if I noticed that the internet’s you know running a bit slow. Let’s say I’ve got 10 people in my house and half of them may or may not be using the internet and I wanna see how many people are online, this is what I would do in that instance or if you you know if you want to check how many machines offer a certain service, or what the IP address is that you need to use to access a certain service on another machine, this would help you figure that out. So, thank you guys for watching this video, I will see you guys again soon.