Skip to content

Instantly share code, notes, and snippets.

@pandorasNox
Created July 15, 2020 12:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pandorasNox/3390668ae1694972ce513243a701c183 to your computer and use it in GitHub Desktop.
Save pandorasNox/3390668ae1694972ce513243a701c183 to your computer and use it in GitHub Desktop.
linux 101

linux 101

Why?

  • understanding the basic's of dealing with the os
  • throughout your career you will e.g. seciffcily encounter cli regualary
  • cli basics are automation basics

What?

  • bios vs os (2m)
  • gui vs cli (2m)
  • terminal vs cl(i) vs shell (5m)
  • cli basic commands & exercises (20-30m)
  • package manager (5-10m)
  • Q&A (10-15m)

How?

  • on your local machine, we will see what we can do

bios vs os

bios

  • bios = basic input/output system
  • first software to run when powered on
  • tests the system hardware components, and loads a boot loader
  • firmware used to perform hardware initialization during the booting process (power-on startup)
  • past:
    • provide runtime services for operating systems and programs
    • (past) manages data flow between os and attached devices
    • such as: hard disk, video adapter, keyboard, mouse and printer
    • most os's access theses components these days directly

os (operating system)

  • collection of software
  • abstraction over hardware (cpu, mem, devices)
  • runs task (based on different layered software)
  • provides cli / gui interface for human interaction
  • let's you install other software

gui vs cli

  • i/o = input / output

gui

  • gui = graphical user interface
  • interacted via mouse + keyboard + other higher level input devices
  • visual graphical feedback
  • mostly takes more effort to handle i/o bec of the restrictions of input devices + gui itself

cli

  • cli = command line interface
  • interaction via keyboard / i/o streams
  • runs in a (virtual) terminal (these days)
  • works with i/o streams
  • can normally handle more i/o / infrmation processing
  • a lot of development related task are normally done with a lot less effort than in a gui
  • direct information input

terminal vs cl(i) vs shell

  • terminal
    • original pysich
    • these days virtual terminal, e.g. iterm / xterm / ...
  • cl(i)
    • what runs in a terminal
    • allows you to do i/o (techniclly on one line :D)
  • shell
    • interpreter for bash

cli - basic commands

list of commands

  • basic commands:

    • pwd
    • ls
    • cd
      • cd ~
    • touch
    • cat
    • mkdir
    • rmdir
    • rm
    • mv / cp
    • mkdir
    • du / df (-h)
    • top / ps / jobs
    • uname -a
    • history
    • clear
  • basic tools

    • top
    • head
    • tail
    • nano
    • grep / grep -v
    • diff
    • man / -h
  • rights:

    • su / sudo
    • chmod
    • chown
    • useradd, userdel, passwd
  • advanced mentions

    • clear (str + l)
    • ctrl + c (close prog)
    • str + R (search history)
    • awk
    • tar
    • kill + detached start programm using "&" at the end (e.g. tail -f)
    • ping
    • curl
  • vi / vim

exercises

  • open a terminal. do you know what shell interpreter you are running?

  • go to your home directory

  • ensrue you are in your home directory

  • create files:

    • testfile4
    • testfile5
    • testfile6
  • create the following directory structure:

    • create the files and directories (starting with / is ment to be a directory, eg. /a)
     /myhome
     	testfile1
     	testfile2
     	testfile3
     	/testdir
     		/a
     			testfile4
     			testfile5
     			testfile6
     		/b
     			testfile7
     			testfile8
     			testfile9
     		/c
    
  • move files from ... to ...

  • list the files in directory `` without leaving current directory

  • ping google dns

packages

  • as already mentioned in the os section, you can install other software
  • there are different ways to do so
  • on way are package managers
  • package managers giving you
    • list of available packages
    • install package
      • installs also it's dependencies
      • install specific version
    • delete packages & dependiencies
    • ability to auto update already installed packages

example

  • apt / apt-get
    • htop / iotop / ...
    • docker
    • (virtualbox)
    • (k3s / microk8s)
  • wget / curl + chmod +x + mv
    • zsh (or use git for this)
  • snap
  • appimage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment