Linux on Windows. Wow
and Windows on Linux. This is WSL or the Windows
subsystem for Linux. In two minutes, I'm going to have two flavors of
Linux running on your Windows machine, Ubuntu and Calli Linux for the Hackers
gooey support GPU Access shared files between Windows and Linux. You can use Linux commands on Windows
and Windows commands and Linux. It's crazy. It's like Linux and Windows
became one person. Is it too powerful? Yes, it is. And even if
you think you know WSL, everything there is to know about it, I bet you in this video you're going
to learn something new. In fact, that's a challenge. If you watch this
video and you don't learn anything, I give you permission to lead a mean
comment about me. Really make it personal. Attack me as a person. I'm giving you
permission. Get your coffee ready, let's go. Okay, before we go crazy,
let's talk about what you need. Who can run WSL two? And by the way,
this is WSL two. There was a one. This one is obviously
better for hardware one, A 64 bit processor and ARM is supported. You'll want a minimum of four gigs
of ram and like anything in it, any project I've covered, the
more RAM you have, the better. You'll probably have the best time with
16 or higher. Now, before we move on, if you don't already have it enabled, you'll need to jump into your bios and
enable virtualization because WSL two uses lightweight virtual machines. So
reboot your computer, jump into your bios. You'll either hit Escape or F two or
F 10 or something. It'll tell you. And if you have an Intel processor, look for something called Intel VTX
and enable that. If you have a MD, look for A MDV that will enable
virtualization and you'll be all set. WSL doesn't need much, so I
hope this includes most people. Let's talk about software. Now, of
course, you'll want to be running Windows. This is Linux on Windows, but what flavor? You will 100% have the best time
if you're running Windows 11, if you're still holding the line
at Windows 10, you are supported, but you got to be at bill 19 0 4
1, I almost forgot it or higher. You can very quickly check that by
going to your search bar and tapping in W-I-N-V-E-R for win there and
it should show you right there. Hopefully you see a big Windows
11 there. And of course, there's one more thing you need coffee. Everything in it requires
coffee network coffee. Now here comes the two minute WSL install. First you'll launch your Windows
terminal. We'll just go to our search bar, type in terminal and it
should be this guy right here. Now we're about to install
it with one command, but just know this user account
you're using for me. It's me, Chuck. It does need admin privileges. You'll find out real quick if you don't
have them because this command will not work. Type this in with
me. WSL dash dash install. That's literally all we have
to do. Now to install WSL, it was much harder before. Check this
out, hit enter. You'll get a UAC prompt. Just say a yes and it's doing it. It first enables the virtual
machine platform service. Another UAC prompt will click yes. Now it's installing the Windows subsystem
for Linux. It's going pretty quick. Actually, I noticed it is installing
Ubuntu. That's the default distro. And now that it's done, we're going to go ahead and restart
because it told us to just close this out and reboot your pc. Okay, once
your computer has rebooted, you should arrive here i's going
to ask you to set up a username. I'll put in my network Chuck and then
set up a password and just that I'm inside Linux, I'm in Ubuntu. Now we can leave WSL by typing in exit
or just by simply closing the window, but it's always there. We can launch our terminal once more
and by default it's going to launch you right back into PowerShell.
To launch Ubuntu again, just type in WSL dash D
and Ubuntu. We're back in. Let's type in exit to get out and we
can install more than just Ubuntu. Watch this. Type in WSL dash
dash list, dash dash online. This will show you all the available
distros that you can download and install. One I care about is Cali Linux,
the hacking Linux distro. Now we could install that right here
from the command line similar to Ubuntu, but it gave me some problems. Lemme
show you a better way to do it. Did you know you can install these
things right from the Window Store? Watch this, we'll go to our search bar and type in
store and launch the Microsoft store here. I'm simply going to
search for Callie Linux in
the search bar off the top. Hit enter, and there it is. Now it says
I already have it installed. It's lying. I don't know why. We'll
go and click on that. You should see the option to
install where mine says Open Liar. Go ahead and click on whatever your
option is and it should install and launch another terminal similar
to how it did with Ubuntu. Prompting you for a username and a
password. And now I'm in Cali Linux. We can launch Ubuntu at the
same time. Open up another tab. Type in WSL dash D and the name of your
distro Ubuntu. If you spell it right, it'll open. Now we're running Ubuntu
and Cali Linux and Windows side by side. Now, right now Cali Linux has no tools
installed. It's a minimal install. Let's change that. Run the command Cali
dash tweaks and we get a nice menu. Let's click on mata packages. Just use
your directional arrows and go down, hit enter. Put your pseudo password in, which will be the password you set
for the system. And let's install. Call Lin's top 10 tools. Scroll down, hit space bar To select it tab
hit enter to apply and hit okay and hit enter. Again, it's going to ask you a few times
maybe perfect time for a coffee break. Now actually while it's doing that,
what do you see? We play a new Ubuntu. I want to show you a few cool things like
first how we can run a Windows command inside Linux. Watch this. IP config is how you find out what your
IP address is in the Windows command prompt. I can run that
right here inside Linux. What I can use the Windows Ping, ping
exe. I can open files with Notepad. If I add EXE at the end exe, I can even open up my current
location and side Windows Explorer, type in explorer exe type
in dot right after that. These are my Linux files right here
inside Windows Explorer. That's nuts. Let's reverse it. Let's go to PowerShell.
Open up a new PowerShell window. This is all Windows. I
can type in IP config, which will give me my IP addresses,
but I can filter using a Linux command. I type in IP config. I'll pipe out a pipe and then type in WSL
to invoke a Linux command and I'll say GR four 10 dot. How cool
is that? By the way, GR is a Linux based command to filter
based on search. It does more than that, but that's just one thing I
can use the Linux CAT command, WSL Cat and then my file name. It's like Linux and Windows have
become one person and I'm here for it. Now this might take a minute. It did
for me. I just got some more coffee. No big deal. We'll just
tab over and quit that. Now you should have a few more
call Linux tools. Now there is one. Lemme see if I already have it installed
here. Spider Foot, let me install it. This tool is kind of crazy.
I just had to show you. It's an scent tool or open source
intelligence tool for hackers. I'm going to launch it. Spider
Foot l specify my IP address, which will be local here. 1 2
7 0 0 1 port 5,001. Oh wait, spider Foot and now I got a
web server running on my WSL. So cool. I'm going to launch my web browser real
quick and go to local host 5,001 and their spider foot. This thing can find
a ton of information about people. I want to do a scan. I'll name it my
scan and then you scan your target. You can scan anything. I'm going to scan
a name. Chuck Keith, which is my name. Let's run the scan and see what it finds
and watch the cool command line stuff happening in the background.
Ooh, we found stuff. Human name and hacked email
address. What is that? No way. Okay, this right here, it's not me, but what it is was my dad's old email
address at a previous company. Yes, we're both named Chuck Keith. It's
a thing that's kind of scary, right? Hackers use these tools
all the time actually. Do you want to see something scary? And
honestly, this makes me kind of mad. I'm going to launch my network, check cloud browser and go to
a website called Truth Finder. You don't have to be a hacker
to use this. Anyone can do it. I signed up for an account and paid 30
bucks and I searched for information on me. And not only did it find me,
it revealed so much about me, like my home address, my family members,
my age, birthday, criminal record, don't tell anybody my assets, social profiles and not just where I
currently live. Every place I've lived, this makes me mad because
this is public information. Anyone can create an account here
and find this information about me. That's not okay. I actually had someone go on Twitter
and post my home address publicly for everyone to see. My kids are legit
afraid to walk outside by themselves. So what do I do about this? How do I get
my information off these sites and Kni, they are the sponsor of this video and
they are a tool that can help you get your information off this stuff,
off all these lists and yeah, these are all just a list, a database
of information about all of us. I mean go ahead and look yourself
up. You're probably there. This information is bought, sold,
and traded amongst data brokers. So like marketing companies,
research companies, HR companies will buy this information
so they can screen potential employees, profile them, and of course these sites
like Truth Finder who will
buy up all this information and offer it as a service.
I'm going to try it out. I'm going to set up Incognita
right now. So I just signed up. I gave us some information about me and
I authorized it to contact companies based on my behalf. Now what does
that mean? Well look right here. I signed up and immediately
it sent 83 requests to have my information removed from some list
or data broker. So for example, look at the activity log telephone list. It's in request to remove my information. This is the reason I
never answer my phone. A phone call comes in
if it's not a contact, I know I don't answer
because every call is spam. I wince whenever it's election season
because I know I'm about to get a dozen calls a day, text, emails. It's an onslaught of just spam and I
feel helpless. What do I do about that? I suppose I could go out to all these
places that I didn't already know about. I have to research and request
my information to be removed, but that would take forever.
And Cagney estimates, it takes the average person about 304
hours to redo all that research and submit the removal request, but then you have to follow up because
you're probably not going to do it the first time and then maybe in a
year you get back on a few lists. I don't have time for that. Do you have
time for that? No, you probably don't. You're busy studying, right? And
that's where Incognita comes in. So they're doing this
initial removal process. Currently these are being sent out to
all the private databases and they're scanning right now all the public
databases and we'll submit it on my behalf automatically. And not only that,
it's going to be a regular process. They'll constantly reach out to the list
of their data brokers and request my information be removed.
They're on it. Honestly, I'm paying for this myself and
I'm going to keep using it. So I challenge you right now to go out
there and try to find information on yourself. Go to truth Finder, go to
People Finder, see if you're out there. If you are, do something about it
and Kni will take care of it for you. I've got a link below. If you
use the Code Network Chuck, you'll get 60% off an annual plan. And honestly like this right
here is a no-brainer for me. I felt pretty helpless knowing that all
my data was out there and not really knowing what to do about it. Anyways, thanks to incog me for sponsoring this
video and for helping me deal with my really crazy problem. Okay, I'm
going to stop running Spider Foot. It's kind of a creepy name for a tool.
I don't like it. I don't like spiders. Comment below if you hate spiders like me. Now I'm going to pop out
of my demo machine and get
to my personal machine here and show you some cool stuff.
Let's do some WSL Command basics. Now we already saw how we could list
available distros online by typing in WSL dash list, dash dash online. These are
distros we can download and install. Let's install openSUSE Tumbleweed.
That just sounds fun. To install that, I'll type in WS L dash install and then
the distro name. It's that simple. Go, oh, and look at this nice little
screen. I wasn't expecting this. Have a lot of fun. I will.
Okay, cool. I'm in openSUSE. I'm going to exit though. Now to
see what I have currently installed, I can type in WSL dash dash list, dash verbose to see some more stuff like
which ones are running and which ones are stopped. Speaking of stops, how do I stop WSL or stop
the machines I have running? If I type in WSL shut down,
that will shut down everything. If I run that same list command as
before with verbose, all of them stopped. So now I have Cali and Ubuntu running.
How do I stop just one with this command, WSL dash terminates and
then specify the distro name. So let's say Cali
Linux and it's done. It is stopped. Now notice in my list here I've got
Ubuntu with an asterisk next to it. That means that's my default distro.
If I want to make Cali my default, I can do it with this command. WSL dash set dash default and then the
distro name. But I don't want to do that. I like Ubuntu to check the status
of wsl. We can type in WSL status, which tells us stuff we already know, like our default distro
and we're running WSL too. Now what if we want to remove a distro,
uninstall it, delete it, this command. So I'm going to list my stuff once more. I'll remove open suse even though he
had a really cool way to set him up. The command will be WSL dash dash
unregister and then the name of the distro. It's kind of wordy and with that, it should be gone if I do the same
command before list, verbose, disappeared. Now one of the coolest things about WSL
is the fact that you can use Windows files and side Linux. So for
example, if I'm in Ubuntu, lemme jump over to my Ubuntu tab. I can CD or change directory to my C
drive by going to slash mount slash C by Ls. That's my Windows hard drive. And I can jump into my
directories CD users. Chuck, go to my downloads folder and
interact with anything here. Let me grip for a text file. Oh, here's one and I can mess with
that that I use all the time. But you can also access your Linux files. So I've got a bunch of
stuff in my Linux directory. Lemme get to my home directory
here. I can access these in Windows. There's a couple of ways to get there,
but right now from the Linux terminal, if I type in explorer a Windows
command exe and just put the period, it's going to open up where I am and
side Windows should opened up on my other screen. But here it's how cool is
that? Now notice my location here. This location is actually saved by default
in Windows 11 to your home bar on the side. If you've got a little
location here called Linux, your little penguin just hanging out and
if I expand that or even just click on it, I can see I had the locations and storage
for all of my Linux Distros and I can jump into those and I can copy and
paste files, manipulate them, whatever. Again, I'm telling you,
Linux and Windows became one. Now let's talk about gooey apps.
WSL two has a thing called WSLG, which allows you to launch apps from your
Linux command line and they open up as a GUI in your Windows environment. It
doesn't make any sense, but it's awesome. Watch this. So check this out here in
Ubuntu, if I were to install Wireshark, a tool used for capturing packets
with pseudo A PT install Wire Shark, I've already got it installed
now if I want to launch it, I'll just do pseudo
Wireshark. This is so cool. It launched a little gooey version of
Wireshark. It's trying to get loaded up. That's why it's doing this weird
thing. Don't judge it by be. And this is an app just running in
Ubuntu. I can launch Google Chrome. Google Chrome running
inside Ubuntu on Windows. Lemme have Wire Shark up to capturing
these packets here. How cool is that? That's just wild. So you can install any app that has a
EY and launch it from Ubuntu or Cali Lennox and that just works
out the gate, but Cali, Cali does something different. Kind
of a little insane. Check this out. Cali has a tool called Winex and we're
going to install that right now with pseudo A PT install
Cali dash when dash cex, we'll do a dash y and run the install
after we put our pseudo password in with it installed, I'm going to run
one command cex just like this. It's going to ask me to set a password. I'll put no for view only
and watch what happens. At first it's like what's going
on? It's not doing anything. But then boom, how cool
is that? Full blown. Cali works like a charm.
Super quick, I love this. You hit F eight to get your options
here. You can get out of full screen, just make it a little window. You can
move around To officially close it, just go to your logout options and just
log out and if you want to stop it, just type inex win dash
stop getting back to Ubuntu. Over here I want to talk about Nano.
If you've been watching me for a while, you know that Nano is my favorite text
editor in Linux. Open up me a file. Super easy. But that's been
replaced because Linux and Windows, they're like this now. And now I'm
not talking about Notepad. Watch this. If you got VS. Code installed. Now
if you don't know what VS code is, I got a video on it vs.
Code's amazing right here. My Linux terminal is simply type in code
and the name of my file and it opens that bad boy and VS code. And this isn't like a gooey app for Linux. This is my VS code installed in Windows.
It doesn't stop there though vs code. If I go to my extensions, I can search
for WS L, they have a WSL extension, I'll close VS code and just open
it again with the code text T xt. Now notice when I'm opening VS code at
the bottom left to connect me to WSL Ubuntu by default I can open
up terminals right here. I'm going to Ubuntu right now. I can access all the files easily keeping
all the auto complete goodness and all the code things I like to have. And then
WSL gets even crazier with Docker. Yes, you can run docker containers and inside
WSL opening up an entire world for you to check this out. You can
install it in a number of ways. One way is to install
Docker from your terminal. Pseudo apt install Docker
do io. That's one way. Or if you're wanting something special,
you can install Docker desktop. And what this will do is use WSL two as
its sourced for creating and managing docker containers. And Docker
desktop is really neat. It allows you to manage those containers
and look at 'em and look at the networks and everything
you create. It's very fun. But I'll start the install here. I notice in the config it does say
use WSL two instead of HyperV. Okay, now speaking of many people don't
like WSL or like to use it because it interferes with using virtualization
software like Virtual Box, which is amazing. It allows
you to create virtual machines. That is not the case anymore because
virtual box has made an update to where it'll default use Hyper
V, which will be enabled. So you can use WSL two with
virtual box side by side. Okay, let's me restart windows. Okay fine.
I hate it when it does that. Alright, rebooted, I'm going to accept a bunch of
stuff blindly. I don't want to sign in. I'm going to continue without signing
in. I'm going to skip the survey. I'm not doing anything. And that's it.
Docker install and jump back into Ubuntu. Notice that it did Autostart
because Docker desktop started it. I want to run a quick docker container.
I could do this from Docker desktop. I just prefer and we're
comfortable with the command line. If I go to Docker desktop, bam, there's
my guy right there. I can see images, volumes. That's super slick. It's not just that though because back
to VS code you can look at your docker containers and WSL via VS code as well. There's a docker extension
which I'll install right now. I think I actually prefer it in VS code
because it's weird that you can do that. But I click on that little docker
guy here with my extension installed. I can see my guy right here, his
files and everything. That's so nifty. I love it so much. Attached to the
shell. I'm inside my busy box guy. Isn't that just cool? I mean I love
how everything's just right here. It's so easy and powerful.
And speaking of powerful, my Linux stuff has access to
my GPU just as Windows does. If I type in Nvidia smmi, Linux can see my 30 80
on my demo machine here, try doing that with a virtual
machine that's a pain in the butt. If even possible. Can virtual box or
VMware do that right now? I'm not sure. Now the last thing I want to show
you as we go deeper and deeper down, the rabbit hole of WSL is
the custom config you can do. WSL has two config files that you can
mess with. First is our local one. Each individual machine or distro
you deploy has its own little config file. It's called
wsl.com. We can find it here. Lemme show you real quick. Here
in Ubuntu I'm going to go to, I'll just open it up nano
slash etsy slash wsl.com. There it is. Now one thing I want to point out that's
just fun is that WSL does fully support system D, but it is a configurable option.
Notice it is by default set to true, it's using system D and you
can add other config here. I'm not going to demo everything or really
anything on that because I don't care about it. But you can do things like auto
mount settings, auto mounting drives, and yes you can mount remote drives. I mount my NAS inside my
WSL instance all the time. You can do some host name
config with network settings, interoperability settings, user
settings. You can add a default user. You can have stuff run
when the instance boots. And here's an example file right here. Now the other file you
can have is a global file. I like this one better
because it has cooler options. This will apply to every
single WSL incenses you're
running and this is going to be stored in your Windows operating
system. By default it's not created, it's going to be a WSL config file and
WSL is going to look for it inside your user directory. Let's
create it real quick. I got this one little quick snappy
command that we're going to run inside PowerShell. So here, PowerShell
window, all windows baby. We're on this command notepad and it's
going to open up a new file within our user profile, WSL config and
notepad. It's going to go, Hey, that file's not created, we're going to
create it right now. Cool. No big deal. Now one thing, just one thing I want to demo and show
you how to do is changing the networking mode. So check this out. We're going
to set up the config file right now. First we'll do opening bracket
and say WSL two closing bracket. It's just telling it, hey,
we're doing WSL two file. It's going to look for that
and actually need it there. And then we're going to change
networking mode and the M will need to be capitalized, I'll say equals mirrored. Now by default, the networking
mode for WSL is Nat. I'm not going to cover
NAT in too much detail, just know that this is my
Windows IP address. I think, I actually don't know my WSL instances
are connected to this with a separate network through Nat and they'll
look something like this. 1 7, 2 point 16.3 0.4. I'm just assuming, lemme go see what it actually is.
Do an IP address command. Yeah, it's 1 7 2 27 2 53 90. This
is not on my local network. It's a NAT connection. It's own
separate network. And by the way, there's an eight second rule.
They have let, I'm legit, this is what they call it.
I'm not making this up. If you go to their documentation, they call it the eight second
rule for configuration changes. You want to wait eight seconds after
you shut the WSL instances down for the changes to take effect. Cool.
I think we were in that limit. So I'm in Kelly Linux. If I type in
IF config once more, didn't change. I do wrong. Let me do it
longer. You know what it did? It added a TXT to this bad
boy. Why did it do that? Let's just remove that TXT and now
WSL will use it. That was a pain. Let's shut 'em all down. Count to eight And let's launch Cali once more.
Fingers crossed if F config, it matches windows right there. Mirrored mode versus nat mode removes a
lot of the issues you might have and you can connect the WSL directly from your
local area network, which is pretty cool. Now one last thing I'm going to show
you one last deep dive and that's how to back up your WSL instances, your little virtual machines that
you might pour a lot of love into, configure and add tools. You'll want
to make sure you can protect those. So let's try it out. With this
command, I can back up a WSL machine. So with this command, I'll list
my stuff. WSL dash, dash list, dash verbose to see what
they're doing. I've got Ubuntu, I'm going to back him up to
what's called a tar file. So I'll do WSL dash export
and I'll specify Ubuntu. And then the name of the
file I want to store it in. So I'll just call it Ubuntu tar. And right now it's exporting my
Ubuntu machine and that's it. If I were to LS that and then
gre, I'll use WSL to GRE for it. There it is right there. Now what I want to try and do is
import this on another machine. So I'm going to open this up, see where
did he go? There it is Ubuntu Tar. It's only 1.9 gigs. I'm going to copy
that onto my main machine. Alright, with it copied over. And by the way,
this is the first time I've tried this. I hope it works. I'm going
to do WSL dash import. I'm going to name it and I can name
this anything. I'll name it Tokyo, specify where I want to
store it. I'll put it here. DWSL and then the name of the tar file,
the location of it. It's right here. Ready, set, go. Okay,
it's importing. That's it. So now if I list my stuff,
lemme try it out. WSL dash list, there's Tokyo, lemme connect to
Tokyo. Sick. Okay, cool. That worked. Oh, I forgot one thing. I had to turn my
cameras back on just to tell you this. When connecting to an imported instance, noticed it kind of defaulted to the root
user and that kind of freaked me out because I had some files
here and they're not here, but they were here in my other Ubuntu,
I created two little text files. Well you can specify the
user account you connect as. So I'll do WSL dash D in Tokyo. Then I'll do dash U for
user and specify network. Chuck to connect as network Chuck.
And there we go. Type in ls. There's my files. Sorry, I
almost forgot that. Also, if you like the way my stuff looks, let me know if you want me to make a video
on how to do that. I kind of love it, especially when I can do this and have
it look like a TU and be nice and clean. Okay, that's everything. WSL from the flashy cool stuff to the
nerdy things that you may want to do to back things up or make your networking
work. I hope you enjoyed it. I'll catch you guys next time.