Linux file system "On a UNIX system, everything is a file; if something is not a file, it is a process." Sorts of files (on a Linux system) Directories:

Slides:



Advertisements
Similar presentations
A Guide to Unix Using Linux Fourth Edition
Advertisements

Pre-Assessment Questions
CS 497C – Introduction to UNIX Lecture 11: - The File System Chin-Chih Chang
5 Basic utilities When a user logs in to the Linux operating system the directory that they will start in is their home directory. Most users will have.
UNIX file systems Learning Objectives: 1. To understand the basics of file systems 2. To understand the hierarchical structure in Unix file system 3. To.
Introduction to Unix (CA263) File System
Exploring the UNIX File System and File Security
Linux+ Guide to Linux Certification, Second Edition
Linux Linux File System.
Linux Files. Files and directories As in Windows directories are structures which contain –Other directories –Files.
The Unix Shell. Operating System shell The shell is a command interpreter It forms the interface between a user and the operating system When you log.
The UNIX File System.
Guide To UNIX Using Linux Third Edition
Very Quick & Basic Unix Steven Newhouse Unix is user-friendly. It's just very selective about who its friends are.
Basic UNIX © McGraw Hill All rights reserved.
COMP1070/2002/lec4/H.Melikian COMP1070 Lecture #5  Files and directories in UNIX  Various types of files  File attributes  Notion of pathname  Commands.
Guide To UNIX Using Linux Fourth Edition
1 THE UNIX FILE SYSTEM By Chokechai Chuensukanant ID COSC 513 Operating System.
The file structure and related utilities CS240 Computer Science II.
Manage Directories and Files in Linux
Lesson 7-Creating and Changing Directories. Overview Using directories to create order. Managing files in directories. Using pathnames to manage files.
Linux Directory Navigation. File & Directory Commands This is a minimal list of Unix commands that you must know for file management: ls (list) mkdir.
Files & Directories Objectives –to be able to describe and use the Unix file system model and concepts Contents –directory structure –file system concepts.
1 Lecture 2 Working with Files and Directories COP 3344 Introduction to UNIX.
Unix Basics Chapter 4.
– Introduction to the Shell 10/1/2015 Introduction to the Shell – Session Introduction to the Shell – Session 2 · Permissions · Users.
Linux+ Guide to Linux Certification, Second Edition
The UNIX File System. The UNIX File A file is a container for storing information and data. Filename limited to 255 characters. Can’t contain / or NULL.
Chapter Two Exploring the UNIX File System and File Security.
INTRODUCTION TO LINUX Jacob Chan. GNU/Linux Consists of Linux kernel, GNU utilities, and open source and commercial applications Works like Unix –Multi-user.
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.
Chapter Two Exploring the UNIX File System and File Security.
ITR3 lecture 6: intoduction to UNIX Thomas Krichel
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.
System Interface Interface that provides services from the OS (Higher than BIOS) Memory Scheduler File/Storage System Inter-process Communication and Network,
E X C E E D I N G E X P E C T A T I O N S Basic LINUX Linux System Administration Dr. Hoganson Kennesaw State University Operating Systems Directory structure:
Linux+ Guide to Linux Certification, Third Edition
Linux+ Guide to Linux Certification, Third Edition
1 © 2001 John Urrutia. All rights reserved. Chapter 4 The LINUX Filesystem.
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.
Λειτουργικά Συστήματα – Lab2 Γιάννης Πετράκης. Directory Navigation and Control  The Unix file system is set up like a tree branching out from the root.
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.
Linux Filesystem WeeSan Lee. Roadmap Disk Partitions The Filesystem Filesystem Mouting & Umounting File Tree File Type File Permission.
The Unix File system (UFS) Presented by: Gurpreet Singh Assistant Professor Department of School of Computing and Engineering Galgotias University.
CS 245 – Part 1 Using Operating Systems and Networks for Programmers Jiang Guo Dept. of Computer Science California State University Los Angeles.
1 Lecture 2 Working with Files and Directories COP 3353 Introduction to UNIX.
BIF713 File and Directory Management. File System A File System is a structure used to organize programs and data on a computer ’ s storage device Files.
UNIX File System By Vishal Desai. Introduction Basic purpose of file system: Represent and organize the system resources. But UNIX File System also maps.
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.
A Brief Overview of Unix Brandon Bohrer. Topics What is Unix? – Quick introduction Documentation – Where to get it, how to use it Text Editors – Know.
Chapter Linux Basics. Acknowledgements This presentation was prepared by – Banyat Settapanich – Bahran Madaen This presentation will be updated later.
UNIX file systems Learning Objectives: 1. To understand the basics of file systems 2. To understand the hierarchical structure in Unix file system 3. To.
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.
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 Zhengli Zhu, School of Life Sciences. Outline 1. ABC of Linux 2. Basic orers of Linux 3. Bash Programming.
ORAFACT The Linux File System. ORAFACT Filesystem Support Support for dozens of filesystem types including: Minix, ext2, MS-DOS, UMSDOS, VFAT, NTFS, NFS,
Linux Administration – Finding You Way on the Command Line The Linux File Directory or Tree.
Linux Filesystem Management
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 101 Training Module Linux Basics.
Linux file system "On a UNIX system, everything is a file;
C151 Multi-User Operating Systems
Exploring the UNIX File System and File Security
Module 6 Working with Files and Directories
Lab 2: Terminal Basics.
Chapter 4: The Linux Filesystem
January 26th, 2004 Class Meeting 2
Presentation transcript:

Linux file system "On a UNIX system, everything is a file; if something is not a file, it is a process." Sorts of files (on a Linux system) Directories: files that are lists of other files. Special files: the mechanism used for input and output. Most special files are in /dev. Links Sockets and Named pipes: files are used to pass information between applications amongst other applications

The -l option to ls displays the file type File types in a long list Symbol Meaning - Regular file d Directory l Link c Special file s Socket p Named pipe

File system layout / binetc dev bootproc mnt usrlib homesbinroot optvartmp

each subdirectory of root have special roles(By tradition): /bin: executable commands /sbin: sys adm commands /etc: system configuration files /lib shared libraries /dev peripheral devices /tmp temporary files /mnt to mount external devices /var Storage for all variable files and temporary files created by users, such as log files /proc system information /usr/bin further exe files /usr/sbin further system-important exe files /usr/lib further libraries User-installed programs typically go under the /usr/local hierarchy

The df command ~]$ df -h Using the df command with a dot (.) as an option shows the partition the current directory belongs to, ~]$ df -h.

In a file system, a file is represented by an inode, a kind of serial number containing information about the actual data that makes up the file: to whom this file belongs, and where is it located on the hard disk. The file system in reality use ls -i to disply indoe numbers

Orientation in the file system The PATH environment variable lists those directories in the system where executable files can be found ~]$ echo $PATH The which command Linux searches for required program in paths and as soon as a match is found, the search is stopped The export command The env command

Absolute and relative paths A path, which is the way you need to follow in the tree structure to reach a given file, can be described as starting from the trunk of the tree (the / or root directory). In that case, the path starts with a slash and is called an absolute path In the other case, the path doesn't start with a slash and confusion is possible between ~/bin/wc (in the user's home directory) and bin/wc in /usr. Paths that don't start with a slash are always relative. In relative paths we also use the. and.. indications for the current and the parent directory ~ means usr home directory

Manipulating files more about ls ls -l ls -ltr In most UNIX commands, options can be combined Color ls default color scheme Color File type blue directories red compressed archives white text files pink images cyan links yellow devices green executables flashing red broken links

Crating and deleting files and directories nautilus: The default file manager in Gnome, the GNU desktop. konqueror: The file manager typically used on a KDE desktop. mc: Midnight Commander, the Unix file manager

mkdir mkdir -p : creating directories and subdirectories in one step creating directories ~]$ mkdir ~]$ mkdir -p project/iut/1

Copying files with cp -i, interactively prompt before overwriting files -R, -r, --recursive copy directories recursively Moving Files with mv mv can rename files or directories, or move them to different directorie s -f, force overwrite, even if target already exists -i, ask user interactively before overwriting files

Deleting Files with rm -f, delete write-protected files without prompting -i, interactive ask the user before deleting files -r, recursively delete files and directories There is no recycle bin in shell so s file is really gone when you use rm

Finding Files with locate The locate command is a simple and fast way to find files The locate command searches a database of filenames The database needs to be updated regularly Usually this is done automatically with cron But locate will not find files created since the last update Options: -i option makes the search case-insensitive -r treats the pattern as a regular expression, rather than a simple string

Finding Files More Flexibly: find find name ~]$ find. -name test find. size +5000k ~]$

The grep command The diff command

File Security Owner r w x Group r w x Others r w x d.= file d= directory l= link File type Execute Write Read

Each type of permission is assigned a access mode code: read = 4 or r write = 2 or w execute = 1 or x User group codes user = u group= g others= o

The chmod command The id command Print information for USERNAME, or the current user. Operation + add - remove = set exactly

Before: -rwxr-xr-x archive.sh Command: chmod o=r archive.sh After: -rwxr-xr-- archive.sh Before: -rw-r----- topsecret.inf Command: chmod g= topsecret.inf After: -rw topsecret.inf Before: -rw-r--r-- publicity.html Command: chmod og=rw publicity.html After: -rw-rw-rw- publicity.html

$ ls -l test_file -rw-r--r-- 1 eric users $ chmod o-r test_file $ ls -l test_file -rw-r eric users $ chmod g+wx test_file $ ls -l test_file -rw-rwx--- 1 eric users $ chmod u=rw,g=r,o=r test_file -rw-r--r-- 1 eric users For changing file permissions in directory trees use -R. $ chmod -R g-w test_dir

The permission numbers are determined by adding the values of the allowed permissions: 7 = read + write + execute 6 = read + write (but not execute) 5 = read + execute (but not write) 3 = write + execute (but not read) 4 = read (but not write and execute) 2 = write (but not read or execute) 1 = execute (but not read or write) $ chmod 754 test_file -rwxr-xr-x 1 eric users Owner = = 7 Group = = 5 World = 4 = 4

The newgrp, chown and chgrp commands