SA1-CHAPTER-3
SA1-CHAPTER-3
1- Describing Linux File System Hierarchy Concept ===== pwd, echo, cd,
cd.. cd., cd../..
2- Describing Linux File System Hierarchy Concepts ===== cd ~, touch, ls, la -l,
ls -lr, ls
================================================================================
All files on a Linux system are stored on file systems, organized into a
single inverted tree of directories, known as a file-system hierarchy.
This tree is inverted because the root of the tree is said to be at the
top of the hierarchy, and the branches of directories and subdirectories, below the
root.
The / directory is the root directory at the top of the file-system hierarchy.
The / character is also used as a directory separator in file names.
================================================================================
The /usr Installed software, shared libraries, include files, and read-only program
data.
[root@JAVED Desktop]# ls
Data Test.txt
================================================================================
##########: / :##########
• It is the default mount Point for Removable Storage media such as cdrom / dvd
and Pendrive, etc.
================================================================================
• Runtime data for processes started since the last boot. This includes
process ID files and lock files, among other things. The contents of this
directory are recreated on reboot.
[root@JAVED ~]# df
(Check Disk Free)
tmpfs 184380 1168 183212 1% /run/user/42
/dev/sr0 8238560 8238560 100% /run/media/root/RHEL-8-2-0-BaseOS-x86_64
• A world-writable space for temporary files. Files which have not been
accessed, changed,
or modified for 10 days are deleted from this directory automatically.
• Another temporary directory exists, /var/tmp, in which files that have not
been accessed,
changed, or modified in more than 30 days are deleted automatically.
The path of a file or directory specifies its unique file system location.
The working directory or current working directory refer to their current location.
A relative path identifies a unique file, specifying only the path necessary to
reach the file from the working directory. A path name with anything other than a
forward slash as the first character is a relative path name.
[root@JAVED ~]# ls
(List Directory)
Data Desktop Downloads Videos
The pwd command displays the full path name of the current working directory for
that shell.
Directory
Root User :- /root
Regular User :- /home
================================================================================
-p, --parents == no error if the directory exist, make parent directories as need
-v, --verbose == print a message for each created directory
-r :- Recursive
-v :- Verbose
-f :- Forcefully
The RMDIR command only removes the directory that is empty.
The rm -d (which is equivalent to rmdir), or rm –r
The ls command lists directory contents for the specified directory or,
if no directory is given, for the current working directory.
The cd Options:===========
echo Command is use for Print Text, String, Variable. Mostly use in Shell
Scripting.
The cp command copies a file, creating a new file either in the current
directory or in a specified directory. It can also copy multiple files to a
directory.
The cp options:=====
-r :- Recursive ( To Copy the Directory Along with its Content)
-v :- Verbose
-f :- Forcefully
-p :- Copy with Permission
[root@ JAVED Desktop]# ls (List
Directory)
Hr Marketing Notes
SoftLink Link ID :- 1
Hardlink Link ID :- 2
Every file starts with a single hard link, from its initial name to the data
on the file system. Create a new hard link to a file, you create another name
that points to that same data. The new hard link acts exactly like the original
file name. Once created, you cannot tell the difference between the new hard link
and the original name of the file. It reports is each file's link count, the number
of hard links the file has. Use the ln command to create a new hard link (another
name)
that points to an existing file. The command needs at least two arguments, a path
to the existing file, and the path to the hard link that you want to create.
If you want to find out whether two files are hard links of each other, one way
is to use the -i option with the ls command to list the files' inode number.
Note:-
All hard links that reference the same file will have the same link count,
access permissions, user and group ownerships, time stamps, and file content.
Each hard link points to the same data on the storage device.
Even if the original file gets deleted, the contents of the file are still
available as long as at least one hard link exists.
Data is only deleted from storage when the last hard link is deleted.
[root@JAVED ~]# echo "This is a Sample File for Hard Link" >File01.txt
[root@JAVED ~]# cat File01.txt (To Check
File Content)
This is a Sample File for Hard Link
[root@JAVED ~]# ls (List
Directory)
File01.txt
[root@JAVED ~]# ln File01.txt Hard_File01.txt (Create Hard Link)
[root@JAVED ~]# ll
(List Directory)
-rw-r--r--. 2 root root 36 Dec 19 14:58 File01.txt
-rw-r--r--. 2 root root 36 Dec 19 14:58 Hard_File01.txt
The ln -s command creates a soft link, which is also called a "symbolic link."
A soft link is not a regular file, but a special type of file that points to
an existing file or directory. Soft links have some advantages over hard links:
Can link two files on different file systems. Can point to a directory or
special file, not just a regular file.
When the original regular file gets deleted, the soft link will still point
to the file but the target is gone. A soft link pointing to a missing file
is called a "dangling soft link."
Note:-
One side-effect of the dangling soft link in the preceding example is that if
you later create a new file with the same name as the deleted file
(/home/user/newfilelink2.txt), the soft link will no longer be "dangling" and
will point to the new file.
If you delete a hard link and then use normal tools (rather than ln) to
create
a new file with the same name, the new file will not be linked to the old
file.
Note:-If You Want to Create Softlink in Desktop Then you have to go Desktop
Frist
==================================Completed=====================================