marp |
---|
true |
- UCC committee/wheel person
- Builds scientific software @ DUG
- github.com/bir-d
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
- It's fun!
- Highly customisable -- don't like something? Swap it out yourself!
- Free:
Bobbo, CC BY-SA 3.0 https://creativecommons.org/licenses/by-sa/3.0, via Wikimedia Commons
- 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!
- 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....
Pretty much everything is just a bunch of smaller programs stuck together
(I wish it was this nice...)
Understand which of these programs you care about and how to interact with them.
- 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.
- 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)
- (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
- It's worth noting that MacOS uses a derivative of this --
- The most popular of which is
- Most often, this will be run on your own computer (local shell), or you will be interacting with a remote shell (via SSH)
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
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
- shorter:
- Try
- 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
)
- Try
ssh learn2linux@ssh.ucc.asn.au
- Program:
ssh
- Argument:
learn2linux@learn2linux.ucc.asn.au
- 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.
- 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:
- This is a path which specifies a file from the root
- Lets use our path to
dog.jpg
and supply it totiv
, a program for viewing images on the terminal
- 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!
- 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 aspics/dog.jpg
- If my current working directory is
/home/bird/pics
, I can specify a relative path as justdog.jpg
(!!!)
- If my current working directory is
- 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
- This is implicit when specifying most relative paths:
..
: represents the folder above your current working directory!- If your CWD is
/home/bird/pics
,..
==/home/bird
- If your CWD is
- 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!
- Most tasks you need to do can be worked out logically, and
- You now have the tools to do this!
- 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.
- 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 usepacman
- This is going to be the majority of your tailoring.
- Instructions on interacting with
- 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!
- 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
- If Ubuntu isn't to your liking, there are other distributions, with varying compositions.
- Ubuntu itself is based on Debian.
- Explore!
- 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
slides available here: github.com/bir-d/intro2linux