Using Commands Unix / Linux Preparation Course May 6, 2012 Serrekunda, The Gambia.

Slides:



Advertisements
Similar presentations
Linux commands exercise 1. What do you need, if you try to these at home? You need to download and install Ubuntu Linux from the Internet – DVD is need.
Advertisements

Tony Kombol.  A program that  receives commands from a text input device (e.g. keyboard)  passes them to the operating system to perform  In the.
Learning Unix/Linux Bioinformatics Orientation 2008 Eric Bishop.
Jump to first page Unix Commands Monica Stoica Jump to first page Introduction to Unix n Unix was born in 1969 at Bell Laboratories, a research subdivision.
PacNOG 6: Nadi, Fiji Using Commands in Linux Hervey Allen Network Startup Resource Center.
Using Commands Introduction to Linux June 16, 2009 Papeete, French Polynesia Hervey Allen.
NETW-240 Shells Last Update Copyright Kenneth M. Chipps Ph.D. 1.
1 CSE 390a Lecture 2 Exploring Shell Commands, Streams, and Redirection slides created by Marty Stepp, modified by Josh Goodwin
Linux+ Guide to Linux Certification, Second Edition
Guide To UNIX Using Linux Third Edition
Lecture 02CS311 – Operating Systems 1 1 CS311 – Lecture 02 Outline UNIX/Linux features – Redirection – pipes – Terminating a command – Running program.
Very Quick & Basic Unix Steven Newhouse Unix is user-friendly. It's just very selective about who its friends are.
Key Applications Module Lesson 12 — Word Essentials
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.
L INUX C OMMAND L INE I NTERFACE G UNAANBAN.G
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.
Advanced File Processing
EMT 2390L Lecture 2 Dr. Reyes. Outline What is the Shell Basic commands Linux Filesystem System commands.
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”
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.
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.
Linux environment ● Graphical interface – X-window + window manager ● Text interface – terminal + shell.
Agenda User Profile File (.profile) –Keyword Shell Variables Linux (Unix) filters –Purpose –Commands: grep, sort, awk cut, tr, wc, spell.
BIF703 stdin, stdout, stderr Redirection. stdin, stdout, stderr Recall the Unix philosophy “do one thing well”. Unix has over one thousand commands (utilities)
Unix Tutorial for FreeSurfer Users. Helpful To Know FreeSurfer Tutorial Wiki:
Carnegie Mellon Linux Boot Camp Jenna MacCarley, Peter Pearson, Shashank Goyal 9/19/2015.
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:
Week 3 Exploring Linux Filesystems. Objectives  Understand and navigate the Linux directory structure using relative and absolute pathnames  Describe.
Advanced File Processing. 2 Objectives Use the pipe operator to redirect the output of one command to another command Use the grep command to search for.
Chapter Five Advanced File Processing Guide To UNIX Using Linux Fourth Edition Chapter 5 Unix (34 slides)1 CTEC 110.
Using Commands Unix/IP Preparation Course July 19, 2009 Eugene, Oregon, USA
1 Operating Systems and Using Linux Topics What is an Operating System? Linux Overview Frequently Used Linux Commands Some content in this lecture added.
Agenda Getting Started: Using Unix Unix Structure / Features Elements of the Unix Philosophy Unix Command Structure Command Line Editing Online Unix Command.
BIF713 Basic Unix/Linux Commands Getting Help with Commands.
1 FreeBSD Installation AFNOG X Cairo, Egypt May 2009 Hervey Allen.
Chapter Five Advanced File Processing. 2 Lesson A Selecting, Manipulating, and Formatting Information.
Unix Commands PowerPoint Presentation developed for LS 560 Information Technology online class - University of Alabama by Debey Sklenar TENacious Cohort.
Using Commands Introduction to Unix May 24, 2008 Rabat, Morocco Hervey Allen.
Week 9 - Nov 7, Week 9 Agenda I/O redirection I/O redirection pipe pipe tee tee.
Agenda Basic Unix Commands (Chapters 2 & 3) Miscellaneous Commands: which, passwd, date, ps / kill Working with Files: file, touch, cat, more, less, grep,
Lesson 3-Touring Utilities and System Features. Overview Employing fundamental utilities. Linux terminal sessions. Managing input and output. Using special.
CSE 374 Programming Concepts & Tools Hal Perkins Fall 2015 Lecture 2a – A Unix Command Sampler (Courtesy of David Notkin, CSE 303)
Using the “CLI” Unix / Linux Preparation Course June 9, 2013 Lusaka, Zambia.
Linux Commands C151 Multi-User Operating Systems.
PTA Linux Series Copyright Professional Training Academy, CSIS, University of Limerick, 2006 © Workshop III - Part A Shell Commands Professional Training.
Unix Advanced Shells Chapter 10. Unix Shells u Command Line Interpreter –once logged in, login gives control to a shell –it prompts for input, then parses,
Linux+ Guide to Linux Certification, Second Edition Chapter 4 Exploring Linux Filesystems.
BIF713 Introduction to Linux. Agenda Getting Started: Using Linux Unix and Linux - Structure / Features Elements of the Linux Philosophy Linux Command.
Learning basic Unix command It 325 operating system.
Word 2010 Text Basics In this lesson you'll learn the basics of working with text, including how to insert, delete, select, copy, cut, paste, and replace.
ORAFACT Text Processing. ORAFACT Searching Inside Files grep - searches for patterns within files grep [options] [[-e] pattern] filename [...] -n shows.
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.
Learning Unix/Linux Based on slides from: Eric Bishop.
Key Applications Module Lesson 12 — Word Essentials Computer Literacy BASICS.
Papeete, French Polynesia
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.
Lesson 5-Exploring Utilities
Introduction to Unix May 24, 2008 Rabat, Morocco Hervey Allen
Some Linux Commands.
WELCOME FREESURFER COURSE ATTENDEES!
Guide To UNIX Using Linux Third Edition
Introduction Paul Flynn
UNIX/LINUX Commands Using BASH Copyright © 2017 – Curt Hill.
Linux Shell Script Programming
CSE 303 Concepts and Tools for Software Development
Presentation transcript:

Using Commands Unix / Linux Preparation Course May 6, 2012 Serrekunda, The Gambia

The format of a command command [options] parameters “Traditionally, UNIX command-line options consist of a dash, followed by one or more lowercase letters. The GNU utilities added a double-dash, followed by a complete word or compound word.” Two very typical examples are: -h --help and -v --version

Command parameters The parameter is what a command acts upon. Often there are multiple parameters. In Unix UPPERCASE and lowercase for both options and parameters matter. Spaces ___ are ___ critical ___ “-- help” is wrong. “--help” is right.

Some command examples Let's start simple: Display a list of files: ls Display a list of files in a long listing format: ls -l Display a list of all files in a long listing format with human-readable file sizes: ls -alh

Some command examples cont. Some equivalent ways to do “ ls -alh ”: ls -lah ls -l -a -h ls -l –all --human-readable Note that there is no double-dash option for “ -l ”. You can figure this out by typing: man ls Or by typing: ls --help

Where's the parameter? We typed the “ ls ” command with several options, but no parameter. Do you think “ ls ” uses a parameter? Q.) What is the parameter for “ ls -l ”? A.) It is “.” -- our current directory. “ ls -l ” and “ ls -l. ” are the same. We'll discuss files and directories later.

A disconcerting Unix feature If a command executes successfully there is no output returned from the command execution. this is normal. That is, if you type: cp file1 file2 The result is that you get your command prompt back. Nothing means success. Let's give this a try...

A disconcerting Unix feature cont. Try doing the following on your machine: $ cd [cd = change dir] $ touch file1 [touch = create/update] $ cp file1 file2 [cp = copy] The “$” indicates the command prompt for a normal user. A “#” usually means you are the root user.

Using pipes In Unix it is very easy to use the result of one command as the input for another. To do this we use the pipe symbol “|”. For example: ls -l /sbin | sort ls -l /sbin | sort | more What will these commands do? Give it a try.

Stopping Command Output Stopping commands with continuous output: Terminate foreground program: CTRL+C $ ping yahoo.com PING yahoo.com ( ): 56 data bytes 64 bytes from : icmp_seq=0 ttl=45 time= ms 64 bytes from : icmp_seq=1 ttl=45 time= ms ^C  here press CTRL + C Terminate paging like “less ” $ less /etc/passwd sysadm:x:1000:1000:System Administrator,,,:/home/sysadm:/bin/bash postfix:x:104:113::/var/spool/postfix:/bin/false mysql:x:105:115:MySQL Server,,,:/var/lib/mysql:/bin/false (END)  press the “q” key

Proper command line use The command line in Unix is much more powerful than what you may be used to in Windows. You can......easily edit long commands...find and recover past commands...quickly copy and paste commands....auto-complete commands using the tab key (in bash shell).

Edit long commands ! Don't touch that keyboard! Arrow keys are sloooooow... Use Home and End instead (ctrl-a, shift-a) Delete with Backspace not Delete. Press as soon as the command is correct. You do not need to go to the end of the command. Use “ history | grep string ”, then !NN instead of lots of up-arrows.

Find and recover past commands As noted on the previous slide. Use: $ history | grep “command string” Find command number in resulting list. Execute the command by typing: $ !number So, to find any command you typed “many” commands ago you can do: $ history | grep command

Quickly copy and paste commands In Unix/Linux once you highlight something it is already in your copy buffer. To copy/paste do: Highlight text with left mouse cursor. It is now copied (like ctrl-c in Windows). Move mouse/cursor where you want (any window), and press the middle mouse button. This is paste (like ctrl-v). Doesn’t work on a Mac…

Copy and paste commands Do this!!! Good system administrator == Lazy Person Goal State Don’t try to type a long command if you can copy / paste it instead.

Auto-complete commands using tab Very, very, very powerful “The tab key is good”, “the tab key is my friend”, “press the tab key”, “press it again” - This is your mantra. Tab works in the bash shell. Note, the root user might not use the bash shell by default. Use the tab key! You’ll thank us later

Auto-complete commands using tab Core concept: Once you type something unique, press TAB. If nothing happens, press TAB twice. -If text was unique text will auto-complete. A command will complete, directory name, file name, command parameters will all complete. -If not unique, press TAB twice. All possibilities will be displayed. -Works with file types based on command!

Viewing files Several ways to view a file: 1. cat 2. more <filename 3. less cat is short for conCATenate “less is more”

Obtaining help To get help explaining commands you can do:  man  --help man stands for “man”ual. More on “man”  man man More on Linux directory structure:  man hier

Your mission Should you choose to accept it... Pay close attention to options and parameters. Use “ man command ” or “ command --help ” to figure out how each command works. Use command line magic to save lots and lots and lots and lots of time. A command acts upon its parameters based on the options you give to the command...