Linux Systems Administration Getting Started with Linux

Similar documents
Overview LEARN. History of Linux Linux Architecture Linux File System Linux Access Linux Commands File Permission Editors Conclusion and Questions

Unix / Linux Overview

GNU/Linux: An Essential Guide for Students Undertaking BLOSSOM

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

Perl and R Scripting for Biologists

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

commands exercises Linux System Administration and IP Services AfNOG 2015 Linux Commands # Notes

Introduction to Linux

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

Introduction to Linux

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

INTRODUCTION TO LINUX

Linux Kung Fu. Stephen James UBNetDef, Spring 2017

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

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

Chapter-3. Introduction to Unix: Fundamental Commands

Getting Started with Linux Editors. Network Startup Resource Center

Linux Kung-Fu. James Droste UBNetDef Fall 2016

Unix System Architecture, File System, and Shell Commands

Linux Essentials Objectives Topics:

Linux Kung Fu. Ross Ventresca UBNetDef, Fall 2017

Basic Linux Command Line Interface Guide

Introduction to Unix: Fundamental Commands

Basic Linux Command Line Interface Guide

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

Introduction: What is Unix?

CHE3935. Lecture 1. Introduction to Linux

Chapter Two. Lesson A. Objectives. Exploring the UNIX File System and File Security. Understanding Files and Directories

EECS2301. Lab 1 Winter 2016

Lezione 8. Shell command language Introduction. Sommario. Bioinformatica. Mauro Ceccanti e Alberto Paoluzzi

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

Introduction to UNIX I: Command Line 1 / 21

Post Ubuntu Install Exercises

Introduction of Linux

Some Ubuntu Practice...

Lezione 8. Shell command language Introduction. Sommario. Bioinformatica. Esercitazione Introduzione al linguaggio di shell

CSE 303 Lecture 2. Introduction to bash shell. read Linux Pocket Guide pp , 58-59, 60, 65-70, 71-72, 77-80

Getting started with Hugs on Linux

Linux Essentials. Programming and Data Structures Lab M Tech CS First Year, First Semester

Welcome to getting started with Ubuntu Server. This System Administrator Manual. guide to be simple to follow, with step by step instructions

CS197U: A Hands on Introduction to Unix

Unix Shells and Other Basic Concepts

Linux Command Line Interface. December 27, 2017

CENG 334 Computer Networks. Laboratory I Linux Tutorial

Using LINUX a BCMB/CHEM 8190 Tutorial Updated (1/17/12)

1 Installation (briefly)

Introduction to Linux

Working with Ubuntu Linux. Track 2 Workshop June 2010 Pago Pago, American Samoa

Linux crash lecture by Andrey Lukyanenko

Chap2: Operating-System Structures

Introduction to Linux Part 1. Anita Orendt and Wim Cardoen Center for High Performance Computing 24 May 2017

Getting your department account

Getting started with Hugs on Linux

THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering

UNIX System Programming Lecture 3: BASH Programming

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

CSCI 2132 Software Development. Lecture 3: Unix Shells and Other Basic Concepts

PiCloud. Building owncloud on a Raspberry PI

The Unix Shell & Shell Scripts

h/w m/c Kernel shell Application s/w user

3 Connection, Shell Serial Connection over Console Port SSH Connection Internet Connection... 5

ECE 471 Embedded Systems Lecture 10

AMS 200: Working on Linux/Unix Machines

LIS Linux/Unix Command Line Goodness

Introduction to Linux

Introduction to Linux

Working With Unix. Scott A. Handley* September 15, *Adapted from UNIX introduction material created by Dr. Julian Catchen

EECS Software Tools. Lab 2 Tutorial: Introduction to UNIX/Linux. Tilemachos Pechlivanoglou

Filesystem Hierarchy Operating systems I800 Edmund Laugasson

Session 1: Accessing MUGrid and Command Line Basics

Unix basics exercise MBV-INFX410

Physics REU Unix Tutorial

D, E I, J, K. Generalized Regular Expression Parser (GREP), 110 Generic 105 key (Intl) PC, 29 git command, 242

Linux Command Line Primer. By: Scott Marshall

Linux for Beginners. Windows users should download putty or bitvise:

Unix Handouts. Shantanu N Kulkarni

Introduction to UNIX. Logging in. Basic System Architecture 10/7/10. most systems have graphical login on Linux machines

A Brief Introduction to Unix

CS Fundamentals of Programming II Fall Very Basic UNIX

EE516: Embedded Software Project 1. Setting Up Environment for Projects

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

Filesystem Hierarchy and Permissions

CS CS Tutorial 2 2 Winter 2018

CS370 Operating Systems

15-122: Principles of Imperative Computation

Lab 1 Introduction to UNIX and C

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

Unix. Examples: OS X and Ubuntu

Intermediate Programming, Spring Misha Kazhdan

Outline. Structure of a UNIX command

LAB #7 Linux Tutorial

CS/CIS 249 SP18 - Intro to Information Security

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

Network Monitoring & Management. A few Linux basics

Ubuntu Practice and Configuration Post Installation Exercises interlab at AIT Bangkok, Thailand

CISC 220 fall 2011, set 1: Linux basics

Mills HPC Tutorial Series. Linux Basics I

Short Read Sequencing Analysis Workshop

CS197U: A Hands on Introduction to Unix

Lab Working with Linux Command Line

Transcription:

Linux Systems Administration Getting Started with Linux Network Startup Resource Center www.nsrc.org These materials are licensed under the Creative Commons Attribution-NonCommercial 4.0 International license (http://creativecommons.org/licenses/by-nc/4.0/)

Who Are We Teaching? You have experience with Linux or Unix Real-world experience You have an Intermediate level of knowledge Are we right?

Objectives Review Core Concepts & Terminology System Access Users: Types, Changing, Acting as Others Shells User Processes File System Layout Editors Editing Configuration Files Software Management Managing Services & Processes Checking System & Memory Load

Log into your Systems ssh pcn.ws.nsrc.org user sysadm where N is the number of your pc lab password is written on the board Windows Users: use putty Mac and Linux Users: from your terminal

System Access Logging In Locally With a GUI or Graphical User Interface With a CLI or Command Line Interface Logging in Remotely From Windows, with putty From Linux or Mac, with ssh Requirements: You need a username and password These were given out in class

Types of Users Root User Normal User The Super User The sysadm account System User An account used by an application

The Super User By default, one account can do anything: root Some Linux distributions disable logging in as this user Root is powerful It can change (or delete) any file It can perform any function Root is dangerous Inexperienced users can break a system Root can be exploited by attackers Limit what Root can do remotely if you allow at all.

Normal Users A standard user account Can log in and access a home directory Can have group permissions Can read/write/execute in its home directory Cannot start or stop the system Cannot start or stop system services Standard user accounts are safer than root

System Users A user account used by a program ftp, www-data, postgres, ntp Typically cannot log in interactively May or may not have shell access Can have group permissions System Users are safer than other users Don't run applications as root Don't run applications as a normal user

Become Another User (like root) su: substitute user identity Syntax: su [options] [username] If no username, root is assumed su will ask you for the target user's password A new shell is opened as that user Quit the shell by typing exit

Execute a Command as Another User sudo: executs a single command as another user sudo syntax: Sudo [options] [-u user] command If no user is specified, root is assumed New shell opens with other user's privileges The specified command is executed The shell is exited

Shells Command Line Interface (CLI) for executing programs Windows equivalent: command.com or command.exe Also programming languages for scripting DOS/Windows equivalent: batch files, VBScript Linux/Unix: Perl, php, python, etc. You have a choice of similar shells sh: the Bourne Shell. Standardized in POSIX bash: the Bourne-Again Shell. POSIX + command history Others: csh, ksh, tcsh, zsh

User Processes Programs you run, typically interactively Often-used programs have short, cryptic names including the shell! ls, cp, rm, pwd, cd, cat, less, mkdir, mv, rm, man Hundreds of programs included in base systems In embedded Linux and Linux routers, sometimes these are combined into a single binary called BusyBox Thousands of programs can be downloaded, free Thousands more can be purchased

Common Commands ls: list the contents of a directory pwd: print working directory cd: change directory mkdir: make a directory cp: copy mv: move rm: remove man: display the manual

Software Management @ the CLI dpkg is the Debian/Ubuntu software manager dpkg --get-selections: see what's installed dpkg-reconfigure: reconfigure a package dpkg --purge: remove software & its config files apt is the best way to use dpkg apt-cache search: see what's available apt-get update: get a new list of what's available apt-get install: install software & its dependancies

The Format of a Command command [options] parameters Commands are programs Options modify commands Typically a dash followed by a letter (-v) Some utilities also allow dash dash word (--verbose) Commands act on Parameters (ls -al /etc) Spaces are critical -- help!= --help

Command Examples Display a list of files in the current directory: ls Display a list of files in a long listing format: ls -al Display a list of files in another directory: ls -al /etc What else can you do with ls? man ls to find out

Command Examples Equivalent ways to use: ls -alh ls -lah ls -l -a -h ls -l -all --human-readable There is no -- option for -l Read the man page, or type ls --help

Stopping Command Output A command keeps going? Stop it with ctrl-c root@librenms:~# ping nsrc.org PING nsrc.org (128.223.157.19) 56(84) bytes of data. 64 bytes from nsrc.org (128.223.157.19): icmp_seq=1 ttl=51 time=161 ms 64 bytes from nsrc.org (128.223.157.19): icmp_seq=2 ttl=51 time=159 ms ^C --- nsrc.org ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 3005ms rtt min/avg/max/mdev = 159.827/161.459/164.534/1.902 ms Stuck in less or another paging application? Press the q key

Find & Edit Past Commands Try your up arrow Now type history Run a past command by typing!number Looking for something in particular? history grep command-name Don't retype commands It takes longer It can lead to errors

Linux File System / /root /etc /boot /mnt /home /sys /proc /bin /dev /lib /sbin /usr Libraries The super-user's home directory /var Variable Data Logs, Spools, W eb General purpose mount point Executables The kernel image is in here System conf guration f les Users' directories are under here Aview of internal kernel data The kernel's view of the hardware Special device fles live here bin More executables sbin lib More libraries

Linux File System Today usually a single partition Can be spread across multiple partitions Partitions can be mounted at various levels /var and /tmp are sometimes different partitions this is safer for experimental or unstable code filling /tmp should not crash your computer! Attached or Network drives can be mounted /mnt is a good place for these

Configuration Files Text files that tell programs how to operate Typically plain text, sometimes XML or similar Often are case sensitive Sometimes have comments and instructions # is the most common character for comments /* */, or // are other common comment delimiters Other, less common patterns exist

Configuration File Patterns Options are sometimes turned off by default ## a description of the option ## remove the # below to enable the option # default setting = off Quotes are used... sometimes like this 'sometimes like this' Caps and CamelCase can be important

Viewing Configuration Files If you want to look, but not touch cat <filename> displays a files contents more <filename> displays with pagination less <filename> paginates with search & more Changing files usually requires an editor

Linux Editors We will be editing text files in CLI mode You can use any editor you want ed, emacs, joe, nano, vi, vim Set your favourite program as editor sudo update-alternatives --config editor Don't have the editor you want? Install it! sudo apt-get install program We can help you with nano or vi

Linux Editors Go to line 99 in a file nano = ctrl _ 99 vi = :99 Find a string hello in a file nano = ctrl w hello vi = /hello (then n for next or N for previous) Save and quit nano = ctrl o ctrl x vi = esc + :wq Use your Home and End Keys Clicking your mouse will not move your cursor

Software Management @ the CLI dpkg is the Debian/Ubuntu software manager dpkg --get-selections: dpkg-reconfigure: dpkg --purge: see what's installed reconfigure a package remove software & its config files apt is the best way to use dpkg apt-cache search: apt-get update: see what's available get a new list of what's available apt-get install: install software & its dependancies

Services Management Startup Scripts /etc/init.d/ /etc/init/ Controlling Services sudo service servicename action start, stop, restart, reload, status /etc/init.d/service action

Process Management ps aux see all processes ps aux grep apache see just apache sudo kill 1234 kill process 1234 sudo kill -9 1234 force kill process 1234 If it's hung or stuck and won't quit

Check on the System cat /etc/*-release : find your Linux version top : a real-time view of a running system free -h : show the free memory df -h : show the disk utilisation netstat -anp more : show net connections ifconfig -a grep inet : find your IP addresses sudo iftop -i eth0 : show network utilisation

Reviewing System Access Users: Types, Changing, Acting as Others Shells User Processes File System Layout Editors Editing Configuration Files Software Management Managing Services & Processes Checking System & Memory Load