©Colin Jamison 2004 Introduction to Linux Colin Jamison.

Slides:



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

Introduction to the Omega Server CSE Overview Intro to Omega Basic Unix Command Files Directories Printing C and C++ compilers GNU Debugger.
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.
1 Introduction to UNIX Ke Liu
NETW-240 Shells Last Update Copyright Kenneth M. Chipps Ph.D. 1.
The UNIX File System CS465. File Systems What is a file system? A means of organizing information on the computer. A file system is a logical view, not.
Linux+ Guide to Linux Certification, Second Edition
More Shell Basics CS465 - Unix. Unix shells User’s default shell - specified in /etc/passwd file To show which shell you are currently using: $ echo $SHELL.
CS4315A. Berrached::CMS::UHD1 Quick UNIX Tutorial.
1 Basics of Linux On linux machine: Login at your home directory Open a “shell” or “terminal” or “xterm” workspace (4) On windows machine Intall linux.
Unix Basics. Systems Programming: Unix Basics 2 Unix Basics  Unix directories  Important Unix file commands  File and Directory Access Rights through.
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 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.
Systems Programming Concepts
Introduction to Linux Workshop February Introduction Rob Lane & The HPC Support Team Research Computing Services CUIT.
1 THE UNIX FILE SYSTEM By Chokechai Chuensukanant ID COSC 513 Operating System.
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 1 UNIX FOR NONPROGRAMMERS By U ğ ur Halıcı.
Linux Directory Navigation. File & Directory Commands This is a minimal list of Unix commands that you must know for file management: ls (list) mkdir.
Linux environment ● Graphical interface – X-window + window manager ● Text interface – terminal + shell.
1 Lecture 2 Working with Files and Directories COP 3344 Introduction to UNIX.
Lesson 1. PC vs. Multi-user System  Personal Computer – each user gets his/her own processor (or multicore processor).  Multi-user system – The processor,
Unix Basics Chapter 4.
Working with Linux Lab 1 1. Login and logout Account – username & password – Note: Linux is case-sensitive Administrator: username = root Logout: exit,
Linux overview. Architecture Kernel File system Shell: Korn, Bourne, C, Bash X Windows: Motif, Open Look, X.OrgX.Org Desktop: Gnome, KDE,etc.
System Administration Introduction to Unix Session 2 – Fri 02 Nov 2007 Reference:  chapter 1, The Unix Programming Environment, Kernighan & Pike, ISBN.
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.
Chapter Two Exploring the UNIX File System and File Security.
UNIX An Introduction. Brief History UNIX UNIX Created at Bell Labs, 1969 Created at Bell Labs, 1969 BSD during mid 70s BSD during mid 70s AT&T began offering.
Linux+ Guide to Linux Certification, Third Edition
Introduction to Programming Using C An Introduction to Operating Systems.
CSC414 “Introduction to UNIX/ Linux” Lecture 5. Schedule 1. Introduction to Unix/ Linux 2. Kernel Structure and Device Drivers. 3. System and Storage.
Getting Started UNIX InKwan Yu Topics Unix Commands Unix System calls C function calls.
Λειτουργικά Συστήματα – Lab2 Γιάννης Πετράκης. Directory Navigation and Control  The Unix file system is set up like a tree branching out from the root.
Agenda Basic Unix Commands (Chapters 2 & 3) Miscellaneous Commands: which, passwd, date, ps / kill Working with Files: file, touch, cat, more, less, grep,
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.
A gentle introduction to LINUX at the command prompt.
Basic Unix Commands. Listing files and directories ● ls:command is used to list the files and ● directories in present working directory ● ls command.
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.
Laboratory 1.2a1 First steps with Unix - Lab Boris Steipe Department of Biochemistry Department.
UNIX Basics Matt Hayward October 18, 2016 LS560 – Information Technology for information professionals.
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.
Chapter 11 Command-Line Master Class
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.
Part 1: Basic Commands/Utilities
Lecture 2 Working with Files and Directories
Some Linux Commands.
C151 Multi-User Operating Systems
CS314 – Section 5 Recitation 1
UNIX Basics Internet Technology.
Tutorial of Unix Command & shell scriptS 5027
Basic UNIX OLC Training.
Introduction to UNIX.
Tutorial of Unix Command & shell scriptS 5027
CS 60 Discussion Review.
Tutorial of Unix Command & shell scriptS 5027
Module 6 Working with Files and Directories
Linux Commands LINUX COMMANDS.
January 26th, 2004 Class Meeting 2
Presentation transcript:

©Colin Jamison 2004 Introduction to Linux Colin Jamison

©Colin Jamison 2004 Help on Unix Commands List all options available for a command and also some example usage e.g. man command-name As for ‘man’ but the ‘info’ command has more information and is up to date e.g. info command-name

©Colin Jamison 2004 UNIX Command Format command The first word is the command Options follow commands Commands/options/arguments are case sensitive A command may or may not have options $ ls $ ls -al Arguments are normally files/directories $ ls -al /etc

©Colin Jamison 2004 Directory and File Names Case sensitive Any character Avoid “ / * > space ! ” –they are legal but their use is problematic with shells Must be unique inside its directory Wildcard – *any number of characters – ?any single character – [ ]Any one of the characters inserted between the brackets

©Colin Jamison 2004 Path Names Path name - is an address that uniquely identifies a file or directory in the UNIX file system. Absolute path name - always starts from the root directory e.g. /usr/local/bin Relative path name - path relative to the present working directory e.g. if pwd is /usr relative pathname local/bin is equivalent to the absolute pathname /usr/local/bin

©Colin Jamison 2004 Directory Navigation Changing directory $ cd /usr $ cd local/bin $ cd.. Present directory $ pwd /home/cjamison/ Creating/removing directories $ mkdir directoryname $ rmdir directoryname

©Colin Jamison 2004 Directory Contents File listing $ ls - abbreviated list $ ls -a - abbreviated list + hidden files $ ls -al - long list + hidden files $ ls -F - abbreviated list + file type

©Colin Jamison 2004 bash2.04$ ls -l total drwxr-xr-x 1 cjamison staff 123 Dec Aproject -rwx--x--x 1 cjamison staff 514 Dec Ascript -rwxr--r-- 1 cjamison staff 2345 Jan afile -rwxr--r-- 1 cjamison staff 231 Aug checksum -rwxr-x--x 1 cjamison staff 126 Dec dos2unix -rwx cjamison staff 732 Oct dev.txt -rwxr-x--x 1 cjamison staff 9470 Aug excalibur drwxr-x--x 1 cjamison staff 512 Dec home drwx cjamison staff 512 Jan mp3 drwx cjamison staff 512 Sep payroll -rwxr-x--- 1 cjamison staff 8972 Aug swallow -rw cjamison staff 42 Dec swift.txt bash2.04$ File listing type access permission owner group size date and time last modified name

©Colin Jamison 2004 Access Permissions Access permissions on a directory determine whether a file in the directory can be renamed or removed File permissions determine what can be done to the file contents To allow access to a directory, access permissions should be set for all of its parent directories all the way up to the root directory

©Colin Jamison 2004 Access Permissions The first character indicates the type of file: –directory (d) –link (l) –plain file (-) -rwxrwxr-x l The rest, specify three types of users m owner m group m others l who are allowed to m (r) read m (w) write m (x) execute

©Colin Jamison 2004 Numerical Access Permissions -|rwx|r-x|r--| |111 |101|100| Character Binary Octal | 7 | 5 | 4 |

©Colin Jamison 2004 Protecting Your Files -r (400) protect it from accidental editing -rw (600) owner can edit/read the file -rw- r-- r-- (644) owner can edit, others may read -rw- rw- rw- (666) everyone can edit/read dr-x r-x r-x (555) everyone can list but can’t create delete/rename files drwx (700) owner can do anything drwx r-x r-x (755) owner can do anything, others can read drwx rwx rwx (777) anyone can edit/read/run

©Colin Jamison 2004 Changing Access Permissions chmod permission files Character Method $ chmod a=r-x filename $ chmod u=rwx filename $ chmod go+r filename $ chmod ugo-w filename Numerical Method $ chmod 755 filename $ chmod 600 filename

©Colin Jamison 2004 Viewing and Editing Files Listing files –cate.g. cat filename –taile.g. tail -f filename Listing files one screen at a time –moree.g. cat filename | more Editing files –vi –emacs –GUI tools

©Colin Jamison 2004 File Manipulation Copy –cp filename1 filename2 move (rename) –mv filename directory remove (delete) - be careful! –rm filename

©Colin Jamison 2004 Listing Processes List processes e.g. ps ps -ef

©Colin Jamison 2004 Processes - Foreground v Background To run a process as a background process: process-name & To examine foreground/background processes use the jobs command fg bg Each process has a unique process id (PID)

©Colin Jamison 2004 Disposing of Rogue Processes The kill command kill parameter PID parameters ‘-1’ to ‘-9’ PID available from one of the process commands

©Colin Jamison 2004 Redirection (1) ls -al > lsoutput1.txt ls -al >> lsoutput2.txt file descriptors standard input 0 standard output 1 standard error 2

©Colin Jamison 2004 Redirection (2) Redirect standard error to a file ls -al > lsout.txt 2>lserror.txt redirect standard output and standard error to the same file ls -al > lsout.txt 2>&1 Redirecting input more < lsout.txt To discard standard output and standard error ls -al > /dev/null 2>&1

©Colin Jamison 2004 Pipes Simplify redirection e.g. ps | sort | more ps | grep ‘sh’ > listshells.txt

©Colin Jamison 2004 ‘C’ Tools (gcc) gcc - GNU C/C++ compiler gcc filename1 … filenameX -o programfilename most commonly used options [-Idir...] search dir for header files [-Ldir…] include dir to search for library ( -llibrary ) [-o outfile] [-ggdb] include gdb debugging information

©Colin Jamison 2004 ‘C’ Tools (gdb) gdb - GNU debugger gdb programfilename most commonly used options run break [file:]functionprint expr next step c edit [file:]function list help command quit

©Colin Jamison 2004 Questions ?