Introduction to Linux ( II ) Sidney Fong 11 th Feb 2006.

Slides:



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

PacNOG 6: Nadi, Fiji Using Commands in Linux Hervey Allen Network Startup Resource Center.
NETW-240 Shells Last Update Copyright Kenneth M. Chipps Ph.D. 1.
Introduction to Linux Alan Orth April 17, 2010 ILRI, Nairobi.
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.
Linux+ Guide to Linux Certification, Second Edition
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.
“Linux at the Command Line” Don Johnson of BU IS&T.
1 SEEM3460 Tutorial Unix Introduction. 2 Introduction What is Unix? An operation system (OS), similar to Windows, MacOS X Why learn Unix? Greatest Software.
7/17/2009 rwjBROOKDALE COMMUNITY COLLEGE1 Unix Comp-145 C HAPTER 2.
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.
Using the “CLI” Unix / Linux Preparation Course May 25 Djibouti.
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”
Linux environment ● Graphical interface – X-window + window manager ● Text interface – terminal + shell.
Introduction to *nix Systems HKOI Training Team Sidney Fong.
Agenda User Profile File (.profile) –Keyword Shell Variables Linux (Unix) filters –Purpose –Commands: grep, sort, awk cut, tr, wc, spell.
Unix Basics Chapter 4.
CENT 305 Information Systems Security Linux Introduction.
Dedan Githae, BecA-ILRI Hub Introduction to Linux / UNIX OS MARI eBioKit Workshop; Nov , 2014.
1 SEEM3460 Tutorial Unix Introduction. 2 Introduction Unix-like system is everywhere Linux Android for smartphones Google Chrome OS for Chromebook Web.
Introduction to Unix – CS 21 Lecture 9. Lecture Overview Shell description Shell choices History Aliases Topic review.
Operating System - Linux Ph. D. Course Work : PHYS 601 Statistics and Computer Applications Presented By: Sanjay Godara Dept. of Physics & Astrophysics.
Introduction to Linux ( I ) Sidney Fong 4 th Feb 2006.
Isecur1ty training center Presented by : Eng. Mohammad Khreesha.
UNIX and Shell Programming (06CS36) Unit 1 Continued… Shrinivas R. Mangalwede Department of Computer Science and Engineering K.L.S. Gogte Institute of.
HKOI 2012 TRAINING INTRO TO LINUX /CUHK/SHB123]$ date Sat Feb 18 13:00:00 HKT 2012.
CS240 Computer Science II Introduction the Unix File System and File Related Utilities Based on “UNIX for Programmers and Users” by G.Class and K. Ables.
System Administration Introduction to Unix Session 2 – Fri 02 Nov 2007 Reference:  chapter 1, The Unix Programming Environment, Kernighan & Pike, ISBN.
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.
UNIX Commands. Why UNIX Commands Are Noninteractive Command may take input from the output of another command (filters). May be scheduled to run at specific.
Agenda Link of the week Use of Virtual Machine Review week one lab assignment This week’s expected outcomes Review next lab assignments Break Out Problems.
1 Operating Systems and Using Linux Topics What is an Operating System? Linux Overview Frequently Used Linux Commands Some content in this lecture added.
Getting started: Basics Outline: I.Connecting to cluster: ssh II.Connecting outside UCF firewall: VPN client III.Introduction to Linux IV.Intoduction to.
Lesson 2-Touring Essential Programs. Overview Development of UNIX and Linux. Commands to execute utilities. Communicating instructions to the shell. Navigating.
Week Two Agenda Announcements Link of the week Use of Virtual Machine Review week one lab assignment This week’s expected outcomes Next lab assignments.
Week Two Agenda Announcements Link of the week Use of Virtual Machine Review week one lab assignment This week’s expected outcomes Next lab assignments.
Week Two Agenda Announcements Link of the week Use of Virtual Machine Review week one lab assignment This week’s expected outcomes Next lab assignments.
CS2204: Introduction to Unix January 19 th, 2004 Class Meeting 1 * Notes adapted by Christian Allgood from previous work by other members of the CS faculty.
Unix/Linux for beginners:
Basic of UNIX For fresh members of SPARCS
Week Two Agenda Announcements Link of the week Use of Virtual Machine Review week one lab assignment This week’s expected outcomes Next lab assignments.
CSE 374 Programming Concepts & Tools Hal Perkins Fall 2015 Lecture 2a – A Unix Command Sampler (Courtesy of David Notkin, CSE 303)
Linux Commands C151 Multi-User Operating Systems.
CS 245 – Part 1 Using Operating Systems and Networks for Programmers Jiang Guo Dept. of Computer Science California State University Los Angeles.
Introduction to UNIX CS 2204 Class meeting 1 *Notes by Doug Bowman and other members of the CS faculty at Virginia Tech. Copyright
Linux+ Guide to Linux Certification, Second Edition Chapter 4 Exploring Linux Filesystems.
A Brief Overview of Unix Brandon Bohrer. Topics What is Unix? – Quick introduction Documentation – Where to get it, how to use it Text Editors – Know.
Operating Systems and Using Linux Courtesy of John Y. Park 1.
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.
Week Two Agenda Announcements Link of the week Use of Virtual Machine Review week one lab assignment This week’s expected outcomes Next lab assignments.
Learning Unix/Linux Based on slides from: Eric Bishop.
Intro to GNU/Linux See, Stallman? I said GNU. Are you happy now?
INTRODUCTION TO SHELL SCRIPTING By Byamukama Frank
By Jonathan Rinfret UNIX/LINUX By Jonathan Rinfret
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.
Getting started with CentOS Linux
Linux Commands Help HANDS ON TRAINING Author: Muhammad Laique
Unix Shells.
Some Linux Commands.
The Linux Operating System
CSE 374 Programming Concepts & Tools
Basic UNIX OLC Training.
Getting started with CentOS Linux
Linux Shell Script Programming
Command line.
Yung-Hsiang Lu Purdue University
CSE 303 Concepts and Tools for Software Development
Presentation transcript:

Introduction to Linux ( II ) Sidney Fong 11 th Feb 2006

Rough Outline  Prerequisites:  Knowledge of basic Computer / Operating System concepts  Preferably some previous experience of Linux  Training is divided into Two Parts:  Part I - Introduction of the background of Linux  Part II – Quick review of basic Linux commands  Part III – Vim  Part IV – Some miscellaneous topics (if time allows)

Introduction to Linux ( II ) Part I – Some Background of Linux

What is “Linux”?  Operating system?  … What is an operating system?  Wikipedia: “the system software responsible for the direct control and management of hardware and basic system operations”.  The kernel?  The basic interface (eg. command line, graphical interface)?  The commands? The tools?  Text editors? Compilers?  Web Browser?  … Everything?

Operating System (cont’d)  In general, there is one narrow usage and a broader usage  Narrow usage: Only the parts that deal directly with the hardware, and very low level features (i.e. the kernel)  Broader usage: Also includes system software. What is “system software” depends on the nature of the system.b

Graphical Illustration User space programs Shell Kernel Hardware X Client Daemons X Server

What is Linux?  There are also two usages of the term “Linux”, corresponding roughly to the narrow/broad usage of the term “Operating System”.  The narrow definition: simply the kernel  The broader definition: includes basically everything available in the system

A Typical Linux System  Linux Kernel  User space programs (many are GNU software)  Shell (command line): bash  Utilities: ls, cp, mv, rm, cat, grep,...  Compiler: gcc  … and more …  X Window System (for desktops/workstations)  Various daemons (a.k.a. services)  Eg.: syslogd, httpd, cron, inetd

A bit of History  Richard Stallman founded the GNU project in the 1980’s  Linus Torvalds began writing a kernel in the early 1990’s  => GNU/Linux, commonly referred to as “Linux”.  (For more details, see for yourself on the web)

Open Source / Free  Open Source – Source code is available to everybody  “Free” – Source code is available to everybody, and everybody can re- distribute the source code  “Copyleft” – Source code is available to everybody, and if you want to distribute the program, you must also distribute the source code.

Linux Distributions  Once upon a time, there were softwares  The softwares were scattered in different sites, and they were distributed by source code  If people wanted to use them, they have to download them from different sites, compile them, and install them  See how many packages you have in your system! (dpkg -l)  Also, consider the difficulty of installing software onto a new computer (with no operating system pre-installed)  Conclusion: Installation of software is a very complicated process.  (Refer to the LFS “Distribution” if you want to get a feel of this)

Linux Distributions (cont’d)  In the beginning, people did those complicated and tedious work themselves.  Later, some of them released their work of collecting the software to the public. These are called “distributions”.  Typically, a modern distribution handles the following:  Installation of the OS  Software Packaging (compiled software instead of source)  Install / Upgrade / Removing packages  Sensible default configurations  You may have heard of these names:  Redhat / Fedora  Mandrake  Debian  Slackware  Gentoo

Introduction to Linux ( II ) Part II – Basic Linux Commands (Quick Review)

Login Screen “Message of the day” Usually contains important notices Username Hostname Current directory Hint: You may press to for multiple terminals if you are using Linux on the local machine (instead of over network) Why is the username and hostname displayed in the command prompt?

Getting Help  man pages Purpose of command Different usages Detailed description of command and its options Hint: Press ‘q’ to quit

More on Man Pages  There are different sections of man pages  Section 1: commands  Section 2: system calls  Section 3: C library calls  Section 4: special files (in /dev)  Section 5: (config) file formats  Section 6: “games”  Section 7: Misc  Section 8: System administration commands  If there are conflicts in names, the section of lower value is displayed. For a specific section:  man  man  Note that you may find section 3 very useful as a reference to standard C functions (eg. printf, fopen, string functions, etc)

The Basics  File system:  cd, ls, rm, cp, mv, mkdir, rmdir  Piping  cat input.txt |./program1 | diff - answer1.txt  IO Redirection  sort –n > sorted.txt sorted.txt < numbers.txt  ls >> logs.txt  Process management  ps, kill

Useful Commands in Competitions  bc – Arbitrary precision calculator  sort – Sort lines of text files (note the “-n” option)  ps – list running processes on the machine  kill – Sends a signal to running programs (terminates it by default)  date – Print system date/time  time – reports execution time of a command  diff – compares files  head, tail – prints the first/last N lines of the input  wc – word count (also counts characters and lines)  more – pager (allows you to scroll the input for easy viewing)  less – better version of more  grep – print lines matching a pattern  find – search for files  factor – factorize numbers  tsort – perform topological sort  seq – print a sequence of numbers  file – determine file type (sometimes displays other useful information)  tar – Archive files (“glue” multiple files into one, and vice versa)

Some shell scripting  For loop:  for ((i=0;i<10;i++)); do echo $i; done  If statement:  if [ $ME = “dizzy” ]; then echo “I am $RANDOM years old” fi  While loop:  A=1 while [ $A -ne 0 ]; do read A echo $A | factor done  Note that spacing may be significant!!

Introduction to Linux ( II ) Part III – Vim

Starting Vim  Type “vim” in shell. (some systems equate vi with vim, but not always)  Screenshot of an empty vim session

Quit  Even if you don’t want to learn vi(m), you have to know how to quit:  :q!  :q!  By the way, the way to exit Emacs:  Ctrl+X Ctrl+C

Using Vim as “notepad”  Once started, press “i” to enter insert mode.  Use like notepad.  To save/quit, and :w / :q  Note: set nocp, set bs=2

Different modes  Vi has two (three?) different modes:  Insert mode – in which you type the text  Command mode – in which you issue commands to the editor  (ex mode) – more complex commands  Vim starts in command mode by default  Various commands to enter insert mode  Esc to exit from insert mode back to command mode  During command mode, the “:” character indicates an ex command. For example, ‘:q!’ is an ex command.

Basic movements  Vim is fast when it comes to movement (of cursor). One of the reasons is that you do not have to move your hand to the arrow keys to move. (Almost) Everything can be done by [a-zA-Z0-9]  h,j,k,l : left, down, up, right  If you want to learn vi, you must learn these.

Vim commands  (Refer to command list)

vimrc  vimrc – start up commands (in ex) for Vim  Utilize it to personalize your settings. But remember not to be over reliant on these because you may not have the time to set up a vimrc in competition environments (except simple ones)  Simple Example:  set nocp#do not use old vi behavior set bs=2# sane backspace setting (see :help bs) set ruler# “status bar” set ai# auto indent  Combine with :map command for easy compile/run keys