Skip to content

Files

Latest commit

 

History

History
345 lines (250 loc) · 9.37 KB

slideshow.md

File metadata and controls

345 lines (250 loc) · 9.37 KB
marp
true

Intro to Linux

Cormac Sharkey bg right


Housekeeping

bg opacity:.2


Who am I?

  • UCC committee/wheel person
  • Builds scientific software @ DUG
  • github.com/bir-d

Why learn Linux?

Practically...

  • It's used everywhere - from high performance compute nodes, to game servers, or even applications on your own (non-Linux) machine.
  • Learning it will give you a head-start when you inevitably run into it somewhere along your tech journey.
  • Much better access to tools for programming, IT work, you name it

But also...

  • It's fun!
  • Highly customisable -- don't like something? Swap it out yourself!
  • Free:
    • As in beer
    • As in speech w:auto h:300

What is Linux?

  • A kernel
  • Not necessarily an OS
  • But a major building block towards one alt A little bit like this!
Bobbo, CC BY-SA 3.0 https://creativecommons.org/licenses/by-sa/3.0, via Wikimedia Commons

In that case, what do I mean by "learn 2 linux"?

  • As we've learnt, Linux can be a common core to a whole load of things.
  • We can investigate some common underpinning fundamentals...
  • And as a result, we can feel comfortable across a huge range of Linux distros!

Distros?

  • A distro (distribution) is simply Linux + a bunch of other programs to help you get things done.
  • For example, Ubuntu is Linux + a desktop environment (GNOME) + a bunch of other stuff.
  • As a result....

Linux

alt


(also) Linux

alt


(I can't believe it's still) Linux

alt


Archaic but effective

alt


A reoccuring theme

Pretty much everything is just a bunch of smaller programs stuck together w:auto h:500(I wish it was this nice...)


The key

Understand which of these programs you care about and how to interact with them.


An aside: Docker and containers

bg right contain


bg right contain

  • Docker is a program, which runs on all sorts of computers (not just Linux).
  • Part of its job is to run lots of different containers.
  • Each container contains all of the software which makes a "distro" a "distro", but share the kernel of the host.
  • This should mean that a Windows host would not be able to run a Linux container, but it cheats a little bit by using a VM to run them anyways.

Let's talk more about the shell

alt (this thing)


Why?

  • The shell provides a common interface to anything based on Linux.
  • There may be:
    • Over 600 active Linux distros
    • Hundreds of desktop environments
  • But the shell provides a common way to interact with all of this, even without a screen or a monitor connected to your Linux machine! (handy for servers)

What is the shell?

  • (yet another) program
  • Also known as a "command line" or "terminal"
  • Multiple available
    • The most popular of which is bash
      • It's worth noting that MacOS uses a derivative of this -- zsh
  • Most often, this will be run on your own computer (local shell), or you will be interacting with a remote shell (via SSH)

Let's talk about commands

Essentially: the name of a program, any required flags, then as many required arguments as input

  • You can then do all sorts of stuff with the output!

Common patterns?

  • program
  • program FLAGS TARGET
  • program FLAGS SOURCE DESTINATION

Commands...

alt


Another one

alt


Introducing flags

Alters a programs behaviour

  • ls
    • Prints all non-hidden files in the current directory
  • ls -l
    • Prints all non-hidden files, as well as additional information.
  • You can string these together
    • Try ls -l -t -r -a -p
      • shorter: ls -ltrap
  • The manual page lists all of the flags (and more!) for any program with an entry
    • Try man, and pass it a programs name as its first argument! (man ls)

Introducing flags

alt


Let's run your first command!

ssh learn2linux@ssh.ucc.asn.au

  • Program: ssh
  • Argument: learn2linux@learn2linux.ucc.asn.au

Files

  • Linux stores a lot of things as files.
  • Besides your personal data, you can also find things like system info, configuration, and more, stored as files.
  • Files are stored on your filesystem, which takes the shape of a tree.

The file tree

w:auto h:600


The file tree

w:auto h:600


Referencing files

  • When referring to files, you will typically refer to an absolute or relative path to the file
    • Think of a file path as directions to a file.
  • So far you've seen what is called an absolute path
    • This is a path which specifies a file from the root / allll the way to the destination!
    • For example:

Absolute file path

w:auto h:600


Absolute file path

w:auto h:600


Absolute file path

w:auto h:600


Absolute file path

w:auto h:600


Absolute file path

w:auto h:600


Absolute file path

  • Lets use our path to dog.jpg and supply it to tiv, a program for viewing images on the terminal

More on file paths

  • A good thing about absolute file paths is that there's no ambiguity.
  • If you specify the whole path, from the root, every time, the file can be in only one place.
    • Follow the tree!
  • They can be tedious to type though, especially when your path is more than a few folders long.
  • The solution: relative paths!

Relative? Relative to what?

  • A relative path is relative to your current working directory
    • This is just a way of expressing "the folder you are in currently"
  • To construct a relative path, just express directions from your current working directory to the file in question.
  • In the case of /home/bird/pics/dog.jpg:
    • If my current working directory is /home/bird/, I can specify a relative path as pics/dog.jpg
    • If my current working directory is /home/bird/pics, I can specify a relative path as just dog.jpg (!!!)

Saving more time with shortcuts

  • What if building relative paths is still too slow for me?
  • There are shortcuts...
  • ~: represents your home directory
    • ~ == /home/bird
    • ~/pics == /home/bird/pics
  • .: represents your current working directory
    • This is implicit when specifying most relative paths: ./dog.jpg == dog.jpg
  • ..: represents the folder above your current working directory!
    • If your CWD is /home/bird/pics, .. == /home/bird

Let's look around for a bit...


Teaching you how to fish

alt


Teaching you how to fish

  • By now, we've talked about the shell, how to construct commands, and how to refer to files.
  • I could go over how to accomplish all sorts of tasks
    • But there are far too many for the time provided in this talk.
    • And theres no guarantee that this would even apply to the distribution of Linux you're using!

This doesn't matter though, because:

  • Most tasks you need to do can be worked out logically, and
  • You now have the tools to do this!

Let's go fishing

alt

  • Google is still your friend!
  • In terms of getting a starting point for a lot of problems, it is invaluable
  • However, it won't find everything.
    • This is where you need to strike a balance between reliance on it's results, and tailoring it to your needs.

Quick note on where to fish

  • Generally, things will boil down to interacting with a program, or editing a file.
  • So a lot of solutions on Google will tell you to do one or both of these.
  • This is where its important to be aware of the composition of your Linux distribution.
    • Instructions on interacting with apt, the package manager on Debian, isn't as useful on Arch, where they use pacman
    • This is going to be the majority of your tailoring.

LIVE FISHING LIVESTREAM

alt


Getting started/picking a distro

  • There are hundreds of Linux distros out there
  • This is a testament to it's versatility.
  • Most of the time, you'll have the choice of which one to pick!

Ubuntu

w:auto h:600


Ubuntu

  • Definitely the most popular
  • This means you'll get plenty of help! (Easy to fish)
  • Has desktop and server versions.
  • Uses apt for package manager.
  • My recommendation for beginners
    • Even if just for google-bility

Going beyond

  • If Ubuntu isn't to your liking, there are other distributions, with varying compositions.
  • Ubuntu itself is based on Debian.
  • Explore!

Final notes

  • The best way to learn is to use it!
  • From least to most committal: VM/WSL, Dual boot, Full boot.
  • Generally, the more you commit to it, the faster you learn as you're forced to interact with all it's parts.
  • If/when things go south, UCC itself is a great place for guidance.
  • If you haven't already: head over to ucc.asn.au/discord

Thank you!

slides available here: github.com/bir-d/intro2linux