Basic UNIX OLC Training.

Slides:



Advertisements
Similar presentations
By: Tony Andrews.  Linux directory ordering system  Navigating and creating directories ◦ Listing directories and files ◦ Creating directories ◦ Changing.
Advertisements

CMPT 471 Networking II Linux Primer 1© Janice Regan, 2013.
Learning Unix/Linux Bioinformatics Orientation 2008 Eric Bishop.
Introduction to UNIX Cornell University CS 316 – Fall 2006 Slides by Michael Siegenthaler.
Unix. Outline Commands Environment Variables Basic Commands CommandMeaning lslist files and directories ls -alist all files and directories mkdirmake.
NETW-240 Shells Last Update Copyright Kenneth M. Chipps Ph.D. 1.
©Colin Jamison 2004 Introduction to Linux Colin Jamison.
ATS Programming Short Course I INTRODUCTORY CONCEPTS Tuesday, Jan. 27 th, 2009 Essential Unix Commands.
Introduction to UNIX Cornell University CS 316 – Fall 2007 Slides by Jed Liu (Based on slides by Michael Siegenthaler)
Lecture 02CS311 – Operating Systems 1 1 CS311 – Lecture 02 Outline UNIX/Linux features – Redirection – pipes – Terminating a command – Running program.
Introduction to Linux and Shell Scripting Jacob Chan.
Linux Commands LINUX COMMANDS.
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.
Introduction to Linux Workshop February Introduction Rob Lane & The HPC Support Team Research Computing Services CUIT.
CHAPTER 1 UNIX FOR NONPROGRAMMERS By U ğ ur Halıcı.
Linux environment ● Graphical interface – X-window + window manager ● Text interface – terminal + shell.
Linux in More Detail Shirley Moore CPS5401 August 29,
Essential Unix at ACEnet Joey Bernard, Computational Research Consultant.
Basic unix commands that everyone should know (Even if you have a mac) Slightly more advanced:
LIN Unix Lecture 3 Hana Filip. LIN UNIX Resources UNIX Tutorials UNIX help for.
Introduction to Unix – CS 21 Lecture 9. Lecture Overview Shell description Shell choices History Aliases Topic review.
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.
1 Operating Systems Lecture 2 UNIX and Shell Scripts.
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.
Second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX Commands cal – will print a calendar.
ITR3 lecture 6: intoduction to UNIX Thomas Krichel
(Re)introduction to Unix Sarah Medland. So Unix…  Long and venerable history  
CSC414 “Introduction to UNIX/ Linux” Lecture 5. Schedule 1. Introduction to Unix/ Linux 2. Kernel Structure and Device Drivers. 3. System and Storage.
(Re)introduction to Unix Sarah Medland. So Unix…  Long and venerable history  
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.
2 Manual & Filestore Mauro Jaskelioff. Introduction Using the manual The UNIX filestore File permissions.
1 Lecture 2 Working with Files and Directories COP 3353 Introduction to UNIX.
1 CS3695 – Network Vulnerability Assessment & Risk Mitigation – Introduction to Unix & Linux.
Lecture 1: Introduction, Basic UNIX Advanced Programming Techniques.
Agenda The Bourne Shell – Part I Redirection ( >, >>,
File Management commands cat Cat command cat cal.txt cat command displays the contents of a file here cal.txt on screen (or standard out).
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.
INTRODUCTION TO SHELL SCRIPTING By Byamukama Frank
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.
Tutorial of Unix Command & shell scriptS 5027
Getting started with CentOS Linux
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
The UNIX Shell Learning Objectives:
System Programming and administration CS 308
Lecture 2 Working with Files and Directories
Some Linux Commands.
C151 Multi-User Operating Systems
The Command Prompt Commands are the way to “do things” in Unix
Shell Script Assignment 1.
CSE 374 Programming Concepts & Tools
Tutorial of Unix Command & shell scriptS 5027
Introduction to UNIX.
Tutorial of Unix Command & shell scriptS 5027
Using Linux Commands Lab 3.
Tutorial of Unix Command & shell scriptS 5027
Introduction to Linux/UNIX
UNIX Reference Sheets CSE 2031 Fall 2010.
Getting started with CentOS Linux
Tutorial Unix Command & Makefile CIS 5027
CSE 303 Concepts and Tools for Software Development
Linux Commands LINUX COMMANDS.
January 26th, 2004 Class Meeting 2
LPI Linux Certification
Presentation transcript:

Basic UNIX OLC Training

Shells A shell is how you primarily act with the operating system at the command line Two main types of shells: Bourne shell & C shell Modern variants are Bourne Again Shell (bash) and trusted c shell (tcsh) Athena uses tcsh; most everything will be in tcsh syntax. If bash is different, it will be noted

Commands Most UNIX commands are of the form: command -option argument Options (occasionally called 'flags') change the behavior of a command are usually preceded with one or two dashes Arguments are the “input” to the command Commands can take anywhere from 0 to n arguments and options.

Example Command with no options or arguments athena% renew Command with 2 arguments and no options athena% attach consult cref Command with one option and no arguments: athena% znol -l

Shell & Environment Variables Contain information about working environment Change behavior of various programs Change behavior of shell Environment variables apply to your login session Shell variables apply to one instance of your shell (ie: an xterm or gnome-terminal)

Environment Variables Display all environment variables: printenv Display a single variable printenv USER echo $USER Set a variable Tcsh: setenv FOO bar Bash: export FOO=bar

Shell variables Display all variables: set Display a single variable: echo $prompt Set a variable: Tcsh: set foo=bar Bash: foo=bar

I/O Redirection Command > filename Redirect output of command to new file “filename” Command >> filename Append output of command to new file “filename” command < filename read input from file called “filename” command | command2 take the output of command and make it the input of command 2

Examples ls > /tmp/files.txt ls Public >>/tmp/files.txt ls | more sort < /tmp/files.txt

Basic Commands Move file1 into the directory directoryname mv file1 directoryname Copy file1 to the directory directoryname cp file1 directoryname Go back/up one level cd .. Create the directory directoryname mkdir directoryname Restore the previously deleted file file1 undelete file1 Mark file1 for deletion, will be deleted in 3 days delete file1 Move (rename) file1 to a new file called file2 mv file1 file2 Copy file1 to a new file called file2 cp file1 file2 Change current directory to directoryname cd directoryname Show name of current directory pwd List contents of current directory ls

Other Commands Display contents of a file cat filename.txt Count lines in a file: wc -l filename.txt (-c for characters) Display only the beginning or end of a file head filename.txt tail filename.txt

grep grep is a “searching” utility it matches patterns (“regular expressions”) Can do lots of complex things, but simple text search is the best grep dog animals.txt ls | grep thesis grep -i causes it to be case-insensitive

sort Sorts the input and displays it sort -n will sort numerically otherwise it goes 1, 10, 2, 3, 34, 4, etc.

Pagers A pager allows you see one “page” of information at a time Common pagers are “more” and “less” Basic pager commands: space = page down enter = line down b = page up y = line up / = search q = quit

Examples ls | more less mydocument.txt

Shell Wildcards * Match anywhere from 0 to n characters ? match one character Examples: ls foo* will list “foo”, “foo2”, “foobar” ls foo? will only list “foo2”

Manual Pages man commandname whatis commandname apropos <search term> Some commands don't have man pages (ie: fs) Try -help, --help, -?, -h Google

File Permissions ls -l shows file permissions -rw------- 1 jdreed mit 684 Sep 12 09:51 /tmp/tkt_p16901 10 columns. First is – if it's a file, “d” if it's a directory Remaining 9 are 3 groups of 3. First group for user (u), 2nd group for group (g), 3rd group for “everyone else” (o)

File modes r = read (or list files, if directory) w = write (or delete/create if directory) x = execute (or access if directory) s = run as though you were the owner t = sticky (on directory, regardless of permissions files can only be accessed by the owner or root)

chmod change the mode of a file: chmod go-rwx myfile remove read write and execute for group and other chmod u+w myfile Give yourself (owner) ability to write to file On AFS, only the user (u) permissions are used, group and other are ignored, as they are governed by AFS permissions

Jobs and Processes ps show processes in current shell ps -u show all your processes ps ax (or ps -ef) show all processes on the machine

Foreground and Background All processes are run in the foreground by default ie: you start xcluster, you don't get your athena prompt back until it's done Add an & to the end of the command to run in the background To background an already running process Ctrl-Z to suspend it bg to background it

jobs The jobs command can give you a list of suspended and running jobs fg and bg take “%n” as an arugment, where n is the number of the job as shown by “jobs”

killing processes kill can take a job number (from 'jobs') or a process id (from ps) kill -9 can kill off more stubborn processes Don't use it unless kill doesn't work

Unix Utilities df Lists free space on filesystem du shows disk usage – ideal for finding large files in your home directory file attempts to identify a file's contents