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

Slides:



Advertisements
Similar presentations
“Linux at the Command Line” Don Johnson of BU IS&T
Advertisements

Learning Unix/Linux Bioinformatics Orientation 2008 Eric Bishop.
Chapter One The Essence of UNIX.
PacNOG 6: Nadi, Fiji Using Commands in Linux Hervey Allen Network Startup Resource Center.
Cosc 4750 Getting Started in UNIX Don’t be afraid of the prompt, in linux it can be your best friend. In some cases, the only way to do certain things.
Introducing the Command Line CMSC 121 Introduction to UNIX Much of the material in these slides was taken from Dan Hood’s CMSC 121 Lecture Notes.
Lecture 01CS311 – Operating Systems 1 1 CS311 – Lecture 01 Outline Course introduction Setting up your system Logging onto the servers at OSU with ssh.
Very Quick & Basic Unix Steven Newhouse Unix is user-friendly. It's just very selective about who its friends are.
1 Some basic Unix commands u Understand the concept of loggin into and out of a Unix shell u Interact with the system in a basic way through keyboard and.
1 SEEM3460 Tutorial Unix Introduction. 2 Introduction What is Unix? An operation system (OS), similar to Windows, MacOS X Why learn Unix? Greatest Software.
Linux Shell. 2 Linux Command-Line Interface ■ Linux shells: A shell is a command interpreter that allows you to type commands from the keyboard to interact.
CS 141 Labs are mandatory. Attendance will be taken in each lab. Make account on moodle. Projects will be submitted via moodle.
Using Macs and Unix Nancy Griffeth January 6, 2014 Funding for this workshop was provided by the program “Computational Modeling and Analysis of Complex.
Introduction to Linux Workshop February Introduction Rob Lane & The HPC Support Team Research Computing Services CUIT.
Using the “CLI” Unix / Linux Preparation Course May 25 Djibouti.
Overview of Linux CS3530 Spring 2014 Dr. José M. Garrido Department of Computer Science.
Unix Primer. Unix Shell The shell is a command programming language that provides an interface to the UNIX operating system. The shell is a “regular”
Chapter 9 Part II Linux Command Line Access to Linux Authenticated login using a Linux account is required to access a Linux system. The Linux prompt will.
Essential Unix at ACEnet Joey Bernard, Computational Research Consultant.
1 SEEM3460 Tutorial Unix Introduction. 2 Introduction Unix-like system is everywhere Linux Android for smartphones Google Chrome OS for Chromebook Web.
Unix Tutorial for FreeSurfer Users. Helpful To Know FreeSurfer Tutorial Wiki:
PROGRAMMING PROJECT POLICIES AND UNIX INTRO Sal LaMarca CSCI 1302, Fall 2009.
System Administration Introduction to Unix Session 2 – Fri 02 Nov 2007 Reference:  chapter 1, The Unix Programming Environment, Kernighan & Pike, ISBN.
Unix Tutorial for FreeSurfer Users. Helpful To Know FreeSurfer Tutorial Wiki:
Session 2 Wharton Summer Tech Camp Basic Unix. Agenda Cover basic UNIX commands and useful functions.
INTRODUCTION TO LINUX Jacob Chan. GNU/Linux Consists of Linux kernel, GNU utilities, and open source and commercial applications Works like Unix –Multi-user.
Chapter 0 A “Quick-Start” into the UNIX Operating System.
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.
Lesson 2-Touring Essential Programs. Overview Development of UNIX and Linux. Commands to execute utilities. Communicating instructions to the shell. Navigating.
Using Commands Unix / Linux Preparation Course May 6, 2012 Serrekunda, The Gambia.
Introduction to UNIX Road Map: 1. UNIX Structure 2. Components of UNIX 3. Process Structure 4. Shell & Utility Programs 5. Using Files & Directories 6.
November 5, 2015CIS 118 Intro to UNIX What’s a Unix? Unix is an Operating System Designed for high-traffic usage Many variants –Linux, BSD: free versions.
Unix and Samba By: IC Labs (Raj Kidambi). What is Unix?  Unix stands for UNiplexed Information and Computing System. (It was originally spelled "Unics.")
Introduction to Programming Using C An Introduction to Operating Systems.
CSE 374 Programming Concepts & Tools Hal Perkins Fall 2015 Lecture 2a – A Unix Command Sampler (Courtesy of David Notkin, CSE 303)
CS 245 – Part 1 Using Operating Systems and Networks for Programmers Jiang Guo Dept. of Computer Science California State University Los Angeles.
Isecur1ty training center Presented by : Eng. Mohammad Khreesha.
1 Introduction to Unix. 2 What is UNIX?  UNIX is an Operating System (OS).  An operating system is a control program that helps the user communicate.
 Last lesson, the Windows Operating System was discussed along with the Windows command shell  Unix is a computer operating system, that similarly manages.
1 CS3695 – Network Vulnerability Assessment & Risk Mitigation – Introduction to Unix & Linux.
Lecture 1: Introduction, Basic UNIX Advanced Programming Techniques.
Linux Tutorial Lesson Two *Getting Help in Linux *Data movement and manipulation *Relative and Absolute path *Processes Note: see chapter 1,2,3 from Linux.
CS 120 Extra: The CS1 Server Tarik Booker CS 120.
Learning Unix/Linux Based on slides from: Eric Bishop.
Using UNIX Charles Duan FAS Computer Services June 12, 2016.
Intro to GNU/Linux See, Stallman? I said GNU. Are you happy now?
INTRODUCTION TO SHELL SCRIPTING By Byamukama Frank
Introduction to the Linux Command Line Interface Research Computing Systems Bob Torgerson July 19, 2016.
Overview of Linux Fall 2016 Dr. Donghyun Kim
UNIX To do work for the class, you will be using the Unix operating system. Once connected to the system, you will be presented with a login screen. Once.
“Linux at the Command Line
Tutorial of Unix Command & shell scriptS 5027
Commands Basic syntax of shell commands UNIX or shell commands have a basic structure command -options target command comes first (such as cd or ls) any.
Linux Commands Help HANDS ON TRAINING Author: Muhammad Laique
Andy Wang Object Oriented Programming in C++ COP 3330
Some Linux Commands.
Introduction to Linux Dr Karina Kubiak - Ossowska
Assignment Preliminaries
CSE 374 Programming Concepts & Tools
Tutorial of Unix Command & shell scriptS 5027
Introduction to UNIX.
Tutorial of Unix Command & shell scriptS 5027
Introduction to Linux Week 0 - Thursday.
Web Programming Essentials:
Tutorial of Unix Command & shell scriptS 5027
Shells, Help, and Paths.
Andy Wang Object Oriented Programming in C++ COP 3330
UNIX/LINUX Commands Using BASH Copyright © 2017 – Curt Hill.
Command line.
Module 6 Working with Files and Directories
Presentation transcript:

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

 We’ll start with a sign in sheet that include questions about your Linux experience and goals.  We’ll end with a class evaluation.  We’ll cover as much as we can in the time allowed; if we don’t cover everything, you’ll pick it up as you continue working with Linux.  This is a hands-on, lab class; ask questions at any time.  Commands for you to type are in BOLD

The Most Common O/S Used By BU Researchers When Working on a Server or Computer Cluster

 Linux is a Unix clone begun in 1991 and written from scratch by Linus Torvalds with assistance from a loosely-knit team of hackers across the Net.  64% of the world’s servers run some variant of Unix or Linux. The Android phone and the Kindle run Linux.

 Linux is an O/S core written by Linus Torvalds and others AND  a set of small programs written by Richard Stallman and others. They are the GNU utilities.

 Network: ssh, scp  Shells: BASH, TCSH, clear, history, chsh, echo, set, setenv, xargs  System Information: w, whoami, man, info, which, free, echo, date, cal, df, free  Command Information: man, info  Symbols: |, >, >>, <, ;, ~,.,..  Filters: grep, egrep, more, less, head, tail  Hotkeys:,  File System: ls, mkdir, cd, pwd, mv, touch, file, find, diff, cmp, du, chmod, find  File Editors: gedit, nedit

 You need a “xterm” emulation – software that emulates an “X” terminal and that connects using the “SSH” Secure Shell protocol. ◦ Windows  Use StarNet “X-Win32:” licensed-software/xwindows/xwin32/ licensed-software/xwindows/xwin32/ Connecting to a Linux Host – Windows Client Software

◦ Mac OS X  “Terminal” is already installed  Why? Darwin, the system on which Apple's Mac OS X is built, is a derivative of 4.4BSD-Lite2 and FreeBSD. In other words, the Mac is a Unix system! Connecting to a Linux Host – Mac OS X Client Software

The Ideal Lab Facility Your Instructor Today

 X-Win32/X-Config ◦ Wizard  Name: katana  Type: ssh  Host: katana.bu.edu (Off-campus, must include domain “bu.edu” )  Login:  Password:  Command: Linux ◦ Click “katana” then “Launch”  Accept the host server public key (first time only)

 Terminal ◦ Type ssh –X katana.bu.edu or ssh –Y katana.bu.edu (less secure)

 From the lab computer ◦ Using File Explorer, copy the directory “\\scv- files.bu.edu\SCV\Training\Introduction to Linux” to “My Documents” on your lab machine  Linux ◦ Connect to katana.bu.edu using X-Win32 and run this command:  cp -Rv /project/ssrcsupp/linux_class ~/  From a browser, download:

 A shell is a computer program that interprets the commands you type and sends them to the operating system. Secondly, it provide a programming environment consisting of environment variables.  Most BU systems, including the BU Linux Cluster, support at least two shells: TCSH and BASH. The default shell for your account is TCSH. The most popular and powerful Linux shell today is BASH.  To determine your shell type: ◦ echo $SHELL (shell prints contents of env ◦ echo “$SHELL” (shell still processes env. variable) ◦ echo ‘$SHELL’ (shell treats env. variable as simple literal)  The complete environment can be printed with set, setenv (TCSH) and set (BASH).  To determine the path to the shell program, type: ◦ which bash ◦ which tcsh  Change the shell with “chsh /bin/bash” (provide path to new shell as a “parameter,” meaning to be explained soon)

Output of the echo, which and chsh commands The Shell

 After you connect, type ◦ shazam ◦ whoami ◦ hostname ◦ date ◦ cal ◦ free  Commands have three parts; command, options and parameters. Example: cal –j “cal” is the command, “-j” is an option (or switch), “3” and “1999” are parameters.  Options have long and short forms. Example: ◦ date –u ◦ data --universal What is the nature of the prompt? What was the system’s response to the command?

Output of the whoami, hostname, date, cal and free System Information

 Try the history command  Try (only works in BASH shell)  Choose from the command history by using the up ↑ and down ↓ arrows  What do the left ← and right → arrow do on the command line?  Try the and keys

 Type ◦ hostname –-help ◦ man hostname ◦ info hostname (gives the same or most information, but must be paged)  And “Yes,” you can always Google it

 The pipe “|” feeds the OUTPUT of one command into the INPUT of another command. Our first example will use the pipe symbol to filter the output of a command. Try: ◦ w ◦ w | grep ‘root’ ◦ ps -e -o ruser,comm | grep 'tut‘  The ps command is using both “options (dash)” and parameters  Try both “man grep” and “info grep”. See the difference?

 The structure resembles an upside down tree  Directories are collections of files and other directories.  Every directory has a parent except for the root directory.  Many directories have children directories.  Unlike Windows, with multiple drives and multiple file systems, a *Nix system only has ONE file system.

A Typical Linux File System The Linux File System

 Try ◦ tree –L 3 –d / | less ◦ tree –L 3 / | less ◦ file /bin/alsac then press ◦ cd ~; pwd (This is your home directory where application settings are kept and where you have write privileges) ◦ ls ◦ mkdir myPics;mkdir myPics/work;mkdir myPics/friends;mkdir myPics/friends/BU; mkdir myPics/friends/MIT ◦ tree myPics

Output from the tree, file, pwd and ls commands Demonstration of using the mkdir command Examining the File System

 There are two types of pathnames ◦ Absolute (Abs) – the full path to a directory or file; begins with the root symbol / ◦ Relative (Rel) – a partial path that is relative to the current working directory  Examples ◦ Abs cd /usr/local/lib ◦ echo $HOME (one of may environment variables maintained by the shell) ◦ Abs cd `echo $HOME` ◦ pwd ◦ Rel cd.. ◦ Abs cd /lib (location OS shared libraries) ◦ ls –d */ (a listing of only the directories in /lib)

Moving around the file system using the cd command Navigating the File System

 More useful commands ◦ cd (also takes you to your home directory like cd ~) ◦ mkdir test ◦ echo ‘Hello everyone’ > test/myfile.txt ◦ echo ‘Goodbye all’ >> test/myfile.txt ◦ less test/myfile.txt ◦ mkdir test/subdir1/subdir2 (FAILS) ◦ mkdir -p test/subdir1/subdir2 (Succeeds) ◦ mv test/myfile.txt test/subdir1/subdir2 ◦ rmdir test (FAILS) ◦ rm –Rv test (Succeeds)

Demonstration of the mkdir, less, mv, rmdir and rm commands Modifying the Linux File System

 Useful options for the “ls” command: ◦ ls -a List all file including hidden file beginning with a period “.” ◦ ls -ld * List details about a directory and not its contents ◦ ls -F Put an indicator character at the end of each name ◦ ls –l Simple long listing ◦ ls –lh Give human readable file sizes ◦ ls –lS Sort files by file size ◦ ls –lt Sort files by modification time

 Emacs  Vim  Nedit  Gedit  Emacs and Vim are powerful editors used by most programmers. Nedit and Gedit and easy to learn editors useful for new users on a Linux system.