Introduction to the Linux Command Line Interface Research Computing Systems Bob Torgerson July 19, 2016.

Slides:



Advertisements
Similar presentations
Learning Unix/Linux Bioinformatics Orientation 2008 Eric Bishop.
Advertisements

1 Introduction to UNIX Ke Liu
Introduction to UNIX A User’s Perspective: Day 2 – Command Basics.
“Linux at the Command Line” Don Johnson of BU IS&T.
1 UNIX essentials (hands-on) the directory tree running programs the shell (using the T-shell) → command line processing → special characters → command.
Introduction to Linux and Shell Scripting Jacob Chan.
Linux Commands LINUX COMMANDS.
CS 141 Labs are mandatory. Attendance will be taken in each lab. Make account on moodle. Projects will be submitted via moodle.
Introduction to Linux Workshop February Introduction Rob Lane & The HPC Support Team Research Computing Services CUIT.
Overview of Linux CS3530 Spring 2014 Dr. José M. Garrido Department of Computer Science.
UNIX command line. In this module you will learn: What is the computer shell What is the command line interface (or Terminal) What is the filesystem tree.
Linux environment ● Graphical interface – X-window + window manager ● Text interface – terminal + shell.
Lesson 1. PC vs. Multi-user System  Personal Computer – each user gets his/her own processor (or multicore processor).  Multi-user system – The processor,
Introduction to UNIX Don Bahls user consultant (907)
Essential Unix at ACEnet Joey Bernard, Computational Research Consultant.
Introduction to Computer Organization & Systems Topics: Intro to UNIX COMP John Barr.
CS 2061 Shells Also known as: Unix Command Interpreter.
UNIX command line. In this module you will learn: What is the computer shell What is the command line interface What is the directory tree Some UNIX commands.
CS 6560 Operating System Design Lecture 3:Tour of GNU/Linux.
PROGRAMMING PROJECT POLICIES AND UNIX INTRO Sal LaMarca CSCI 1302, Fall 2009.
1 UNIX essentials (hands-on) the directory tree running programs the shell → command line processing → special characters → command types → shell variables.
Session 2 Wharton Summer Tech Camp Basic Unix. Agenda Cover basic UNIX commands and useful functions.
1 Operating Systems and Using Linux Topics What is an Operating System? Linux Overview Frequently Used Linux Commands Some content in this lecture added.
Unix/Linux cs3353. The Shell The shell is a program that acts as the interface between the user and the kernel. –The shell is fully programmable and will.
Introduction to Programming Using C An Introduction to Operating Systems.
Lesson 3-Touring Utilities and System Features. Overview Employing fundamental utilities. Linux terminal sessions. Managing input and output. Using special.
Linux Commands C151 Multi-User Operating Systems.
Linux A practical introduction. 1)Background and Getting Started Linux is an operating system with multiple providers Red Hat/CentOS (our version) Ubuntu.
1 CS3695 – Network Vulnerability Assessment & Risk Mitigation – Introduction to Unix & Linux.
Lecture 1: Introduction, Basic UNIX Advanced Programming Techniques.
CS 120 Extra: The CS1 Server Tarik Booker CS 120.
Learning Unix/Linux Based on slides from: Eric Bishop.
INTRODUCTION TO SHELL SCRIPTING By Byamukama Frank
Bash Scripting CIRC Summer School 2016 Baowei Liu CIRC Summer School 2016 Baowei Liu.
UNIX Basics Matt Hayward October 18, 2016 LS560 – Information Technology for information professionals.
Overview of Linux Fall 2016 Dr. Donghyun Kim
Introduction to Unix for FreeSurfer Users
GRID COMPUTING.
Tutorial of Unix Command & shell scriptS 5027
CIRC Winter Boot Camp 2017 Baowei Liu
slides created by Marty Stepp, modified by Josh Goodwin
Web Programming Essentials:
Shell Features CSCI N321 – System and Network Administration
Bash Introduction (adapted from chapters 1 and 2 of bash Cookbook by Albing, Vossing, & Newham) CPTE 440 John Beckett.
Linux Commands Help HANDS ON TRAINING Author: Muhammad Laique
Andy Wang Object Oriented Programming in C++ COP 3330
Some Linux Commands.
C151 Multi-User Operating Systems
Introduction to Linux Dr Karina Kubiak - Ossowska
Part 3 – Remote Connection, File Transfer, Remote Environments
The Linux Operating System
Shell Script Assignment 1.
CSE 303 Concepts and Tools for Software Development
Tutorial of Unix Command & shell scriptS 5027
Basic UNIX OLC Training.
UNIX Introduction Peter Wad Sackett.
Introduction to UNIX.
Tutorial of Unix Commands
Tutorial of Unix Command & shell scriptS 5027
slides created by Marty Stepp, modified by Jessica Miller
Web Programming Essentials:
Tutorial of Unix Command & shell scriptS 5027
Andy Wang Object Oriented Programming in C++ COP 3330
UNIX Introduction Peter Wad Sackett.
Linux Shell Script Programming
CSE 303 Concepts and Tools for Software Development
CSE 390a Lecture 3 bash shell continued: processes; multi-user systems; remote login; editors slides created by Marty Stepp, modified by Jessica Miller.
Linux Commands LINUX COMMANDS.
LPI Linux Certification
Presentation transcript:

Introduction to the Linux Command Line Interface Research Computing Systems Bob Torgerson July 19, 2016

Overview Connecting to Remote Systems Working with Files File and Directory Permissions Working with Active Processes Customizing the User Environment Submitting a Job

Linux Overview Unix-like OS developed by Linus Torvalds in 1991 Open Source Software “Runs on more computer hardware platforms than any other OS” (wikipedia.org) Runs on supercomputers, high performance clusters, servers, workstations, & embedded systems The shell is a command line interface to the OS o Open a “terminal” window o Edit files o Launch processes or jobs o Check the status of running processes o Send signals to processes o Common shells: bash, ksh, tcsh, csh

Connecting to Remote Systems RCS supports ssh, sftp and scp clients Linux and MacOS come with versions of ssh, sftp and scp. Windows requires downloading a terminal and file transfer program (and optionally an X11 server). RCS has the most experience supporting PuTTY, FileZilla, and Xming. Login with: o ssh –X –Y o Example: ssh –X –Y Copy files with: o scp myfiles.tar.gz o Example: scp myfiles.tar.gz Set up ssh keys, see “ news pubkeys ”

Navigating the File System Linux is a collection of files and directories (think of folders) The top directory is called the “root”. Some directories contain actual files, others provide access to hardware devices Common Commands: pwd cd ls ls –al ls $HOME mkdir rm filename rmdir rm –rf directoryName

Working with Files Common Linux Text Editors o VIM including gvim o Emacs o nedit or gedit (X11 enabled only) Quickly view the contents of a file with: o cat o less (exit with “q”) Documentation for shell commands: o Man pages – man cmd o Info documents – info cmd View images with the “ display ” command

File and Directory Permissions Permissions control access to files and directories Three categories of access: o user (that’s your account) o group (type ` groups ` to determine which you belong to) o other (everybody else on the system) Three categories of permissions: o read o write o execute Use ` chmod ` to modify access permissions o chmod u+r myDir (add read permissions for myself) o chmod g+rx myFile (add group read & execute permissions) o chmod go-rwx myFile (remove group and other permissions)

File and Directory Permissions Security Awareness: o World write permissions are discouraged. o Never share your login credentials (username & password) with others. o What else?

Working with Active Processes `ps` allows you to view process statuses o Useful variations `ps –elf` and `ps –aux` `top` to view what’s eating up all the CPU resources! o exit with “q” Send a signal: o CTRL+c (kill) o CTRL+z (suspend) Search with `grep`, then `sort`

Working with Active Processes Try it! $ sleep 1000 $ ctrl-z $ ps $ fg $ ctrl-c $ sleep 1000 & $ ps $ fg

Working with Active Processes Try it! # create a new file called sleepyTime.sh containing: #!/bin/bash echo “hello there. I’m tired...” sleep 1005 exit $ chmod u+x sleepyTime.sh $./sleepyTime.sh

Working with Active Processes The `kill` command is used to terminate processes. `man kill` Send particular signals, e.g. `kill –KILL 3039` Try it! o $ sleep 2000 & o $ ps o $ kill o $ ps

Customizing the User Environment Environment Variables store short strings of information Important variables: $PATH, $HOME, $CENTER The shell auto-expands variables Set with bash: export CHUBBY_BUNNIES=funny bash: export PATH=${PATH}:/u1/uaf/torgerso/bin csh/tcsh: setenv CHUBBY_BUNNIES funny csh/tcsh: setenv PATH ${PATH}:/u1/uaf/torgerso/bin View with echo $CHUBBY_BUNNIES

Customizing the User Environment Customize your login by modifying your $HOME “.” files Example for bash users: Add the following to your ~/.profile file: export PS1=“Good Morning!% ” Then source the file with “. ~/.profile”

File Input/Output & Redirection Three forms of input/output: o “stdin” from keyboard or a file o “stdout” to screen or a file o “stderr” to screen or a file Redirect I/O with o Greater/Less Than Symbols, “>” or “>>” or “<“ o Pipes, “|” Tie stdout and stderr together with “2>&1” o In bash: mpirun $CENTER/wrf.exe > wrf.mix.out 2>&1 &!

Special Shell Characters “?” matches a single character “*” matches anything “&” backgrounds a running process o View the process status with `ps` or `jobs` o Bring process back to foreground with `fg` “\” is the shell escape to not interpret white space or special characters Treating a string of characters literally requires using single forward quotes before and after the string. Treating a string of characters as a string after interpreting any embedded variables requires using double forward quotes before and after the string.

Submitting a Job This assumes using torque/moab (on pacman or fish). 1 st create a job submission script named “myjob.pbs”, for example – Submit a batch job: `qsub myjob.pbs` Submit a job to a specific queue with a reservation: `qsub –q standard_16 –W ADVRES: myjob.pbs` Submit an interactive job: `qsub –I –l nodes=1:ppn=16 –q standard_16`

Additional Resources guide-for-beginners/ guide-for-beginners/

Questions, Comments? 508/511 Elvey Building