60 Linux Commands you NEED to know (in 10 minutes)

Video Notes:

In this video, NetworkChuck shows you the top 60 Linux commands you NEED to know! If you are a beginner in Linux, this is THE video you need to watch. If you are a Linux boss, I bet you a box of donuts there is a command in this video you don’t know.

0:00    ⏩  Intro

0:05    ⏩   ssh

0:21    ⏩   ls

0:30    ⏩  pwd

0:35    ⏩  cd

0:51    ⏩  touch

1:23    ⏩  echo

1:32    ⏩  nano

1:42    ⏩  vim

1:56    ⏩  cat

2:02    ⏩  shred

2:10    ⏩  mkdir

2:15    ⏩  cp

2:26    ⏩  rm

2:28    ⏩  rmdir

2:38    ⏩  ln

2:45    ⏩  clear

2:50    ⏩  whoami

2:57    ⏩  useradd

3:02    ⏩  sudo

3:08    ⏩  adduser

3:15    ⏩  su

3:21    ⏩  exit

3:29    ⏩  passwd

3:50    ⏩  apt

4:12    ⏩  finger

4:20    ⏩  man

4:33    ⏩  whatis

4:55    ⏩  curl

5:05    ⏩  zip

5:13    ⏩  unzip

5:20    ⏩  less

5:29    ⏩  head

5:32    ⏩  tail

5:34    ⏩  cmp

5:42    ⏩  diff

5:50    ⏩  sort

6:00    ⏩  find

6:19    ⏩  chmod

6:24    ⏩  chown

6:34    ⏩  ifconfig

6:40    ⏩  ip address

6:47    ⏩  grep

7:02    ⏩  awk

7:26    ⏩  resolvectl status

7:31    ⏩  ping

7:57    ⏩  netstat

8:08    ⏩  ss

8:14    ⏩  iptables

8:24    ⏩  ufw

8:43    ⏩  uname

8:52    ⏩  neofetch

9:01    ⏩  cal

9:14    ⏩  free

9:21    ⏩  df

9:28    ⏩  ps

9:36    ⏩  top

9:40    ⏩  htop

9:44    ⏩  kill

10:03  ⏩  pkill

10:14  ⏩  systemctl

10:29  ⏩  history

10:35  ⏩  reboot

10:37  ⏩  shutdown

Here are the top 60 Linux commands you need to know, and we’re gonna do this in 10 minutes. Our first command can be used anywhere. It’s SSH because you can’t use Linux unless you can get to it. To connect to your Linux machine, you’ll specify your user it, then the ad symbol and then the server you’re gonna connect to. So I’ll copy the IP address of my lin node that I just set up past that in here. Hit enter. Accept all fingerprints. Put your password in and or in the LS command will list all the files in your current working directory. We can add the L switch to give us a nice list and we can add the A switch to see the hidden stuff. Elix is a big place. Where are you with the PWD command? You can find out print working directory. It’ll tell you where you are, but if you don’t wanna be there, we can change that with the CD command. 

Change directory. Just after CD will tell it where you want to go. Maybe the root of the file system who we made it guess or we can specify a specific path. With cd.dot we can jump back one directory and with CD space nothing, we can click our heels and get back. Home. Touch is the quickest and easiest way to create a file. Type in touch with a file name in you got yourself a file. We can create more than one file. Every one of those words in that sentence will be its own file <laugh>. Or we can do something weird like this or we could even create a file in the future by using the dash D switch and specifying the date it’s created a file from the future. And seriously shout out Tolin for sponsoring this video. Whenever I need to do anything in Lennox, I go Tolin node and spend out the quick virtual machine to do stuff like this. 

And it only costs me 0.01 cents an hour. When I’m done, I destroy it and that’s all I’m charged. Check it out. Link below the Echo command allows you to talk to yourself or we can use it to add stuff to a file really quickly. We’ll specify the right arrow and then a name of a file, a new or existing file. But if you really want to edit a file like a Linux Pro, you’ll use Nano Nano and then the file name. And boom, we’re editing a file to save your file with Nano, you’ll hit control x Y and enter to save. Now if you’re Lennox Pro that thinks you’re better than everybody else, you’ll use them, them the file name and now you can try to edit a file. The best way is to hit I to start inserting text and once you’re done, hit Escape Colon and wq to write and quit. 

Now if you wanna see what’s inside a file, really quickly use the Cat Command Cat and then the file name super fast. And if you don’t want anyone to ever see what’s in that file, you can shred it. Shred the file name and cat that one. Again, nothing looks like a cat road. We can make a new directory with the M K D I R command, but right now he’s empty, it’s lonely. So let’s copy something in there. We can copy a file of the CP command. We’ll specify our file and then where we want it to go. If you don’t wanna copy, you can use the MV command to move the file, Specify the file, you wanna move and then where you wanna put it. We can remove or delete a file with the RM command and we can remove a directory with the RM D i R command. 

But if it’s not empty, we can go back to the RM command and do a dash R for recursive and try that done. We can create a link to a file with the LM command using the S switch for soft, we’ll specify the file and then the link. Now if your terminal’s a bit dirty, you can clean it off, type in clear. Ah, so much better Coffee break. If you don’t know who you are, you can type in who am I and it’ll tell you existential crisis over. If you don’t like who you are, you can change that. Let’s first create a new person. We’ll use the ad user command and then the username, Oh, too bad we don’t have permission, but we have pseudo or psdo specify pseudo Before your command, enter your pseudo password and you’re good to go. We can also reverse the command by doing ad user instead of user ad and we’ll be able to set some parameters like passwords and stuff. 

Now if I wanna become Nick or Austin, I can do that with the SU command for Switch user. SU specify the username and I am Austin, but I don’t wanna be Austin anymore. I can use the exit command, type in exit back to V and Me. And by the way, the exit command can be used to exit at a lot of places. Now Nick didn’t have a password but I can change that with the password command. P A S S W D and then the username. If you wanna change your password, just type in password or password 

Type into the terminal. Pseudo password, Millie password, but it’s so it’s just password <laugh>. 

Now this next command is kind of weird and you’ll have to install, it’s called Finger <laugh>. It’s really strange, trust me. But to install that we’ll need to learn a new command on Debbie and Base Machines. We’ll use a P t but hold up. Before we can install anything, we have to update our repositories. So we’ll do pseudo a P t update whilst doing, That’ll take a coffee break. If you’re on Red Hat or sent to West, you’ll use the Yum package manager and if you’re on Arch or anything else, you’re on your own. After an update, we’ll do a pseudo a P T install and the name of our package which will be finger done and now we can use that command Finger can be used to inspect another user. So I might want to inspect Austin. It’s pretty handy. The Man command will help you with things you don’t know, which is a lot, at least for me. 

You find out what the finger command does by doing Man Finger <laugh>. That sounds weird. It’ll tell us all about it and how to use it. Hit Q to get outta there. We can man Cat, we can man, man. So when in doubt consult your manual. Now a faster man is what is type in what is Finger. It’ll tell you real quick or maybe you wanna know where finger is, you can type in which finger, which will tell you one place, but you wanna know where all the fingers are. So say where is Finger W Get can help you get stuff from the internet. Like maybe you wanna download the entire Bible in text form. We can do that right now. And there it is, the entire Bible. Another way to download is with Curl, my personal favorite type in curl the URL you wanna download from and then using the right arrow, direct that to something else like a file 

Done. Now the Bible’s kind of big, what do you say? We made that file smaller. We can zip it up. Zip the zip file you wanna create and what you wanna zip inside. Hey that wasn’t too bad. Now often you might want to unzip something with the unzip command, specify that file name and some other options and you’re good to go. Now if we wanna read our file we could cat it but that’s crazy. Come on. A better way is using the less command, giving you one page at a time. Just the way I like it. If you only wanna see the beginning of your file type in head, what about the end type and tail? If you wanna compare two files to see if they are the same, like this guy and this guy, use these CMP command for a compare. Specify your two files and hey, we do have a difference but it didn’t tell us what it only told us where for that we can use the diff command specify files and it will tell us exactly what’s different. 

You decide what’s true, the sort command will sort your stuff alphabetically. So for example, I could cat the Bible, do a pipe and type in sort at the end the entire Bible in alphabetical order ending with Zephaniah. The fine command is nuts and will help you well fine things type in fine. Specify what directory you wanna look in. I’m gonna look in all of them and then specify a name of a file with a regular express BAM files found. You can also find all hidden files, empty directories or all executable files. And speaking of executable, how do you make a file executable? We’ll change the attributes with the CH mod command and do a plus x and then the file name and now it executes. We can change the ownership of that file with the CHONe command or change ownership. Specify the user and then the file. 

Congrats Austin, you own a file time for some network stuff. Copy break. What’s your IP address? I have config. If you don’t have it, install it. Let’s try it again. If F conf fit, there it is. You could also try IP address which makes more sense. Same information just better. Now what if you only wanna see it for one interface? For that we can use GR grip is crazy. I love gr same command IP address. For this time I’ll use a pipe type inre and say Ethan Nets zero to only see Ethan at zero’s IP address. Bam. We could grip again do another pipe grip for ANet and it only shows you that line. But what if we only wanna see the IP address for that? We can use a A is even crazier than gre. Just after our grips I’ll A this put in a crazy regular expression and get exactly what I want. 

Now what about dns? What’s our dns sir? One way is we can cat it. Cat the et tc resolve with no e.com file. But if you’re on newer versions of things like Ubuntu, you might see something like this not very informative. Instead we can type in resolve with an E CTL status and there it is. Now is your website up? We can find out with Ping. We can find out if anything’s up with ping ping and then the name of the website. Get responses forever. Hit control C to stop. We can limit that with a dash C command specifying the count of things we wanna send just five. We can specify the size of the packets. If you wanna see the path through the internet you’re taking to get to a website, you can use the trace route command, which is so cool. Trace route and then the name of the site telling you every haw and that latency. 

Now what ports are open on your Linux machine? We can check it out with netstat net Statistics, this gives you a lot. Do you not wanna try netstat dash two lupin, all those switches, which is much better. A more modern version is the SS command, which is basically the same thing. Use a topen switches and it’s nice and pretty. Now what about your firewall? Are things getting through or do you wanna block ’em? If you wanna to allow pour 80, you could run something like this, which is honestly kind of complex. That’s why U F W is way easier. This sits on top of IP tables and makes it so much easier. If I want to allow pour 80, just do U F W allow 80 as psdo done. See what you’re allowing with U FW status, which right now it’s not even enabled. So we can enable it with U F W enable. 

Then check our status once more. Beautiful. Now if you wanna know a bit more about your system, you can use the you name, command, you name. It’ll tell you just a little bit. If you type in dash A, it’ll tell you a lot. Now if you want a prettier version of all this, try Neo fetch. Going  to install that real quick. A t install neo fetch and then simply run Neo fetch. And how pretty is that? The Cal command will give you a quick little calendar here. I don’t know why you want that, but it’s kind of cool. If you don’t have it, you can install it with pseudo A P t install n cal. If you wanna do some math right here in your terminal, you can echo a problem out to bcbc will tell you what the answer is. If you wanna check on your memory and see how much memory you have available on your system, just type in free. 

It’ll tell you what’s used and what’s going on with your swap. How much  space do you have? You can use the DF command and more specifically the DF dash capital H command. You’re gonna use that one all the time. What about the stuff running on your system? The processes? We can use the PS command, which won’t tell you much unless you use the PS A U X switch. Then we can get all the goodies. If you wanna see the processes eating up all your stuff, type in top. If you wanna see that in a prettier way, type in H top <laugh>, that’s slick. If you have a process that you want to kill  it, we can do that with the kill command first we have to find the process id. I’ll do that with ps. I’ll grip for that script I wanna kill. There it is. 

There’s this process ID and I’ll kill the process with the dash nine signal forcibly killing it. And then the process ID 66 59. Goodbye buddy. He’s gone. Now. Even better than kill is P kill because you don’t need to know the process. ID type in  kill, use the F switch and specified the name. You kind of think it is and it did it to stop, start and restart services or Damons and Linux. You can use the system CTL command at your systems using System D. If not, it’ll be using service. So to stop a service system ctl,  we do Apache two. Replace  with start. We’ll start the service, type in status to see what’s going on or do a restart. Now we’ve gone through a lot of commands. If you want a history of all we did type in history and that’s a lot of stuff. And finally, if you wanna reboot pseudo reboot. If you wanna shut down, pseudo shut down. This will shut down your machine in about one minute. If you want to do it now, do a dash H now, which I’ll do. That’s the end of the video. Talk to you guys later.

Check Out Network Chuck's Coffee and MERCH Shop