ULI101 Week 05. Week Overview ● File system links ● Hard and symbolic links ● Process management ● Storage quota information (quota) ● Printing.

Slides:



Advertisements
Similar presentations
June 1, 1999Foreground/Background Processing1 Introduction to UNIX H. Foreground/Background Processing.
Advertisements

Using tcpdump. tcpdump is a powerful tool that allows us to sniff network packets and make some statistical analysis out of those dumps. tcpdump operates.
Lesson 10-Controlling User Processes. Overview Managing and processing processes. Managing jobs. Exiting/quitting when jobs have been stopped.
1 Introduction to UNIX Ke Liu
Links Learning Objectives: 1. To understand the basics of links & its usage 2. To learn the construction / removal of different types of links 3. To distinguish.
ATS Programming Short Course I INTRODUCTORY CONCEPTS Tuesday, Jan. 27 th, 2009 Essential Unix Commands.
Linux+ Guide to Linux Certification, Second Edition
File security and Permissions A file is owned by the user who created it That user can then specify who can read, write and execute that file A file when.
Lesson 22 – Introduction to Linux Systems Administration.
Links Learning Objectives: 1. To understand the basics of links & its usage 2. To learn the construction / removal of different types of links 3. To distinguish.
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.
Processes & Daemons Chapter IV / Part III. Commands Internal commands: alias, cd, echo, pwd, time External commands, code is in a file: grep, ls, more.
CS 497C – Introduction to UNIX Lecture 16: - File Attributes Chin-Chih Chang
Lecture 02CS311 – Operating Systems 1 1 CS311 – Lecture 02 Outline UNIX/Linux features – Redirection – pipes – Terminating a command – Running program.
Links Software Tools. Lecture 4 / Slide 2 Links l A link is a pointer to a file. l In fact, in UNIX all filenames are just links to a file. Most files.
5 UNIX Processes. Introduction  Processes  How to list them  How to terminate them  Process priorities  Scheduling jobs  Signals.
UNIX Processes. The UNIX Process A process is an instance of a program in execution. Created by another parent process as its child. One process can be.
Filesystem Hierarchy Standard (FHS) –Standard of outlining the location of set files and directories on a Linux system –Gives Linux software developers.
1 THE UNIX FILE SYSTEM By Chokechai Chuensukanant ID COSC 513 Operating System.
The file structure and related utilities CS240 Computer Science II.
Lesson 7-Creating and Changing Directories. Overview Using directories to create order. Managing files in directories. Using pathnames to manage files.
Working with Files Chapter 5. Display a Calendar Display a calendar for a specific month – cal Display a calendar for a specific year – cal 2000.
Files & Directories Objectives –to be able to describe and use the Unix file system model and concepts Contents –directory structure –file system concepts.
Guide to Linux Installation and Administration, 2e1 Chapter 8 Basic Administration Tasks.
Basic unix commands that everyone should know (Even if you have a mac) Slightly more advanced:
UNIX command line. In this module you will learn: What is the computer shell What is the command line interface What is the directory tree Some UNIX commands.
Managing Files CSCI N321 – System and Network Administration Copyright © 2000, 2011 by the Trustees of Indiana University except as noted.
The Shell Chapter 7. Overview The Command Line Standard IO Redirection Pipes Running a Program in the Background Killing (a process!)
Linux+ Guide to Linux Certification, Third Edition
Additional UNIX Commands. 222 Lecture Overview  Multiple commands and job control  More useful UNIX utilities.
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved Chapter 5 File Management File Overview.
Lesson 9-Setting and Using Permissions. Overview Describing file permissions. Using execute permissions with a file. Changing file permissions using mnemonics.
Process Control. Module 11 Process Control ♦ Introduction ► A process is a running occurrence of a program, including all variables and other conditions.
BIF703 Hard & Symbolic Links. What is a file system Link? A link is a pointer to a file. This pointer associates a file name with a number called an i-node.
Linux+ Guide to Linux Certification, Second Edition Chapter 10 Managing Linux Processes.
Guide To UNIX Using Linux Third Edition Chapter 8: Exploring the UNIX/Linux Utilities.
Managing Files. Module 5 Managing Files ♦ Introduction “On a Linux system, everything is a file; if something is not a file, it is a process.” ♦ Topics.
Hands On UNIX II Dorcas Muthoni. Processes A running instance of a program is called a "process" Identified by a numeric process id (pid)‏  unique while.
Linux+ Guide to Linux Certification Chapter Eleven Managing Linux Processes.
Linux+ Guide to Linux Certification, Third Edition
Linux+ Guide to Linux Certification, Third Edition
ULI101 More Linux Commands Introduction to UNIX/Linux and the Internet
Introduction to Programming Using C An Introduction to Operating Systems.
Managing Files CSCI N321 – System and Network Administration Copyright © 2000, 2007 by the Trustees of Indiana University except as noted.
Linux Commands C151 Multi-User Operating Systems.
ATS Programming Short Course I INTRODUCTORY CONCEPTS Tuesday, Feb 3 rd, 2009 Essential Unix Commands …the second half.
PTA Linux Series Copyright Professional Training Academy, CSIS, University of Limerick, 2006 © Workshop VI Scheduling & Process Management Professional.
ECC LINUX WORKSHOP (INTERMEDIATE COURSE). WHAT WILL BE COVERED 1.Input, Output and Pipes 2.Processes 3.Compiling Unix Software Packages 4.Symbolic and.
CSCI 330 UNIX and Network Programming Unit II Basic UNIX Usage: File System.
The Unix File System R Bigelow. The UNIX File System The file system refers to the way in which UNIX implements files and directories. The UNIX file system.
CSC414 “Introduction to UNIX/ Linux” Lecture 3
Agenda Managing Processes (Jobs) Command Grouping Running jobs in background (bg) Bringing jobs to foreground (fg), Background job status (jobs) Suspending.
Agenda The Bourne Shell – Part I Redirection ( >, >>,
An Introduction to processes R Bigelow. A Unix Process A process in Unix is simple a program The Unix system is made up of a group of processes all interacting.
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.
BIF703 Hard & Symbolic Links.
Chapter 11 Command-Line Master Class
...looking a bit closer under the hood
Linux Commands Help HANDS ON TRAINING Author: Muhammad Laique
Some Linux Commands.
Hands On UNIX AfNOG 2010 Kigali, Rwanda
Hands On UNIX AfNOG X Cairo, Egypt
Basic UNIX OLC Training.
Introduction to UNIX.
The Linux Command Line Chapter 10
File System B. Ramamurthy B.Ramamurthy 11/27/2018.
Processes – Part I.
Lab 6: Process Management
January 26th, 2004 Class Meeting 2
Presentation transcript:

ULI101 Week 05

Week Overview ● File system links ● Hard and symbolic links ● Process management ● Storage quota information (quota) ● Printing

What is a file system Link? A link is a pointer to a file. This pointer associates a file name with a number called an i-node number An i-node is the control structure for a file (on a UNIX/Linux file system) If two file names have the same i-node number, they are links to the same file

What is a file system Link? Use the command “ls -i” to print i-node number of each file: week8]$ ls -i lab3a.html lab3b.html lab3.zip Use the command “ls -il” for long listing week8]$ ls -il total rw-r--r-- 1 ray ray 1097 Sep 13 08:53 lab3a.html rw-r--r-- 1 ray ray 6582 Sep 13 08:53 lab3b.html rw-rw-r-- 1 ray ray 6218 Sep 14 00:05 lab3.zip i-node

What is a file system Link? There are two kinds of links: 1. Hard Links 2. Soft or Symbolic Links

Hard Links Hard link is a reference to the physical data on a file system More than one hard link can be associated with the same physical data Hard links can only refer to data that exists on the same file system Only the root user can create hard links to a directory When a file has more than one link, you can remove any one link and still be able to access the file through the remaining links.

Hard Links  Example: Assume you used “vi” to create a new file, you create the first hard link (vi myfile) To Create the 2 nd, 3 rd and etc. hard links, use the command: ln myfile link-name

Display Hard Links info Create a new file called “myfile” Run the command “ls -il” to display the i-node number and link counter rw-rw-r-- 1 uli uli 29 Oct 29 08:47 myfile ^ ^ |-- inode # |-- link counter (one link)

Display Hard Link Info Create a 2 nd link to the same data: ln myfile mylink Run the command “ls -il”: rw-rw-r-- 2 uli uli 29 Oct 29 08:47 myfile rw-rw-r-- 2 uli uli 29 Oct 29 08:47 mylink ^ ^ |-- inode # |--link counter (2 links)

Add the 3 rd Link Create a 3 rd link to the same data: ln myfile newlink Run the command “ls -il”: rw-rw-r-- 3 uli uli 29 Oct 29 08:47 myfile rw-rw-r-- 3 uli uli 29 Oct 29 08:47 mylink rw-rw-r-- 3 uli uli 29 Oct 29 08:47 newlink ^ ^ |-- inode # |--link counter (3 links)

Symbolic Links Also Known As (a.k.a.): Soft links or Symlinks A Symbolic Link is an indirect pointer to a file – a pointer to the hard link to the file You can create a symbolic link to a directory A symbolic link can point to a file on a different file system A symbolic link can point to a nonexistent file (referred to as a “broken link”)

Symbolic Links To create a symbolic link to the file “myfile”, use ln -s myfile symlink or ln --symbolic myfile symlink courses] ls -li myfile rw-rw-r-- 1 uli uli 49 Oct 29 14:33 myfile courses] ln -s myfile symlink courses] ls -li myfile symlink rw-rw-r-- 1 uli uli 49 Oct 29 14:33 myfile lrwxrwxrwx 1 uli uli 6 Oct 29 14:33 symlink -> myfile Different i-node File type: (symbolic link) Link counter: (1 link)

Properties of Symbolic Links The i-node number is different from the pointed to file The link counter of the new symbolic link file is “1” Symbolic link file does not affect the link counter of the pointed to file The type field of symblic file contains the letter “l” The symbolic link file and the pointed to file have different status information (e.g. file size, last modification time etc.)

Create Symbolic Link Directory The syntax is the same as linking to a file ln -s target_directory link_directory ln --symbolic target_directory link_directory week8]$ ls -li drwxrwxr-x 7 uli uli 168 Oct 29 13:32 courses week8]$ ln courses mydir ln: `courses': hard link not allowed for directory week8]$ ln -s courses mydir week8]$ ls -li drwxrwxr-x 7 uli uli 168 Oct 29 13:32 courses lrwxrwxrwx 1 uli uli 7 Oct 29 15:41 mydir -> courses

Directory Listing To display the contents in a directory, we usually use the command “ls -l directory_name” Compare the following two commands week8]$ ls -l mydir lrwxrwxrwx 1 uli uli 7 Oct 29 15:41 mydir -> courses week8]$ ls -l courses drwxrwxr-x 2 uli uli 72 Oct 29 11:15 ica101 drwxrwxr-x 2 uli uli 72 Oct 29 11:16 ios110 drwxrwxr-x 2 uli uli 120 Oct 29 11:20 to_do drwxrwxr-x 2 uli uli 72 Oct 29 11:14 uli101

Delete link to a directory  To delete a link to a directory, simply use the “rm” command: week8]$ ls -l drwxrwxr-x 7 uli uli 168 Oct 29 13:32 courses lrwxrwxrwx 1 uli uli 7 Oct 29 15:41 mydir -> courses week8]$ rm mydir week8]$ ls -l drwxrwxr-x 7 uli uli 168 Oct 29 13:32 courses

Properties of Symbolic Link Directory The Symbolic link to a directory has a file type of “l” (the first letter of the permission field). The permissions on the link are set to “rwx” for all. chmod on the link applies to the actual directory (or file), the permissions on the link stay the same Can point to a non-existent directory

UNIX processes ● Almost everything that is “running” on a UNIX system is referred to as a process ● Each process has an owner ● Each process has a unique ID (PID) ● Processes in UNIX can run in: – Foreground – Background

Process structure ● UNIX processes are hierarchical ● This structure has a root, parents and children ● Creation of a new process is called forking or spawning ● Parent can fork a child and children can fork their own children ● Processes keep their PID for their entire life ● Usually parent sleeps when a child is executing its task – The exception is when the child process is run in the background

Process identification ● ps (process status) command displays snapshot information about processes ● By default, the ps command displays information only about current terminal (ps -U username shows all) ● The top command provides a continuous update including resource usage

Foreground and background ● Foreground processing: – Is the default – Takes away the command line until processing is finished ● Background processing: – Is invoked by putting the ampersand (&) operator at the end of the command line – User gets the command line back immediately ● Both foreground and background processes can be executed on one command line ● Background processes run concurrently (at the same time)

Process suspending ● A foreground job can be suspended (temporarily stopped) by pressing Ctrl+Z ● Stopped jobs can be restarted by using the fg command Syntax:fg ORfg job_number (1,2...) OR fg PID ● fg without id/job will bring the last background process to foreground ● The jobs command will show a list of background/suspended processes

Process restarting ● Restarting in foreground: fg PIDOR fg %job_number ● Restarting in background: bg PIDOR bg %job_number

Terminating processes ● Foreground processes can be terminated by using Ctrl+C or can be killed ● Background processes have to be killed unless brought to foreground – then Ctrl+C will work

kill command ● Terminates a process ● Regular users can only kill processes they own ● Syntax: kill PID ● In some cases may be ignored by the shell – use kill –9 PID instead ● kill –9 0 will terminate all background processes ● pkill command can kill processes based on the program name, for example: pkill find ● pgrep command can search for processes based on several parameters – check the man page for more details

Storage Quotas ● All file systems have finite capacity – Try the du and df commands to find out more ● Most regular user accounts have a quota – A quota limits the amount of disk space you can consume – This ensures that a single user cannot interfere with the file system use for others ● The amount of quota and disk usage can be obtained using the quota command ● If you want more disk space… – Temporarily – use the /tmp directory – Permanently – ask the administrator

lpr, lpq, lprm commands  lpr – submit file for printing lpr [ -P printer-name ] [ -# copies ] file-name [ -P printer-name] : send files to the named printer [ -# copies ] :sets the number of copies to print between 1 and 100 between 1 and 100 file-name : name of file to be printed

Printer Queue Status  lpq - show printer queue status lpq [ -P printer-name] [ -a ] [ -l] [ -P printer-name] : show status on the named printer [ -a ] : reports jobs on all printers [ -l ] : display more verbose (long) format

Print Job Management  lprm – cancel print jobs lprm [ - ] [ -P printer-name] [ job ID(s)] [ - ] : all print jobs (root only) [ -P printer-name] : print jobs on the named printer [ job ID(s) ]: jobs to be cancel