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

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

INTRODUCTION TO 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

Student Remote Login Procedure (see picture below): 1. Start SSH Secure Shell 2. Click the computer icon (4 th on the toolbar) 3.

*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...

Computer Systems and Architecture

Linux Systems Administration Getting Started with Linux

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

Introduction to Linux. Roman Cheplyaka

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

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

EECS2301. Lab 1 Winter 2016

Introduction to Linux Workshop 1

Introduction: What is Unix?

Linux Essentials Objectives Topics:

Files and Directories

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

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

Filesystem Hierarchy Operating systems I800 Edmund Laugasson

Perl and R Scripting for Biologists

CS197U: A Hands on Introduction to Unix

Outline. Structure of a UNIX command

Unix Handouts. Shantanu N Kulkarni

Linux Command Line Primer. By: Scott Marshall

Unix Filesystem. January 26 th, 2004 Class Meeting 2

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

Presented by Bill Genske Gary Jackson

Introduction to Linux

Chapter-3. Introduction to Unix: Fundamental Commands

CS197U: A Hands on Introduction to Unix

A Brief Introduction to Unix

Computer Systems and Architecture

CSCI 2132 Software Development. Lecture 4: Files and Directories

Introduction to Supercomputing

Unix File System. Class Meeting 2. * Notes adapted by Joy Mukherjee from previous work by other members of the CS faculty at Virginia Tech

Introduction to UNIX command-line

ECE 471 Embedded Systems Lecture 10

Introduction to Unix: Fundamental Commands

Unix Introduction to UNIX

Linux Training. for New Users of Cluster. Georgia Advanced Computing Resource Center University of Georgia Suchitra Pakala

Introduction to the Linux Command Line

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

Getting your department account

Mills HPC Tutorial Series. Linux Basics I

CISC 220 fall 2011, set 1: Linux basics

UNIX Concepts COMPSCI 386

Unix Workshop Aug 2014

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

Topics. Installation Basics of Using GNU/ Linux Administration Tools

Overview of the UNIX File System

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

Introduction to Linux

Introduction Into Linux Lecture 1 Johannes Werner WS 2017

File System Hierarchy Standard (FHS)

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

INF322 Operating Systems

Introduction to UNIX I: Command Line 1 / 21

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

Introduction to Linux Part I: The Filesystem Luca Heltai

Intro to Linux. this will open up a new terminal window for you is super convenient on the computers in the lab

Linux Kung-Fu. James Droste UBNetDef Fall 2016

Operating Systems. Copyleft 2005, Binnur Kurt

Introduction to Linux

Operating Systems 3. Operating Systems. Content. What is an Operating System? What is an Operating System? Resource Abstraction and Sharing

CS246 Spring14 Programming Paradigm Notes on Linux

Introduction to Linux Command-Line for Beginners

Introduction of Linux

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

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

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

UNIX System Programming Lecture 3: BASH Programming

Basic Shell Commands. Bok, Jong Soon

Introduction to UNIX Command Line

Std: XI CHAPTER-3 LINUX

PROGRAMMAZIONE I A.A. 2015/2016

commandname flags arguments

(a) About Unix. History

Introduction to Linux Basics

CENG 334 Computer Networks. Laboratory I Linux Tutorial

Unix/Linux Operating System. Introduction to Computational Statistics STAT 598G, Fall 2011

Assume that username is cse. The user s home directory will be /home/cse. You may remember what the relative pathname for users home directory is: ~

Commands are in black

CS370 Operating Systems

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

CS4350 Unix Programming. Outline

Linux Kung Fu. Stephen James UBNetDef, Spring 2017

Unix Tools / Command Line

Introduction to Linux

Introduction to the UNIX command line

Embedded System Design

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

Linux crash lecture by Andrey Lukyanenko

2) clear :- It clears the terminal screen. Syntax :- clear

Overview of the UNIX File System. Navigating and Viewing Directories

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

A Hands-On Tutorial: RNA Sequencing Using High-Performance Computing

COMS 6100 Class Notes 3

Transcription:

GNU/Linux 101 Casey McLaughlin Research Computing Center Spring Workshop Series 2018 rccworkshop IC;3df4mu

bash-2.1~# man workshop Linux101 RCC Workshop L101 OBJECTIVES - Operating system concepts - Linux concepts - Linux CLI - Basic systems administration - HPC, Spear, other RCC resources

bash-2.1~# whoami # cat ~/casey.yml ---- name: Casey McLaughlin - 13+ years at FSU - Support, SysAdmin, Web Dev - Long-time Linux Nerd

Basic Commands $ whoami $ hostname $ date $ cal $ df $ free $ exit

Anatomy of a Command # ls -1 -a /home/bob executable options arguments

Example Arguments $ cal -j $ date -R $ df -h $ df -h --total $ ls -1 /etc $ ls -1A /etc

Getting Help With Commands $ whatis $ man $ info $ type $ which

Command Tidbits $ clear Up Arrow TAB $ history $ history grep [command] $!! $!number $!?string

What is a Shell?

Linux is Multi-User! [CTRL+ALT+F2] Escape the GUI F1 - F6 are TTYs [CTRL+ALT+F1] Return to the GUI

Connecting Remotely 128.186.1.32 144.174.87.24 $ ssh [USER]@hpc-login.rcc.fsu.edu PW: linuxrocks#1

Connecting Remotely $ ip addr show $ ifconfig $ ping $ hostname

Linux vs BSD vs tons of others POSIX: "Portable Operating System Interface" IEEE spec for maintaining compatibility between OSes POSIX systems have similar shells.

Linux Distributions http://futurist.se/gldt/wp-content/upl oads/12.09/gldt1209.png

Windows Re-Education

Windows Disk Drives

Windows Disk Drives C: First Hard Drive D: Second Hard Drive E: CD-ROM Drive G: USB Drive I: Network Mapped Drive

Linux File System / Primary mount /mnt/myserver Network mount /media/cdrom CD-ROM mount /foobar Second HDD /my/happy/usb USB Drive

Linux Filesystem $ cd $ pwd $ ls Relative vs absolute paths.. syntax

Linux Filesystem Directories / Filesys Root /bin Binaries /boot Kernel /dev Devices /etc Config /home User Dirs /lib Core Libs /media CDROM, USB /mnt Other mounts /opt Miscellaneous /proc Internal Stuff /root Root user home /sbin Sys Binaries /srv Services /tmp Temp Directory /usr User Programs /var Variable libs* /lost+found Trash

Some Important Things ~ = My Home Directory clear = Clear the terminal echo = Print something on the screen [TAB] = Auto-complete commands

The Environment $ printenv $ echo $PATH $ echo $PWD $ sh

/bin and /usr/bin (and *) $ ls /bin $ ls /usr/bin $ ls /usr/bin/c* $ ls /usr/bin/c?9 $ ls /usr/bin/c?9*

Manipulating Files $ file $ touch $ echo... > file.txt $ cat $ more $ less

Manipulating Files $ mkdir $ cp $ mv $ rmdir $ rm (-r)

Searching for Files $ locate [filename] $ find [location] --name [filename] Ex: $ locate passwd $ find /etc --name passwd

Text Editors $ nano somenewfile.txt $ vi somenewfile.txt

Getting files from the Internet $ whatis wget $ type wget $ cd ~ (go home) $ wget http://bit.ly/twain4 $ wget -O tw.txt http://bit.ly/twain4

Chaining Commands $ ls /etc && ls ~ && ls / $ whatis grep && type grep

grep $ grep philosopher tw.txt $ grep workshop /etc/passwd $ grep -n philosopher tw.txt

Piping and Redirection Default Behavior: $ some command Terminal Screen Piping (substitute for ): $ some-cmd another-cmd etc Terminal $ some-cmd another-cmd >> a-file

Piping and Redirection $ ls -1 wc -l $ cat tw.txt wc -l $ cat /etc/passwd wc -l $ cat /etc/passwd sort $ cat /etc/passwd sort less

Piping and Redirection $ wget -O cr.txt http://bit.ly/ctries4 $ cat cr.txt $ cat cr.txt wc -l $ cat cr.txt sort $ cat cr.txt sort > cr-sorted.txt $ less cr-sorted.txt

Piping to grep is the shizzle $ cat cr.txt grep -n Luxembourg $ history grep wget $ history grep wget > ~/wgcmds.txt $ man ls grep recursive $ man grep grep case $ ls -1 /bin/c* grep ch wc -l

Manipulating Data from the Net $ curl http://bit.ly/twain4 $ man curl grep location $ curl -sl http://bit.ly/twain4 $ curl -sl http://bit.ly/twain4 wc -l $ curl -sl http://bit.ly/twain4 > twain.txt $ curl -sl http://bit.ly/twain4 grep Literary

Piping Summary Pipe output to another command > Pipe output to file (overwrite) >> Pipe output to file (append) < Pipe file contents to command $ echo -e \nnarnia >> cr.txt && \ sort cr.txt > cr.txt

Users and Permissions Users can be in multiple groups. Root user is special.

Linux File Permissions # ls -l /bin -rwxr-xr-x root root 1779 Jan 10 05:05 uname # ls -l /etc/host.conf -rw-r--r-- root root 1779 Jan 10 05:05 uname

Linux File Permissions

Octal File Permissions 0 000 --- 1 001 --x 2 010 -w- 3 011 -wx 4 100 r-- 5 101 r-x 6 110 rw- 7 111 rwx

User File Commands $ id or $ whoami $ groups $ file [somefile] $ chmod [perms] [file] $ chown [user] [file] $ passwd $ su

SUDO: Running Commands as root $ sudo [command] $ sudo su # whoami

Copying files across a network # scp user@[server]:/path/to/file /localpath

BASH Scripts #!/bin/bash HNAME=`hostname` UNAME=`whoami` echo -e "Hello World\nI am running on $HNAME" echo -e "\nmy name is $UNAME\n\n"

Compiling Software # whatis gcc # type gcc

Compiling Software # wget http://bit.ly/primescprog # gcc -o gimmenums primescprog # mv primescprog primes.c # gcc -o gimmenums primes.c

Compiling Software Part Duex # wget -O d.tgz http://bit.ly/gnudiction # tar -zvf d.tgz # ls. # cd diction-1.11 #./configure # make

Submitting Jobs to MOAB Test Connection and then Move Code to HPC # ssh [user]@hpc-login.rcc.fsu.edu # exit # scp ~/primes.c [user]@submit.hpc.fsu.edu Login to HPC and compile it # ssh [user]@hpc-login.rcc.fsu.edu # gcc -o primes.sh primes.c

Submit Job to HPC Queue $ nano ~/submit.sh #!/bin/bash #SBATCH --job-name="myjob" #SBATCH -n 1 #SBATCH -p quicktest #SBATCH -t 00:00:05 primes.sh $ sbatch submit.sh

Hidden Files Anything beginning in a dot (. ) in Linux** is hidden. Why hide files? # ls -a

Aliases # alias lm="ls -l less" # alias countfi="ls -1 wc -l" # unalias lm

.bash_aliases # nano ~/.bash_aliases lm="ls -l less" countfi="ls -1 wc -l" # source ~/.bash_aliases

CRON Jobs # * * * * * command to execute # # # # day of week (0-6) (0 to 6 are Sun to Sat, or use names; # 7 is Sunday, the same as 0) # month (1-12) # day of month (1-31) # hour (0-23) # min (0-59)

CRON Jobs # crontab -e # Runs every minute 01 * * * * echo "Hello from Cron" # Runs every day at 1:01am 01 01 * * * /usr/bin/runbackup # Runs on May 4 every year @ 4:30pm 30 16 04 05 * echo "Happy Birthday, Casey"

System Administration -Process Management (what is running?) -Installing Software (package management) -User Management -Configuring Services

<<< END; These Slides: http://bit.ly/1j27vuu Book:http://linuxcommand.org/tlcl.php @fsurcc @caseyamcl FSU Research Computing Center https://rcc.fsu.edu