Linux 2
Linux 2
*In file system you can find : processes , serial ports, kernel,
interprocess communication channels , devices.
Lab 3 *There are also other file systems : tmpfs, devtmpfs, squashfs
* *
*File system is composed of smaller parts – also called file systems . Understanding The File System Tree
*Each file system consists of one directory and its subdirectories and hierarchical directory structure - a tree-like pattern of directories
files. root directory - first directory in the file system
a single file system tree - regardless of how many drives or storage
*Overall layout of the file system is called file tree representing the devices are attached to the computer.
single unified hierarchy that starts at the root directory / Storage devices are attached (mounted) at various points on the
tree.
*File systems are attached to the tree with mount command and are home directory – for each user
detached with the unmount command.
Example: # mount /dev/hda4 /users
The example installs the file system stored on the disk partition hda4 under the path
/users.
*A list of all mounted file systems is kept in /etc/fstab file.
*
* Pathname – the list of directories that must be traversed to locate a *
particular file together with its filename
* Pathnames can be
- absolute – start with the root (/) directory
*All files have one physical format – a byte stream.
- relative – start at the current directory
*This allows Linux to apply the file concept to every data
component in the system – directories, devices.
Relative pathnames always provide directions from the
current directory. *The command file determines what is the file about.
To refer to one directory above current directory, use
the .. characters
It examines the first few lines of the file and classifies
To refer to the current directory, use the . character it.
$ file /etc/fstab
/etc/fstsb/: ASCII text
$ file monday
monday: text
$ file reports
reports: directory
me@linuxbox ~$ less /etc/passwd examine the file that *They all have a period(.) before their filenames.
defines all the system's user accounts
*Any filename that ends with a tilde(~) symbol (the
same symbol that indicates your /home directory at the command
If the file is longer than one page, we can scroll up and line) does not appear in the file-browsing windows or
down. on the desktop. These files are backup files.
To exit less, press the “q” key.
*Gedit creates backup copies of edited files , so if you
cat filename(s) – outputs the contents of the file(s) directly to save the modifications but later you want the original
the standard output file, you will find it by its filename with ~ at the end.
more filename(s)- displays file(s) screen by screen. Use <┘to
continue to the next screen and q to quit. Can not be used to *ls –a displays all filenames ,even invisible ones.
scroll backward.
* *
* find - searches directories for files according to search criteria
*mkdir directory_name - creates a directory * cp source destination – copies the source file into a
*rmdir directory_name - erases an empty destination file. If the destination file exists with another contents ,
it will be destroyed and new file with that name will be created.
directory There are two copies of the source file.
*rm -r directory_name – erases non empty * mv filename1 filename2 - moves(renames) a file. Moves
directory filename1 to filename2(directory or a new filename). There is one
copy of the filename1.
*cd directory_name - changes to a directory
* rm filename(s) - removes(erases) a file(s)
*cd .. – references the parent directory of the * sort filename(s) - sort lines of text files
current one.
*Changing user and group with chown and chgrp by the owner
of the file or the administrator.
* *
Octal and symbolic permissions.
Permissions apply to the user, the group and to others. An item has a set of 3
grouped permissions for each of these categories.
The standard permission
UNIX system create files and directories with standard permissions as follows:
Standard permission for:
Files 666 -rw-rw-rw-
Directories 777 -rwxrwxrwx
How to read a 755 or -rwxr-xr-x permission
*
* Manipulating Files And Directories
* Star Wildcard (*) - represents any set of characters
* Question Mark Wildcard (?) - could be any single character Wildcards (globbing) - allow you to select filenames based on
patterns of characters.
* Square Brackets Wildcard ([ ]) - represents any of the characters in
the brackets
* Examples:
ls *.html *. text
ls data?. text
file a[xyz]code.text
file ? ?? ???