Linux Kung Fu. Ross Ventresca UBNetDef, Fall 2017

Similar documents
Linux Kung Fu. Stephen James UBNetDef, Spring 2017

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

Linux Kung-Fu. James Droste UBNetDef Fall 2016

LAB #7 Linux Tutorial

Linux Essentials Objectives Topics:

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

The Wonderful World of Services VINCE

Perl and R Scripting for Biologists

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

Commands are in black

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

Linux Systems Administration Getting Started with Linux

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

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

Introduction: What is Unix?

Unix Tutorial Haverford Astronomy 2014/2015

Linux Command Line Primer. By: Scott Marshall

Lab Working with Linux Command Line

Introduction to Linux (Part I) BUPT/QMUL 2018/03/14

Introduction to Linux

Lab 2: Linux/Unix shell

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

Introduction to Linux

Introduction to Linux Workshop 1

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

Computer Systems and Architecture

Examples: Directory pathname: File pathname: /home/username/ics124/assignments/ /home/username/ops224/assignments/assn1.txt

Introduction to UNIX command-line

Computer Systems and Architecture

CENG 334 Computer Networks. Laboratory I Linux Tutorial

UNIT 9 Introduction to Linux and Ubuntu

UNIX COMMANDS AND SHELLS. UNIX Programming 2015 Fall by Euiseong Seo

Command-line interpreters

Introduction to UNIX I: Command Line 1 / 21

CS Fundamentals of Programming II Fall Very Basic UNIX

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

Linux crash lecture by Andrey Lukyanenko

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

MANAGING THE NONUNIFORM BEHAVIOUR OF TERMINALS AND KEYBOARDS. : WHEN THINGS GO WRONG

CSCI 2132 Software Development. Lecture 4: Files and Directories

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

Files and Directories

Course Wiki. Today s Topics. Web Resources. Amazon EC2. Linux. Apache PHP. Workflow and Tools. Extensible Networking Platform 1

National University of Computer and Emerging Sciences Operating System Lab - 02 Lab Manual

Working with Basic Linux. Daniel Balagué

Chap2: Operating-System Structures

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

UNIX Essentials Featuring Solaris 10 Op System

Linux Operating System Environment Computadors Grau en Ciència i Enginyeria de Dades Q2

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

Chapter 4. Unix Tutorial. Unix Shell

Command Line Interface The basics

Linux & Shell Programming 2014

Week 5 Lesson 5 02/28/18

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

Basic Linux Command Line Interface Guide

Basic Linux Command Line Interface Guide

Linux Tutorial. Ken-ichi Nomura. 3 rd Magics Materials Software Workshop. Gaithersburg Marriott Washingtonian Center November 11-13, 2018

CS370 Operating Systems

INTRODUCTION TO LINUX

Introduction to the UNIX command line

System Programming. Introduction to Unix

Introduction p. 1 Who Should Read This Book? p. 1 What You Need to Know Before Reading This Book p. 2 How This Book Is Organized p.

Linux at the Command Line Don Johnson of BU IS&T

The Wonderful World of Services. By: Stefanja

Exercise Sheet 2. (Classifications of Operating Systems)

Chapter-3. Introduction to Unix: Fundamental Commands

Lab Authentication, Authorization, and Accounting

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

Everything about Linux User- and Filemanagement

Course 144 Supplementary Materials. UNIX Fundamentals

The Command Line. Matthew Bender. September 10, CMSC Command Line Workshop. Matthew Bender (2015) The Command Line September 10, / 25

CS 215 Fundamentals of Programming II Spring 2019 Very Basic UNIX

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

History. Terminology. Opening a Terminal. Introduction to the Unix command line GNOME

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

Introduction to Linux

02. At the command prompt, type usermod -l bozo bozo2 and press Enter to change the login name for the user bozo2 back to bozo. => steps 03.

Lec 1 add-on: Linux Intro

1. Open VirtualBox and start your linux VM. Boot the machine and log in with the user account you created in Lab #1. Open the Terminal application.

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

DATA 301 Introduction to Data Analytics Command Line. Dr. Ramon Lawrence University of British Columbia Okanagan

Why learn the Command Line? The command line is the text interface to the computer. DATA 301 Introduction to Data Analytics Command Line

Operating Systems and Using Linux. Topics What is an Operating System? Linux Overview Frequently Used Linux Commands

Linux Shell Script. J. K. Mandal

System Administration

COMS 6100 Class Notes 3

Introduction to Linux

Parallel Programming Pre-Assignment. Setting up the Software Environment

Review of Fundamentals

Unix File System. Learning command-line navigation of the file system is essential for efficient system usage

Helsinki 19 Jan Practical course in genome bioinformatics DAY 0

Mills HPC Tutorial Series. Linux Basics I

Basic Linux Security. Roman Bohuk University of Virginia

Linux Command Line Interface. December 27, 2017

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

Some Ubuntu Practice...

1 Installation (briefly)

Unix tutorial. Thanks to Michael Wood-Vasey (UPitt) and Beth Willman (Haverford) for providing Unix tutorials on which this is based.

5/20/2007. Touring Essential Programs

Transcription:

Linux Kung Fu Ross Ventresca UBNetDef, Fall 2017

GOTO: https://apps.ubnetdef.org/

What is Linux? Linux generally refers to a group of Unix-like free and open source operating system distributions built around the Linux kernel A typical Linux distribution comprises a Linux kernel, GNU tool and libraries, additional software, documentation and desktop environment Some might use their own package managers

Over 500 distributions!

Terminal, Command Line, and Shell To simply put it the terminal is the text input/output environment. The command line is an interface where the user types the command and presses the enter key to execute the command The shell is the primary interface that interprets the commands that get entered in. Most Linux distributions have Bash as their shell, but others exist as well.

The Terminal you@ubnetdef:~$ -Username: you -Host name: ubnetdef -Current working directory: ~ -Superuser: No($) root@universe:/etc/init.d# -Username: root -Host name: universe -Current working directory: /etc/init.d -Superuser: Yes (#)

Format of Commands To execute a command, type its name and arguments at the commands line Usually commands follow this format $ls l /etc Command Options (Flag) Argument s

Editing files in the terminal In order to manipulate files from the terminal you need a command line editor. Popular Editors Nano Vi/Vim Emacs

Working With Directories and Files

$ pwd The pwd (print working directory) command displays the name of the current working directory It tells you where you currently are in the file system $rossvent@ubnetdef:~$ pwd - /home/rossvent

$echo Echo allows a user to repeat, or echo text to standard output $rossvent@ubnetdef:~$ echo Hello World Hello World Useful for scripting Can also be redirected $rossvent@ubnetdef:~$ echo Appending to file > redirect.txt

$ls The ls command lists files and directories within the current working directory -$ls It can also list contents with a specified path -$ls /etc To include hidden entries -$ls a To display more information -$ls l You can even sort the list! -$ls S

$cd Changes the current directory in Linux. $cd /var/log Goes to the root directory regardless of location (Absolute path) $cd / Goes to the parent of the current working directory $cd.. Goes to home directory $cd ~ Can navigate to folders relative to current working directory

$cat Displays the contents of a file or files on the terminal $cat /etc/motd cat can also concatenate or glue together two or more files $cat file1 file2 file3 Can also be redirected to a new file. $cat file1 file2 file3 > bigfile Also appended to a file! $cat file4 >> bigfile

$more Allows you to display output in the terminal one page at a time When the text passed to it is too large to fit one screen it pages it. You can scroll down through files but not back up!

$less Actually more useful that the more command! Written by a man who was fed up with more s inability to scroll backwards Supports any type of file that supports scrolling Can customize to open any type of file

$mkdir The command is used to make a new directory $mkdir name_of_directory Can also make all directories leading up to the target directory if needed $mkdir p /tmp/a/b/c

$rm The rm command removes files or directories To remove a file: $rm file.txt To remove any directory including all the files inside $rm rf deleteme/ To remove an empty directory $ rmdir empty_dir Be very careful using the rm command, as it doesn t prompt you to confirm deletion. And NEVER type rm rf/

$ man The man command is used to format and display the man pages or the manual Provides extensive documentation about specified command $man ls $man man

Processes

$ps The ps (process status) command is used to provide information about the currently running processes. Each processes has a unique identification numbers (PID) $ps The aux option provides a more detailed list of processes. $ps aux

$top Similar to ps, but is interactive and updates every second A similar utuility, htop, provides a similar function, but usually needs to be installed first

$kill Asks a process to shut down nicely $ kill <pid> If it is being unresponsive, the kernel can decide to take matters into his own hands $kill -9 <pid> $kill KILL <pid> $kill SIGKILL <pid>

Services In Linux, services are applications or processes that run in the background They are sometimes referred to as daemons

Services There are two main ways to control services - System V (older) - systemd (newer) SystemV #service <name> <start stop restart reload status> #service apache status systemd #systemctl <start stop restart reload status> <name> #systemctl reload nginx

User Management Linux is a multi-user operating system in that it allows multiple users on different computers or terminals to access a single system.

Users and Groups Create a user account #adduser <username> Create a group #addgroup <groupname> Add a user to a group #usermod G <groupname> -a <username>

Users and Groups See all groups a user is in: $groups $groups <username> See more information about a user: $ id $ id <username> See the following files: $less /etc/passwd $less /etc/groups

$passwd The passwd command allows changing the passwords of user accounts Changing user passwords: $passwd #passwd <username> Locking and unlocking user accounts: #passwd l <username> #passwd u <username> The passwords are stored as hashes in the file /etc/shadow

$su The su command allows you to switch user If no username is specified, the superuser account (root) will be used by default

$sudo Allows permitted users to execute a command as the superuser (i.e superuser do ) or another user (if specified) Configured in the file /etc/sudoers (can be edited with the visudo command) #visudo

Networking

$ifconfig The ifconfig command can be used to view or configure network interfaces View all interfaces: $ ifconfig View specific interface: $ ifconfig <interface-name> Bring an interface online or offline (respectively): # ifconfig <interface-name> <up down>

$ping The ping command sends an ICMP ECHO_REQUEST to network hosts. Pinging IP addresses is usually a simple way to check if your internet connection is working $ ping 8.8.8.8

Package Managing Package managers can help with automating common tasks such as installing, upgrading, and uninstalling programs or packages. Examples: - apt (Advanced Packaging Tool) aptitude dpkg yum dnf

$apt Update the local package index: # apt update Upgrade a package # apt upgrade <package-name> Upgrade all packages: # apt upgrade

$apt Install a package #apt install <package-name> Uninstall a package (leave configuration) #apt uninstall <package-name> Uninstall a package (remove configuration) #apt purge <package-name> Uninstall unneeded dependencies: #apt autoremove

Directory Structure

Useful tips and tricks Pressing the up arrow recalls the previous command Pressing tab while typing a command can sometimes help to autocomplete a command s name or a file/directory path If you need to stop a currently-running command, use Ctrl+C Typing!! in the terminal will re-run the last command If you accidentally print the contents of a binary file to the terminal, it may affect the terminal display. The reset command can be used to resolve that issue.