Linux and Network Administra3on. Lorenzo Bracciale Marco Bonola

Similar documents
Lecture 1: Linux and Network Administration

Lec 1 add-on: Linux Intro

Lab 2: Linux/Unix shell

Linux Essentials Objectives Topics:

Linux Kung Fu. Ross Ventresca UBNetDef, Fall 2017

Introduction to the shell Part II

Introduction: What is Unix?

UNIX Quick Reference

Introduction to Linux. Woo-Yeong Jeong Computer Systems Laboratory Sungkyunkwan University

Linux Kung-Fu. James Droste UBNetDef Fall 2016

Useful Unix Commands Cheat Sheet

Table of contents. Our goal. Notes. Notes. Notes. Summer June 29, Our goal is to see how we can use Unix as a tool for developing programs

Computer Systems and Architecture

Introduction to remote command line Linux. Research Computing Team University of Birmingham

Perl and R Scripting for Biologists

Introduction to the Linux Command Line January Presentation Topics

Embedded Linux Systems. Bin Li Assistant Professor Dept. of Electrical, Computer and Biomedical Engineering University of Rhode Island

Essential Unix (and Linux) for the Oracle DBA. Revision no.: PPT/2K403/02

Operating Systems Lab 1 (Users, Groups, and Security)

Unix Processes. What is a Process?

Basic Linux Command Line Interface Guide

ECE 471 Embedded Systems Lecture 10

Introduction to Linux

Review of Fundamentals

Processes. System tasks Campus-Booster ID : **XXXXX. Copyright SUPINFO. All rights reserved

Virtual Machine. Linux flavor : Debian. Everything (except slides) preinstalled for you.

Basic Linux Command Line Interface Guide

CS197U: A Hands on Introduction to Unix

Introduction to Linux

Linux Kung Fu. Stephen James UBNetDef, Spring 2017

More Raspian. An editor Configuration files Shell scripts Shell variables System admin

*nix Crash Course. Presented by: Virginia Tech Linux / Unix Users Group VTLUUG

Contents. Note: pay attention to where you are. Note: Plaintext version. Note: pay attention to where you are... 1 Note: Plaintext version...

Introduction. What is Linux? What is the difference between a client and a server?

Unix/Linux Basics. Cpt S 223, Fall 2007 Copyright: Washington State University

System Administration

Computer Systems and Architecture

Recover Deleted Files With Scalpel

M2PGER FORTRAN programming. General introduction. Virginie DURAND and Jean VIRIEUX 10/13/2013 M2PGER - ALGORITHME SCIENTIFIQUE

Carnegie Mellon. Linux Boot Camp. Jack, Matthew, Nishad, Stanley 6 Sep 2016

UNIX System Programming Lecture 3: BASH Programming

GNU/Linux 101. Casey McLaughlin. Research Computing Center Spring Workshop Series 2018

Shell scripting and system variables. HORT Lecture 5 Instructor: Kranthi Varala

TestOut Linux Pro - English 4.0.x OBJECTIVE MAPPING: CompTIA Linux+ LX0-103

Introduction to Linux. Roman Cheplyaka

Command-line interpreters

Review of Fundamentals. Todd Kelley CST8207 Todd Kelley 1

Linux Command Line Interface. December 27, 2017

The kernel is the low-level software that manages hardware, multitasks programs, etc.

Linux Essentials. Smith, Roderick W. Table of Contents ISBN-13: Introduction xvii. Chapter 1 Selecting an Operating System 1

Lecture 02: Linux Command Line

The Unix Shell & Shell Scripts

ADVANCED LINUX SYSTEM ADMINISTRATION

Introduction to Linux Organizing Files

Linux crash lecture by Andrey Lukyanenko

Introduction to Unix The Windows User perspective. Wes Frisby Kyle Horne Todd Johansen

CSE Linux VM. For Microsoft Windows. Based on opensuse Leap 42.2

UNIX. Basic UNIX Command

First of all, these notes will cover only a small subset of the available commands and utilities, and will cover most of those in a shallow fashion.

Introduction to Linux Command-Line for Beginners

1Z Oracle Linux Fundamentals (Oracle Partner Network) Exam Summary Syllabus Questions

ScazLab. Linux Scripting. Core Skills That Every Roboticist Must Have. Alex Litoiu Thursday, November 14, 13

Assignment clarifications

Shells. A shell is a command line interpreter that is the interface between the user and the OS. The shell:

Part 1: Basic Commands/U3li3es

Introduction to Linux

OPERATING SYSTEMS LINUX

Introduction to Linux

INTRODUCTION TO LINUX

CSC UNIX System, Spring 2015

Comptia LX0-101 Exam Questions & Answers

Introduction to UNIX Part II

LX0-103.exam.68q. Number: LX0-103 Passing Score: 800 Time Limit: 120 min LX CompTIA Linux+ [Powered by LPI] Exam 1

Contents. xxvii. Preface

strace Practical Application Troubleshooting Tuesday, February 19, 13

Mills HPC Tutorial Series. Linux Basics I

CS370 Operating Systems

Linux Systems Administration Getting Started with Linux

The UNIX Shells. Computer Center, CS, NCTU. How shell works. Unix shells. Fetch command Analyze Execute

Essential Unix and Linux! Perl for Bioinformatics, ! F. Pineda

UNIT 9 Introduction to Linux and Ubuntu

Unix as a Platform Exercises. Course Code: OS-01-UNXPLAT

LPIC-1 System Administrator

Lecture 2: The file system

Linux Systems Administration Shell Scripting Basics. Mike Jager Network Startup Resource Center

Please choose the best answer. More than one answer might be true, but choose the one that is best.

CSCM98 Lab Class #5 Getting familiar with the command line

Community Enterprise Operating System (CentOS 7) Courses

Connecting to ICS Server, Shell, Vim CS238P Operating Systems fall 18

Linux Nuts and Bolts

Sperimentazioni I LINUX commands tutorial - Part II

Review of Fundamentals. Todd Kelley CST8207 Todd Kelley 1

Introduction to the Linux for HPC. Basic Linux for Beginner HPC Users

07 - Processes and Jobs

Hands-on Keyboard: Cyber Experiments for Strategists and Policy Makers

Study Guide Processes & Job Control

Introduction to UNIX/Linux

Read the relevant material in Sobell! If you want to follow along with the examples that follow, and you do, open a Linux terminal.

UNIX. The Very 10 Short Howto for beginners. Soon-Hyung Yook. March 27, Soon-Hyung Yook UNIX March 27, / 29

Unix Introduction to UNIX

Transcription:

Linux and Network Administra3on Lorenzo Bracciale Marco Bonola

What is Linux? Outline

Who is this guy?

Who is this guy?

Compiler Editor Human Interface Filesystem Networking OS Kernel Scheduler Device Drivers Memory Management Debugger Build Automator GPL

GUI Web Server U3li3es Package Manager Compiler Editor etc... Human Interface Filesystem Networking OS Kernel Scheduler Device Drivers Memory Management Debugger Build Automator GPL

Outline What is Linux? Shell

Users Whoami? Every user has an ID (UID) and belongs to one or more groups Every groups has an ID (GID) See /etc/passwd and /etc/groups Related commands: adduser, userdel, su, sudo, whoami, who, last

Handling files Name ls cd pwd cp/mv/rm cat tail/head mkdir/rmdir find/locate grep ln Ac(on list change directory print working directory copy/move/remove concatenate view the first/last lines of a file create/remove a directory search for a file/directory search inside files Link MAN

try with ls! File/Dir Permissions

Linux Directory Structure

Proc FS easy way to view kernel and informa3on about currently running processes. alterna3ve to sysctl Example: tell to the kernel to do NOT respond to ping sysctl - a grep net.ipv4.icmp_echo_ignore_all sysctl - w net.ipv4.icmp_echo_ignore_all=1 or cat /proc/sys/net/ipv4/icmp_echo_ignore_all echo "1" > /proc/sys/net/ipv4/icmp_echo_ignore_all

Dev FS Access to physical devices (sound card, ram, hard drive, serial/parallel interface ) and presudo device (/dev/null, /dev/zero, /dev/random) Device manager: udev (daemon that speaks with kernet via netlink socket) Example: Create 1 Gigaof random data dd if=/dev/random of=/home/myhome/ randomdata bs=1m count=1024

Russian Roulece dd if=/dev/urandom of=/dev/kmem bs=1 count=1 seek=$random

Adding pieces: mount mount - t type device dir (umount) in /dev/fstab informa3on for startup moun3ng opera3ons Files that contain filesystem can be mounted (- o loop) It associates a file with a loop dev node (e.g. /dev/loop1) and mount the loop dev node to a moun3ng point ninux@ale:~$ mount /dev/sda1 on / type ext4 (rw) proc on /proc type proc (rw) sysfs on /sys type sysfs (rw,noexec,nosuid,nodev) fusectl on /sys/fs/fuse/connec3ons type fusectl (rw) none on /sys/kernel/debug type debugfs (rw) none on /sys/kernel/security type securityfs (rw) udev on /dev type devtmpfs (rw,mode=0755) devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620) tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755) none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880) none on /run/shm type tmpfs (rw,nosuid,nodev)

Installing new solware Dependencies problem but also compiler version, available services Gnu Build System Autoconf, Automake, Libtools On debian: apt- get install foo apt- cache search foo apt- get update apt- file search filename.txt./configure make make install

Archiving, Compression, Decompresson Tar: archive file/dir in one file.tar (no compression) Useful in combina3on with compression algorithm (most used: gunzip, bunzip2) Archive + gunzip: tar cfvz nameofarchive.tar.gz target_dir ( For bunzip2 subs3tute z with j ) Decompress tar xvfz nameofarchive.tar.gz File extension helps but when in doubt use the file command Tar useful for logs (text files contains high redundancy) See /var/logs Lot of u3li3es: zcat, zless

Shell Basically a shell: What shell am I using? Allows execu3ng programs echo $SHELL Allows set/get variable Allows programming Accepts commands (executable programs) absolute or rela3ve path commands in PATH Which NAME_OF_COMMAND Variable: Shell variable (local to a par3cular instance of the shell) to list set, to set VAR=VALUE, to get echo Environment variable (inherited by any program you start) to list: env, to set export or setenv, to get printenv or echo ninux@ale:~$ export PIPPO="pluto" ninux@ale:~$ printenv PIPPO pluto ninux@ale:~$ PLUTO= ciao" ninux@ale:~$ echo $PLUTO ciao

IO Channels When open every file stdin, stdout and stderr (FD 0, 1, 2) We can redirect the channels using major/ minor chars: <, <<, >>, > echo "hello world" > myfile Set the stdout of echo to myfile n>&m allows to redirect FD n to FD m program 2>&1 myfile All output and error of a program to myfile

Pipelines Pipes allow separate processes to communicate without having been designed explicitly to work together. Example: ls grep x Meaning : take the output of ls and give it as the input of grep

Shell tricks! ESC +. à repeat the last parameter CTRL + A à go to first char CTRL + E à go to last char CTRL + K à delete any char from the current posi3on to the end of the line More? man getline

Processes Every process has an ID (PID) ps aux à list processes top or htop to see them in real3me Kill send signals to process (SIGTERM, SIGKILL) nice: set the niceness (useful for process real3me or cpu intensive)

Foreground, Background and Screen Some programs (e.g. tcpdump) inhibits you to give more commands on the same shell without interrup3ng the program mycommand & à Put the command in background fg à put the last command in foreground CTRL+Z stop a program (to resume, fg) How keep a program running when we disconnect from the shell?

Foreground, Background and Screen Several solu3ons like nohup, disown, but the most confortable is screen Example: create a named screen called pippo screen S pippo top C- a d detach screen r pippo (re- akach) C- a c à create C- a n (or p) à next (or previous)

Editor hcp://www.viemu.com/a- why- vi- vim.html

Vim Modes Normal Visual Select Insert Cmdline Ex hcp://vimdoc.sourceforge.net/htmldoc/usr_toc.html vimtutor +6 addi3onal modes!

Vim: Basic commands <Esc> Enter command mode i Enter insert mode :w Save File :q Exit vim without saving x Delete the character under the cursor dw Delete the current word dd Delete the current line d$ Delete everything Right of the cursor yy Yank the current line onto the clipboard p Paste the clipboard u Undo :redo Redo G Jump to bocom of file /text Search for the textfrom the cursor > Indent set number syntax on Visual mode: markers subs3tute all: :%s/aaaa/bbbb/g

Exercise Using vim write this file: #!/bin/bash echo Hello World Then make it executable and launch your first script! more on bash scrip3ng: hcp://tldp.org/howto/bash- Prog- Intro- HOWTO.html

Bash scrip3ng Variables: modify the previous script in this way: #!/bin/bash STR="Hello World! echo $STR

Bash scrip3ng If and arguments #!/bin/bash if [ $1!= pippo ]; then echo usage: $0 pippo exit fi echo You Win!

Bash scrip3ng loop (for, while, un3l) and commands: modify the previous script in this way: #!/bin/bash - x for i in $( ls ); do echo item: $i done