GNU/Linux 101 Welcome! Please login with your FSUID GNU/Linux 101 - - PowerPoint PPT Presentation

gnu linux 101
SMART_READER_LITE
LIVE PREVIEW

GNU/Linux 101 Welcome! Please login with your FSUID GNU/Linux 101 - - PowerPoint PPT Presentation

GNU/Linux 101 Welcome! Please login with your FSUID GNU/Linux 101 Alex Townsend Research Computing Center Data @ Dirac Workshop Series September, 2019 bash-2.1~# man workshop Linux101 RCC Workshop L101 OBJECTIVES - Operating system


slide-1
SLIDE 1

Welcome! Please login with your FSUID

GNU/Linux 101

slide-2
SLIDE 2

GNU/Linux 101

Alex Townsend Research Computing Center Data @ Dirac Workshop Series September, 2019

slide-3
SLIDE 3

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
slide-4
SLIDE 4

bash-2.1~# whoami

# cat ~/alex.yml

  • name: Alex Townsend
  • 5th Year PhD Student
  • Department of Scientific Computing
  • Long-Time RCC Intern/Volunteer
slide-5
SLIDE 5

What is a Shell?

slide-6
SLIDE 6

Connecting Remotely

$ ssh [USER]@hpc-login.rcc.fsu.edu

slide-7
SLIDE 7

Let’s connect to a Linux server Open the terminal Hostname: hpc-login.rcc.fsu.edu Username: workshop-001 (-020) Password: linuxRocks#!

slide-8
SLIDE 8

GUI vs CLI

Graphical User Interface Command-Line Interface

slide-9
SLIDE 9

Linux vs Mac vs BSD vs Others

POSIX: "Portable Operating System Interface" IEEE spec for maintaining compatibility between OSes POSIX systems have similar shells.

slide-10
SLIDE 10

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

Basic Commands

slide-11
SLIDE 11

Anatomy of a Command

# ls -1 -a /home/bob executable

  • ptions

arguments

slide-12
SLIDE 12

Example Arguments

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

slide-13
SLIDE 13

Getting Help With Commands

$ whatis $ man $ info $ type $ which

slide-14
SLIDE 14

Command Tidbits

$ clear Up Arrow TAB $ history $ !! $ !number $ !?string

slide-15
SLIDE 15

Network Commands

$ ip addr show $ ifconfig $ ping $ hostname

slide-16
SLIDE 16

Linux Distributions

https://upload.wikimedia.org/wikipedia /commons/1/1b/Linux_Distribution_Timel ine.svg

slide-17
SLIDE 17

Windows Re-Education

slide-18
SLIDE 18

Windows Disk Drives

slide-19
SLIDE 19

Windows Disk Drives

C: First Hard Drive D: Second Hard Drive G: USB Drive I: Network Mapped Drive

slide-20
SLIDE 20

Linux File System

/ ← Primary mount /mnt/myserver ← Network mount /foobar ← Second HDD /my/happy/usb ← USB Drive

slide-21
SLIDE 21

Linux Filesystem

$ cd $ pwd $ ls Relative vs absolute paths ‘..’ syntax

slide-22
SLIDE 22

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

slide-23
SLIDE 23

Some Important Things

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

slide-24
SLIDE 24

The Environment

$ printenv $ echo $PATH $ echo $PWD $ sh

slide-25
SLIDE 25

/bin and /usr/bin (and *)

$ ls /bin $ ls /usr/bin $ ls /usr/bin/c* $ ls /usr/bin/c?9 $ ls /usr/bin/c?9*

slide-26
SLIDE 26

Manipulating Files

$ file $ touch $ echo “...” > file.txt $ cat $ more $ less

slide-27
SLIDE 27

Manipulating Files

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

slide-28
SLIDE 28

Searching for Files

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

slide-29
SLIDE 29

Text Editors

$ nano somenewfile.txt $ vi somenewfile.txt

slide-30
SLIDE 30

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

slide-31
SLIDE 31

Chaining Commands

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

slide-32
SLIDE 32

grep

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

slide-33
SLIDE 33

Piping and Redirection

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

slide-34
SLIDE 34

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

slide-35
SLIDE 35

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

slide-36
SLIDE 36

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

slide-37
SLIDE 37

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

slide-38
SLIDE 38

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

slide-39
SLIDE 39

Users and Permissions

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

slide-40
SLIDE 40

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
slide-41
SLIDE 41

Linux File Permissions

slide-42
SLIDE 42

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

slide-43
SLIDE 43

User File Commands

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

slide-44
SLIDE 44

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"

slide-45
SLIDE 45

Compiling Software

# whatis gcc # type gcc

slide-46
SLIDE 46

Compiling Software

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

slide-47
SLIDE 47

Compiling Software Part Duex

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

slide-48
SLIDE 48

Submitting Jobs to Slurm

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

slide-49
SLIDE 49

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

slide-50
SLIDE 50

Hidden Files

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

slide-51
SLIDE 51

Aliases

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

slide-52
SLIDE 52

.bash_aliases

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

slide-53
SLIDE 53

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)

slide-54
SLIDE 54

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"

slide-55
SLIDE 55

System Administration

  • Process Management (what is running?)
  • Installing Software (package management)
  • User Management
  • Configuring Services
slide-56
SLIDE 56

<<< END;

These Slides: https://bit.ly/2mbcGIY Book:http://linuxcommand.org/tlcl.php @fsurcc FSU Research Computing Center https://rcc.fsu.edu