UNIX - FILE SYSTEM BASICS



Similar documents
An Introduction to the Linux Command Shell For Beginners

EXPLORING LINUX KERNEL: THE EASY WAY!

Linux Overview. The Senator Patrick Leahy Center for Digital Investigation. Champlain College. Written by: Josh Lowery

Unix/Linux Forensics 1

CS 103 Lab Linux and Virtual Machines

Linux System Administration

Two Parts. Filesystem Interface. Filesystem design. Interface the user sees. Implementing the interface

Linux System Administration on Red Hat

USEFUL UNIX COMMANDS

Fred Hantelmann LINUX. Start-up Guide. A self-contained introduction. With 57 Figures. Springer

LECTURE-7. Introduction to DOS. Introduction to UNIX/LINUX OS. Introduction to Windows. Topics:

System administration basics

CSIL MiniCourses. Introduction To Unix (I) John Lekberg Sean Hogan Cannon Matthews Graham Smith. Updated on:

TELE 301 Lecture 7: Linux/Unix file

Command Line - Part 1

RocketRAID 2640/2642 SAS Controller Ubuntu Linux Installation Guide

Creating a Cray System Management Workstation (SMW) Bootable Backup Drive

Thirty Useful Unix Commands

1 Basic commands. 2 Terminology. CS61B, Fall 2009 Simple UNIX Commands P. N. Hilfinger

USB 2.0 Flash Drive User Manual

RocketRAID 174x SATA Controller Ubuntu Linux Installation Guide

LSN 10 Linux Overview

Restoring a Suse Linux Enterprise Server 9 64 Bit on Dissimilar Hardware with CBMR for Linux 1.02

Unix Sampler. PEOPLE whoami id who

Unix for the Beginning Mage. A Tutorial by Joe Topjian

Kernel. What is an Operating System? Systems Software and Application Software. The core of an OS is called kernel, which. Module 9: Operating Systems

HDFS File System Shell Guide

2. Boot using the Debian Net Install cd and when prompted to continue type "linux26", this will load the 2.6 kernel

Abstract. Microsoft Corporation Published: August 2009

HARFORD COMMUNITY COLLEGE 401 Thomas Run Road Bel Air, MD Course Outline CIS INTRODUCTION TO UNIX

File System Shell Guide

Command-Line Operations : The Shell. Don't fear the command line...

Hadoop Shell Commands

Hadoop Shell Commands

Command Line Crash Course For Unix

Lab 2 : Basic File Server. Introduction

Data storage, backup and restore

Lab 1: Introduction to the network lab

Redundant Array of Inexpensive/Independent Disks. RAID 0 Disk striping (best I/O performance, no redundancy!)

On Disk Encryption with Red Hat Enterprise Linux

WES 9.2 DRIVE CONFIGURATION WORKSHEET

"EZHACK" POPULAR SMART TV DONGLE REMOTE CODE EXECUTION

How To Use The Librepo Software On A Linux Computer (For Free)

An A-Z Index of the Apple OS X command line (TERMINAL) The tcsh command shell of Darwin (the open source core of OSX)

Training Day : Linux

Make a Bootable USB Flash Drive from the Restored Edition of Hiren s Boot CD

ICS 351: Today's plan

Introduction to Linux and Cluster Basics for the CCR General Computing Cluster

LPI certification 101 exam prep, Part 1

Chapter 12 File Management

Module 2: File Systems and Management

BackTrack Hard Drive Installation

Planning for an Amanda Disaster Recovery System

Recovering Data from Windows Systems by Using Linux

Introduction to AIX 6L System Administration Course Summary

Notes for Installing RedHawk 6.3 with Red Hat Enterprise Linux 6.3. Installation Notes. November 6 th, 2014

How you configure Iscsi target using starwind free Nas software & configure Iscsi initiator on Oracle Linux 6.4

Btrfs and Rollback How It Works and How to Avoid Pitfalls

Extreme computing lab exercises Session one

Linux command line. An introduction to the Linux command line for genomics. Susan Fairley

This is when a server versus a workstation is desirable because it has the capability to have:

HTTP-FUSE PS3 Linux: an internet boot framework with kboot

Computer forensic science

UNIX Basics. Ian Darwin TCP Informatics January, Presented from a Mac using Apple s Keynote presentation software

File Systems Management and Examples

INF-110. GPFS Installation

An Introduction to Using the Command Line Interface (CLI) to Work with Files and Directories

Installing MooseFS Step by Step Tutorial

HP-UX System and Network Administration for Experienced UNIX System Administrators Course Summary

The Linux Virtual Filesystem

Recovering Data from Windows Systems by Using Linux

Installing a USB external hard drive backup (Linux)

Windows OS File Systems

Setting up Radmind For an OSX Public Lab

Open Source Computational Fluid Dynamics

Unix Guide. Logo Reproduction. School of Computing & Information Systems. Colours red and black on white backgroun

Tutorial 0A Programming on the command line

CPSC2800: Linux Hands-on Lab #3 Explore Linux file system and file security. Project 3-1

Computer Forensics Principles and Practices

Linux System Administration

Setup software RAID1 array on running CentOS 6.3 using mdadm. (Multiple Device Administrator) 1. Gather information about current system.

Installing VMware Tools on Clearswift v4 Gateways

HP-UX Essentials and Shell Programming Course Summary

CPSC 2800 Linux Hands-on Lab #7 on Linux Utilities. Project 7-1

Know Your Enemy: A Forensic Analysis

Setting up an OpenBSD Firewall in the ASU Environment Installation

Open Source Encrypted Filesystems for Free Unix Systems

INTRODUCTION. Version 6c, May 16 th, updated numbering of Figures 28, Deleted: March

New Lab Intro to KDE Terminal Konsole

Introduction to the UNIX Operating System and Open Windows Desktop Environment

User Manual for Data Backups

UNIX / Linux commands Basic level. Magali COTTEVIEILLE - September 2009

Transcription:

http://www.tutorialspoint.com/unix/unix-file-system.htm UNIX - FILE SYSTEM BASICS Copyright tutorialspoint.com A file system is a logical collection of files on a partition or disk. A partition is a container for information and can span an entire hard drive if desired. Your hard drive can have various partitions which usually contains only one file system, such as one file system housing the / file system or another containing the /home file system. One file system per partition allows for the logical maintenance and management of differing file systems. Everything in Unix is considered to be a file, including physical devices such as DVD-ROMs, USB devices, floppy drives, and so forth. Directory Structure Unix uses a hierarchical file system structure, much like an upside-down tree, with root / at the base of the file system and all other directories spreading from there. A UNIX filesystem is a collection of files and directories that has the following properties It has a root directory / that contains other files and directories. Each file or directory is uniquely identified by its name, the directory in which it resides, and a unique identifier, typically called an inode. By convention, the root directory has an inode number of 2 and the lost+found directory has an inode number of 3. Inode numbers 0 and 1 are not used. File inode numbers can be seen by specifying the -i option to ls command. It is self contained. There are no dependencies between one filesystem and any other. The directories have specific purposes and generally hold the same types of information for easily locating files. Following are the directories that exist on the major versions of Unix Directory / This is the root directory which should contain only the directories needed at the top level of the file structure. /bin /dev /etc /lib /boot /home /mnt /proc /tmp /usr This is where the executable files are located. They are available to all user. These are device drivers. Supervisor directory commands, configuration files, disk configuration files, valid user lists, groups, ethernet, hosts, where to send critical messages. Contains shared library files and sometimes other kernel-related files. Contains files for booting the system. Contains the home directory for users and other accounts. Used to mount other temporary file systems, such as cdrom and floppy for the CD-ROM drive and floppy diskette drive, respectively Contains all processes marked as a file by process number or other information that is dynamic to the system. Holds temporary files used between system boots Used for miscellaneous purposes, or can be used by many users. Includes administrative commands, shared files, library files, and others

/var /sbin /kernel Typically contains variable-length files such as log and print files and any other type of file that may contain a variable amount of data Contains binary executable files, usually for system administration. For example fdisk and ifconfig utlities. Contains kernel files Navigating the File System Now that you understand the basics of the file system, you can begin navigating to the files you need. The following are commands you'll use to navigate the system Command cat filename cd dirname cp file1 file2 file filename find filename dir head filename less filename ls dirname mkdir dirname more filename mv file1 file2 pwd rm filename rmdir dirname tail filename touch filename whereis filename which filename Displays a filename. Moves you to the directory identified. Copies one file/directory to specified location. Identifies the file type binary, text, etc. Finds a file/directory. Shows the beginning of a file. Browses through a file from end or beginning. Shows the contents of the directory specified. Creates the specified directory. Browses through a file from beginning to end. Moves the location of or renames a file/directory. Shows the current directory the user is in. Removes a file. Removes a directory. Shows the end of a file. Creates a blank file or modifies an existing file.s attributes. Shows the location of a file. Shows the location of a file if it is in your PATH. You can use Manpage Help to check complete syntax for each command mentioned here. The df Command The first way to manage your partition space is with the df diskfree command. The command df -k diskfree displays the disk space usage in kilobytes, as shown below df -k Filesystem 1K-blocks Used Available Use% Mounted on /dev/vzfs 10485760 7836644 2649116 75% / /devices 0 0 0 0% /devices

Some of the directories, such as /devices, shows 0 in the kbytes, used, and avail columns as well as 0% for capacity. These are special orvirtual file systems, and although they reside on the disk under /, by themselves they do not take up disk space. The df -k output is generally the same on all Unix systems. Here's what it usually includes Column Filesystem kbytes used avail capacity Mounted on The physical file system name. Total kilobytes of space available on the storage medium. Total kilobytes of space used byfiles. Total kilobytes available for use. Percentage of total space used by files. What the file system is mounted on. You can use the -h humanreadable option to display the output in a format that shows the size in easier-to-understand notation. The du Command The du diskusage command enables you to specify directories to show disk space usage on a particular directory. This command is helpful if you want to determine how much space a particular directory is taking. Following command would display number of blocks consumed by each directory. A single block may take either 512 Bytes or 1 Kilo Byte depending on your system. du /etc 10 /etc/cron.d 126 /etc/default 6 /etc/dfs... The -h option makes the output easier to comprehend du -h /etc 5k /etc/cron.d 63k /etc/default 3k /etc/dfs... Mounting the File System A file system must be mounted in order to be usable by the system. To see what is currently mounted availableforuse on your system, use this command mount /dev/vzfs on / type reiserfs (rw,usrquota,grpquota) proc on /proc type proc (rw,nodiratime) devpts on /dev/pts type devpts (rw) The /mnt directory, by Unix convention, is where temporary mounts suchascd ROMdrives, remotenetworkdrives, andfloppydrives are located. If you need to mount a file system, you can use the mount command with the following syntax

mount -t file_system_type device_to_mount directory_to_mount_to For example, if you want to mount a CD-ROM to the directory /mnt/cdrom, for example, you can type mount -t iso9660 /dev/cdrom /mnt/cdrom This assumes that your CD-ROM device is called /dev/cdrom and that you want to mount it to /mnt/cdrom. Refer to the mount man page for more specific information or type mount -h at the command line for help information. After mounting, you can use the cd command to navigate the newly available file system through the mountpoint you just made. Unmounting the File System To unmount remove the file system from your system, use the umount command by identifying the mountpoint or device For example, to unmount cdrom, use the following command umount /dev/cdrom The mount command enables you to access your file systems, but on most modern Unix systems, the automount function makes this process invisible to the user and requires no intervention. User and Group Quotas User and group quotas provide the mechanisms by which the amount of space used by a single user or all users within a specific group can be limited to a value defined by the administrator. Quotas operate around two limits that allow the user to take some action if the amount of space or number of disk blocks start to exceed the administrator defined limits Soft Limit If the user exceeds the limit defined, there is a grace period that allows the user to free up some space. Hard Limit When the hard limit is reached, regardless of the grace period, no further files or blocks can be allocated. There are a number of commands to administer quotas Command quota edquota quotacheck setquota quotaon quotaoff repquota Displays disk usage and limits for a user of group. This is a quota editor. Users or Groups quota can be edited using this command. Scan a filesystem for disk usage, create, check and repair quota files This is also a command line quota editor. This announces to the system that disk quotas should be enabled on one or more filesystems. This announces to the system that disk quotas should be disabled off one or more filesystems. This prints a summary of the disc usage and quotas for the specified file systems

You can use Manpage Help to check complete syntax for each command mentioned here. Loading [MathJax]/jax/output/HTML-CSS/jax.js