Wednesday, 19 June 2013

Unix - File System Basics

Linux file hierarchy System

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:
DirectoryDescription
/This is the root directory which should contain only the directories needed at the top level of the file structure.
/binThis is where the executable files are located. They are available to all user.
/devThese are device drivers.
/etcSupervisor directory commands, configuration files, disk configuration files, valid user lists, groups, ethernet, hosts, where to send critical messages.
/libContains shared library files and sometimes other kernel-related files.
/bootContains files for booting the system.
/homeContains the home directory for users and other accounts.
/mntUsed to mount other temporary file systems, such as cdrom and floppy for the CD-ROM drive and floppy diskette drive, respectively
/procContains all processes marked as a file by process number or other information that is dynamic to the system.
/tmpHolds temporary files used between system boots
/usrUsed for miscellaneous purposes, or can be used by many users. Includes administrative commands, shared files, library files, and others
/varTypically contains variable-length files such as log and print files and any other type of file that may contain a variable amount of data
/sbinContains binary (executable) files, usually for system administration. For example fdisk and ifconfig utlities.
/kernelContains 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:
CommandDescription
cat filenameDisplays a filename.
cd dirnameMoves you to the directory identified.
cp file1 file2Copies one file/directory to specified location.
file filenameIdentifies the file type (binary, text, etc).
find filename dirFinds a file/directory.
head filenameShows the beginning of a file.
less filenameBrowses through a file from end or beginning.
ls dirnameShows the contents of the directory specified.
mkdir dirnameCreates the specified directory.
more filenameBrowses through a file from beginning to end.
mv file1 file2Moves the location of or renames a file/directory.
pwdShows the current directory the user is in.
rm filenameRemoves a file.
rmdir dirnameRemoves a directory.
tail filenameShows the end of a file.
touch filenameCreates a blank file or modifies an existing file.s attributes.
whereis filenameShows the location of a file.
which filenameShows the location of a file if it is in your PATH.

13 comments:

  1. Thanks for sharing this informative blog on Linux Training . If you are still in doubt, whether to take the plunge or not. Here are few points that might change your opinion! Also UrbanPro.com Help you by connecting you to the best Linux Training Classes in your locality
    Visit link below For more www.urbanpro.com/linux-training?_r=offpage
    “ Guitar Classes ”

    ReplyDelete
  2. Thanks for sharing this informative blog on Linux Training . If you are still in doubt, whether to take the plunge or not. Here are few points that might change your opinion! Also UrbanPro.com Help you by connecting you to the best Linux Training Classes in your locality
    Visit link below For more www.urbanpro.com/linux-training?_r=offpage
    “ Guitar Classes ”

    ReplyDelete
  3. Thanks for sharing this information You may also refer http://www.s4techno.com/linux-administration-training-online/ for more information…

    ReplyDelete
  4. Excellent and very cool idea and the subject at the top of magnificence and I am happy to this post. Interesting post! Thanks for writing it.
    linux training in india

    ReplyDelete
  5. Very useful details provided by you. I hope it would be useful for many of the seekers. Thank you for sharing details here with us.
    Home tutors are provided by TheTuitionTeacher in Delhi.
    Home Tutors in Delhi | Home Tuition service



    ReplyDelete
  6. Thanks for sharing this informative blog on unix file system basics.
    linux training in mumbai
    linux course in mumbai

    ReplyDelete
  7. APTRON has designed its RHCE training for IT professional and wannabes who seek to achieve practical skills of networking and security administration. Our RHCE training project is armed with the faculties who are IT professional with more 10 year experience in core area and filled with technical knowledge and real world experience with the significant spotlight on practical knowledge with the end goal of giving required skills to a Linux administrator's job assignments.
    For More Info:- Linux Training in Gurgaon

    ReplyDelete
  8. Great post. Thanks for sharing such a useful information. Linux training

    ReplyDelete
  9. Everyone participating in anything has to start somewhere, Best Architecture services in kanpur in this industry you will undoubtedly start small and if you put time and effort into your blog you may become successful. Most small time bloggers will use free blog hosting services and this I think is a great platform for inexperienced bloggers and people whom are trying to get a feel of how the Photo background removal services company whole blog industry and system works

    With an independent blog website development company kanpur site you must have paid hosting, knowledge of scripts and plugins etc in order to provide a decent platform for your blog audience whereas here you can put your sole focus onto providing top quality content and all the back Photo Clipping path services company end technical stuff is covered.

    The main advantages of having a free blog hosting Thetodaytalk.com service is that if your blog does not become popular or successful you have not lost out. No costs incurred apart from the time you invested into writing the content.

    ReplyDelete