Fall 2011 Nassau Community College ITE153 – Operating Systems 1 Session 4 More Hands-on Commands.

Slides:



Advertisements
Similar presentations
RH030 Linux Computing Essentials
Advertisements

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.
MODERN OPERATING SYSTEMS Third Edition ANDREW S. TANENBAUM Chapter 3 Memory Management Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
Learning Unix/Linux Bioinformatics Orientation 2008 Eric Bishop.
NETW-240 Shells Last Update Copyright Kenneth M. Chipps Ph.D. 1.
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.
Lesson 22 – Introduction to Linux Systems Administration.
Linux+ Guide to Linux Certification, Second Edition
Linux+ Guide to Linux Certification, Second Edition
Chapter 3 Memory Management
More Shell Programming Learning Objectives: 1. To learn the usage of environment (shell) variables in shell programming 2. To understand the handling of.
Very Quick & Basic Unix Steven Newhouse Unix is user-friendly. It's just very selective about who its friends are.
CS 141 Labs are mandatory. Attendance will be taken in each lab. Make account on moodle. Projects will be submitted via moodle.
Linux Installation and Administration Lesson 2 Tutor: George Papamarkos.
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”
Lesson 7-Creating and Changing Directories. Overview Using directories to create order. Managing files in directories. Using pathnames to manage files.
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.
Guide To UNIX Using Linux Fourth Edition
Linux+ Guide to Linux Certification, Second Edition
Jozef Goetz, expanded by Jozef Goetz, 2009 Credits: Parts of the slides are based on slides created by UNIX textbook authors, Syed M. Sarwar, Robert.
Guide to Linux Installation and Administration, 2e1 Chapter 10 Managing System Resources.
INTRODUCTION TO LINUX Jacob Chan. GNU/Linux Consists of Linux kernel, GNU utilities, and open source and commercial applications Works like Unix –Multi-user.
Lecture – Performance Performance management on UNIX.
1 Operating Systems and Using Linux Topics What is an Operating System? Linux Overview Frequently Used Linux Commands Reading None.
Guide To UNIX Using Linux Third Edition Chapter 8: Exploring the UNIX/Linux Utilities.
Linux+ Guide to Linux Certification, Third Edition
Linux+ Guide to Linux Certification, Third Edition
Lab 3 + Using the Terminal 1. "Under Linux there are GUIs (graphical user interfaces). where you can point and click and drag, and hopefully get work.
Manage Directories and Files in Linux Part 2. 2 Identify File Types in the Linux System The file types in Linux referred to as normal files and directories.
Agenda Basic Unix Commands (Chapters 2 & 3) Miscellaneous Commands: which, passwd, date, ps / kill Working with Files: file, touch, cat, more, less, grep,
SUSE Linux Enterprise Desktop Administration Chapter 7 Manage Directories and Files.
UNIX filesystem CS 2204 Class meeting 2 *Notes by Doug Bowman and other members of the CS faculty at Virginia Tech. Copyright
Lecture 02 File and File system. Topics Describe the layout of a Linux file system Display and set paths Describe the most important files, including.
Linux A practical introduction. 1)Background and Getting Started Linux is an operating system with multiple providers Red Hat/CentOS (our version) Ubuntu.
Linux Stuff Last Update Copyright 2014 Kenneth M. Chipps Ph.D. 1.
The Kernel At a high level, the kernel in an operating system serves as the bridge between applications and the actual data processing of the hardware.
EMT 2390L Lecture 3 Dr. Reyes Reference: The Linux Command Line, W.E. Shotts.
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.
Operating systems Lecture #3 Modern OS characteristics.
Guide to Parallel Operating Systems with Windows 7 and Linux Chapter 10 Operating System Management.
1 Linux Commands. 2 Path You specify a file or directory by its path name:  the full, or absolute, path name or the one relative to a location. The full.
Where'd all my memory go? Joshua Miller SCALE 12x – 22 FEB 2014.
Linux Command Tips.
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.
Linux203Training Module System Mgmt.
Getting started with CentOS Linux
Chapter 11 Command-Line Master Class
Linux Commands Help HANDS ON TRAINING Author: Muhammad Laique
Andy Wang Object Oriented Programming in C++ COP 3330
Session 3 Memory Management
Some Linux Commands.
Lecture #3 Modern OS characteristics
Linux 202 Training Module Program and Process.
Lecture #3 Modern OS characteristics
Structure of Processes
Getting started with CentOS Linux
Andy Wang Object Oriented Programming in C++ COP 3330
UNIX/LINUX Commands Using BASH Copyright © 2017 – Curt Hill.
Tutorial Unix Command & Makefile CIS 5027
The Linux Command Line Chapter 4
Module 6 Working with Files and Directories
January 26th, 2004 Class Meeting 2
The Linux Command Line Chapter 4
Presentation transcript:

Fall 2011 Nassau Community College ITE153 – Operating Systems 1 Session 4 More Hands-on Commands

Files and Directories Unit Objectives: By the end of this unit, you will be able to: Describe the format for filenames Use commands to:  determine and display file contents  copy and move files  link files  remove files Make, copy and remove directories Use wildcards Fall 2011 Nassau Community College ITE153 – Operating Systems 2

Filenames There is no specified format for filenames in UNIX Filenames (including directory names) can consist of: Up to 255 characters Any character except: & ; | * ? ‘ “ ` [ ] { } ( ) $ ^ # / \ Examples: myfiles UNIX4.you You+Me Dir2 hare_2_day Fall 2011 Nassau Community College ITE153 – Operating Systems 3

Basic File Commands

The file Command Reports the type of file. Some classifications include:  Plain text commands, text  directory executable  data commands, text  ASCII text empty  c programtext Format: file filename(s) $ file myfiles myfiles: Directory $ file /dev/tty10 /dev/tty10: character special Fall 2011 Nassau Community College ITE153 – Operating Systems 5

Displaying File Contents The cat, pg, and more commands display the contents of a file. $ cat filename(s)  Displays the named files  Does not page! $ pg filename(s) $ more filename(s)  Displays the named files one screen at a time Fall 2011 Nassau Community College ITE153 – Operating Systems 6

head and tail head -n filename Displays the first ten lines of a file (with no option) Using -n, you can specify the number of lines $ head -25 fileA tail -n -r filename Displays the last ten lines of a file (with no options) Using -n, you can specify the number of lines Using -r, you can display the lines in reverse order $ tail -15 -r fileA Fall 2011 Nassau Community College ITE153 – Operating Systems 7

Copying Files Copy a specified file and creates a new file. cp f1 f2 (f1 is an existing file) Copy a list of files to a specified directory. cp f1 f2 f3 DIR1 (f1, f2, & f3 are existing files) Fall 2011 Nassau Community College ITE153 – Operating Systems 8

Moving Files Move (rename) a specified file in the current directory. mv f1 f2 (f1 is an existing file) Moves a list of files to a specified directory. mv f1 f2 f3 DIR1 (f1, f2, & f3 are existing files) Fall Nassau Community College ITE153 – Operating Systems

Linking Files Link two files ln f1 f2 (f1 is an existing file) Examples: $ ln fileC XXX $ ln fileB myfiles/archive Fall 2011 Nassau Community College ITE153 – Operating Systems 10

Removing Files Remove one or more files rm f1 rm f1 f2 f3 f4 Examples: $ rm fileC fileB $ rm myfiles/fileB myfiles/fileC Be very careful! rm –i (interactive) rm –r (recursive) Fall 2011 Nassau Community College ITE153 – Operating Systems 11

Making & Removing Directories Make one or more directories mkdir Dir1 mkdir Dir2 Dir3 Dir4 Remove one or more directories rmdir Dir1 rmdir Dir2 Dir3 Dir4 Fall 2011 Nassau Community College ITE153 – Operating Systems 12

Copying Directories Copy a directory and its subdirectories to a new location in the filesystem cp -r Dir1 Dir2 (Dir1 and Dir2 are existing directories) Fall 2011 Nassau Community College ITE153 – Operating Systems 13

Using Wildcards Wildcards are used for filename generation  Used to make shorthand references to files and directories.  Interpreted by the shell  Also called metacharacters Fall 2011 Nassau Community College ITE153 – Operating Systems 14

Exercises Fall 2011 Nassau Community College ITE153 – Operating Systems 15

Session 3 Fall 2011 Nassau Community College ITE153 – Operating Systems 16 Memory Management

(a) A part of memory with five processes and three holes. The tick marks show the memory allocation units. The shaded regions (0 in the bitmap) are free. (b) The corresponding bitmap. (c) The same information as a list. Memory Management with Bitmaps Fall 2011 Nassau Community College ITE153 – Operating Systems 17

Memory allocation changes as processes come into memory and leave it. The shaded regions are unused memory. Swapping (1) Fall 2011 Nassau Community College ITE153 – Operating Systems 18

The position and function of the MMU – shown as being a part of the CPU chip (it commonly is nowadays). Logically it could be a separate chip, was in years gone by. Virtual Memory – Paging (1) Fall 2011 Nassau Community College ITE153 – Operating Systems 19

Relation between virtual addresses and physical memory addresses given by page table. Paging (2) Fall 2011 Nassau Community College ITE153 – Operating Systems 20

Page fault handling with an external pager. Separation of Policy and Mechanism (2) Fall 2011 Nassau Community College ITE153 – Operating Systems 21

Protection on the Pentium. Segmentation with Paging: The Pentium (5) Fall 2011 Nassau Community College ITE153 – Operating Systems 22

Try to get into Task Manager Fall 2011 Nassau Community College ITE153 – Operating Systems 23

Session 4 Fall 2011 Nassau Community College ITE153 – Operating Systems 24 Memory Management Commands

Information About CPU & Memory On Linux there are two handy commands: Information about CPU cat /proc/cpuinfo Information about Memory cat /proc/meminfo You can also use the command: free or free -m or free –g Also try (usually for FreeBSD): sysctl -a | less or dmesg | grep -i CPU Fall 2011 Nassau Community College ITE153 – Operating Systems 25

Find Out About My System Information about the system uname –a gives something like this: Linux papacosta generic-pae #48-Ubuntu SMP Fri Jul 29 20:51:21 UTC 2011 i686 i686 i386 GNU/Linux Here are some parameters: uname –r kernel release uname –p processor name uname –i hardware platform uname –o operating system Fall 2011 Nassau Community College ITE153 – Operating Systems 26

Hands-on Fall 2011 Nassau Community College ITE153 – Operating Systems 27

top command The top program provides a dynamic real-time view of a running system i.e. actual process activity. By default, it displays the most CPU-intensive tasks running on the server and updates the list every five seconds. Fall 2011 Nassau Community College ITE153 – Operating Systems 28 Tasks: 226 total, 1 running, 222 sleeping, 0 stopped, 3 zombie Cpu(s): 4.0%us, 4.3%sy, 0.3%ni, 91.4%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st Mem: k total, k used, k free, 27036k buffers Swap: k total, k used, k free, k cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 5703 papacost m 2.1g 2.0g S :52.12 VirtualBox papacost m 74m 16m S :25.37 banshee 2126 papacost m 87m 16m S :50.75 compiz 1194 root m 56m 8488 S :01.98 Xorg 3947 papacost m 59m 12m S :09.74 chromium-browse 2125 papacost m 10m 8964 S :17.21 pulseaudio 2143 papacost m 54m 9272 S :00.63 nautilus 2392 papacost m 59m 5228 S :29.50 unity-panel-ser 3828 papacost m 58m 17m S :28.35 chromium-browse papacost m 11m 8172 S :06.14 gnome-terminal

w - Find Out Who Is Logged on And What They Are Doing w command displays information about the users currently on the machine, and their processes. w 15:01:31 up 5 days, 5:21, 3 users, load average: 0.08, 0.12, 0.13 USER TTY FROM IDLE JCPU PCPU WHAT papacost tty7 :0 Fri09 5days 2:58m 1.24s gnome-session - papacost pts/0 :0 Tue20 23: s 0.47s bash papacost pts/1 :0 14: s 0.33s 6.33s gnome-terminal Fall 2011 Nassau Community College ITE153 – Operating Systems 29

uptime - Tell How Long The System Has Been Running The uptime command can be used to see how long the server has been running. The current time, how long the system has been running, how many users are currently logged on, and the system load averages for the past 1, 5, and 15 minutes. uptime yields: 15:05:39 up 5 days, 5:25, 3 users, load average: 0.12, 0.11, 0.13 Fall 2011 Nassau Community College ITE153 – Operating Systems 30

vmstat - System Activity, Hardware and System Information The command vmstat reports information about processes, memory, paging, block IO, traps, and cpu activity. vmstat procs memory swap io---- -system cpu---- r b swpd free buff cache si so bi bo in cs us sy id wa Fall 2011 Nassau Community College ITE153 – Operating Systems 31

Hands-on Fall 2011 Nassau Community College ITE153 – Operating Systems 32

Important URLs 20 Linux System Monitoring Tools Every SysAdmin Should Know Handy monitoring commands 20 Linux System Monitoring Tools Every SysAdmin Should Know Linux command to gathers up information about a Linux system Some basic commands Linux command to gathers up information about a Linux system Graphical Monitoring Under Ubuntu Contrast this to the tolls under Windows Graphical Monitoring Under Ubuntu Fall 2011 Nassau Community College ITE153 – Operating Systems 33

Homework Review the Slides Keep Practicing Commands Try to get into Task Manager on Windows Compare to what you have learned on Linux Fall 2011 Nassau Community College ITE153 – Operating Systems 34