7e4cc7f03998361f1c06203069e97eb6.ppt
- Количество слайдов: 22
Getting Started with Linux Session #1
UNIX History
UNIX Concepts UNIX Structure p Some Basic Commands p UNIX File System p Files: permissions, properties, manipulation p Principal Linux Files p
Topics
Some Basic Commands who, who am i p date p echo p
UNIX Files and File System
UNIX File Tree
Debian Directory Tree
User File Tree
File System Usage p Directories: n n Absolute and relative paths Where I am? - pwd Moving around: cd command () Creating and removing: mkdir, rm -r examples
File System Layout
The ext 2 superblock p Magic Number n p Revision Level n p The number of free blocks in the file system, Free Inodes n p The number of blocks in a group. Like the block size this is fixed when the file system is created, Free Blocks n p The size of the block for this file system in bytes, for example 1024 bytes, Blocks per Group n p The Block Group number that holds this copy of the Superblock, Block Size n p Together these allow the system to determine if the file system should be fully checked. The mount count is incremented each time the file system is mounted and when it equals the maximum mount count the warning message ``maximal mount count reached, running e 2 fsck is recommended'' is displayed, Block Group Number n p The major and minor revision levels allow the mounting code to determine whether or not this file system supports features that are only available in particular revisions of the file system. There also feature compatibility fields which help the mounting code to determine which new features can safely be used on this file system, Mount Count and Maximum Mount Count n p This allows the mounting software to check that this is indeed the Superblock for an EXT 2 file system. For the current version of EXT 2 this is 0 x. EF 53. The number of free Inodes in the file system, First Inode n This is the inode number of the first inode in the file system. The first inode in an EXT 2 root file system would be the directory entry for the '/' directory.
Directory • inode The inode for this directory entry. This is an index into the array of inodes held in the Inode Table of the Block Group • name length The length of this directory entry in bytes, • name The name of this directory entry.
Files Attributes and Manipulation
Simple File Commands ls List the files and directories in the working (current) directory cat File 1 File 2 Display the contents of the file File 1 concatenated with the contents of the file File 2 mv File 1 File 3 Change the name of (move) file File 1 to File 3 cp File 1 File 3 Make a copy of File 1 and call it File 3 rm File 4 Erase (remove) the file File 4 less File 1 Display the contents of File 1 a page at a time, q to stop displaying lpr File 1 Print the contents of File 1 on the default printer
File Types Everything is a file! Type Symbol Created by Removed by regular - cp, editors, etc. rm Directory d mkdir rmdir, rm -r block device file b mknod rm Character device file c mknod rm Named pipe p mknod rm Symbolic link l ln -s rm Unix Domain Socket s socket rm
File Permissions d r w Owner x r w Group x r w x Other Directory Read Write Execute Examples: drwxr-xr-x A folder which has read, write and execute permissions for the owner, but only read . and execute permissions for the group and for other users -rw-rw-rw. A file that can be read and written by anyone, but not executed at all --rw-r--r. A file that can be read and written by the user, but only read by the group and everyone else
Numerical File Permissions Notation Number Read (R) Write (W) Execute (X) 0 No No No 1 No No Yes 2 No Yes No 3 No Yes 4 Yes No No 5 Yes No Yes 6 Yes No 7 Yes Yes Examples: • 777 is the • 755 is the • 666 is the • 744 is the same as as rwxrwxrwx rwxr-xr-x rw-rw-rwrwxr--r--
Displaying File Information
I-node
directory examples cd /usr/local/bin cd. . pwd cd (go to home directory) mkdir //tmp/mydir rmdir /tmp/mydir mkdir /tmp/mydir; cd /tmp/mydir; mkdir one_more_dir rmdir one_more_dir What happens? rm –r one_more_dir
Principal Linux Files File Description /boot/vmlinuz* Linux kernel /etc/fstab Filesystems mounted or available for mounting /etc/hosts Map of IP numbers to hostnames /etc/hosts. allow Hosts allowed to access Internet services /etc/hosts. deny Hosts forbidden to access Internet services /etc/inetd. conf Configuration for the inetd daemon, which controls access to Internet services /etc/inittab Configuration for the init daemon, which controls executing processes /etc/issue Linux kernel and distribution version /etc/passwd User account information /etc/shadow Secure user account information /boot/grub/menu. lst Grub loader configuration file /etc/profile Default environment for users of BASH shell /etc/rc*. d Scripts for system and process startup and shutdown /etc/rc. boot Scripts for system boot /var/log/messages System log