Fundamentals 1st Module
Fundamentals 1st Module
=> deleting : [dd] it will delete single line how much line want to
delete we use “3dd” for 3 lines ll “x” to delete single word
=> copy paste lines ; [yy] to copy line and [p] for paste
=> searching : [/wat to search] “n” will select next and “shift
n” will select back
2 = vim : -
softlink:
Think of a soft link as a pointer to a book in a library. The pointer contains
the book's title, author, and location in the library, but it doesn't contain the
actual book. When you use a soft link, you're essentially saying, "Hey, I want
to read this book, but I don't want to carry it around with me. Can you just
give me a pointer to where it's located in the library?"
>> Advantages
1 = easy to access
2= can cross partitions && can be created over directory
>> Disadvantages
=> If parren file is deleted the child is also deleted
Command
[ ln -s /path of which want to make symlink of /path where want to
makeit]
Recognition : -
1 = Through arrow in ‘“ls” ’ “- >”
2 = different inode no
Note :
=> We can also make shortcut of any command
=> 1st we look for , from where it comes or location of that command
with “which” command then can make shortcut of that command with
any other name
3
hard link
A hard link, on the other hand, is like a photocopy of the book. It contains the
same information as the original book, but it's a separate physical copy.
When you use a hard link, you're essentially saying, "Hey, I want to read this
book, and I also want to have a copy of it that I can carry around with me."
>> Advantages
1 = type of backup
2 = if parrent is deleted no impact on child
>> Disadvantages
Cannot cross partitions & cannot be created by over directory
Command
[ ln /path of which want to make symlink of /path where want to makeit]
Bt it will not cross the dir or partition as well
Recognition : -
1 = Through blue or any color shade or counts seen in permission portion
of file
2 = and we can also check with inode no it must be same as parent
inode no [ ls -i /path of file ]
3 = same inode no
—---------------------------------------------------------------
===>> Cp and mv :
A = Cp :
5 = (cent 7 ) = owner
6 = (cent 7) = group name
7 = (3) = size in bytes
8 = (may 10 08:04 ) =accestime
9 = (filename) = (filename)
>r=4
>w=2
>x=1
NOTE:
We can use command [chmod -Rv 777 /path]
> If we want to give permission to all files or directory by 1 command
6
===>>>CHATTR:
WE use this command on files which are important and we
dont want to access it to someone else other than root
===>>
> [chattr +i /path of file which u want inaccessible by other]
> [chattr -i /path of file which u want inaccessible by other]
> (+) to add immutability or chattr commands funtion
> (-) to sub immutability or chattr commands funtion
6 = reboot
## Total terminals :
Runlevel 5 : Gnome terminal = approx 400
Runlevel 3 cli (virtual console) = 6 terminals (can switch with
“alt + f1,f2…f6”)
##>> general :
1 = power on or reboot
2 = press any key at splash screen
3 = now read the text there which key is to press for modification the
kernel arguments
4 =editing or adding lines there
==>># PARTITIONS
Hard
disk
partition
>> COMMANDS:
<—----------------------------------------------------->
10
== >>## REDIRECTION
=># “gzip” is commonly used for fast speed, and smaller files
⇒ ## “bzip2” is for higher compression and used for larger files to
compress
<—---------------------------------------------------------------->
=>## zip
=>## zip command 1st compress file then place it in given file
=>## tar:
Gzip bzip2
[tar -zcvf - - -] [tar -jcvf - - -]
< —-------------------------------------------------------->
=>>>## RSYNC
>>> it see the modify time of source and if find any changes in source
file it will copy just the modified content not already copied content again
( after running command “rsync -avz <path(from)> <path(to)>” )
Change in
owner &
>>##
<------------------------------------------------------------------------->
>> we can make more when make one of them “extended” and these
partition which is made in extended is called “logical partitions” and
these are “63” in no
>>
hard disk
4 primary partition
< —------------------------------------------------------->
=>## FSCK
> file system check & repair
>> to check file system [ df -Th ]
>> [ badblocks -v /dev /sdX ] to check for badblocks within
partition or filesystem
>> if find any badblocks then we do clean it with [ fsck /dev /sdX ] or
the advance one [ e2fsck /dev /sdX ] and to check complete details
[ e2fsck -yc /dev /sdX ]
> bt it is must to unmount the partition 1st then run this
command
15
>> there are 6 fields in fstab in which the 6 th one is for “fsck”
>>$ in fstab “4th” field is for permission like [ defaults,ro ] > it will not
allow us to write or execute in that folder or partition for which we set
these seting
<-- —------------------------------------------------------------------->
16
=>$## PIPE
$#>> grep
>> to catch specific files or word from a long list [ grep
gdm /etc /passwd ]
> if want to see with highlighted so for this [ grep - -color
“gdm” /etc /passwd ]
>> [ ls /etc / * | grep -i host ] it will grep files which contain
name “host”
> [ ls /etc / * | grep -i host | wc -l ] > will count lines
“wc -l” as well
<
—------------------------------------------------------------------------ >
$#>> find (its good command find 15 examples
for that)
>> [ find /etc / -iname <hosts* (filename)> ] > to find
files name with “hosts”
> [ find /etc / -iname < “*.txt” > ] > it wil find files
ends with .txt
>> it is little bit slow when want to find things in full OS bcz
for our result find visited all “dir”
1 by 1 and thats y the new files can find with “find”
command bt cant be with “locate”
=>## QUERY:
search 15 examples for each ( find ,ps ,rsync )
>> limit the “forkbombing” search for that
< —----------------------------------------------------------------------->
17
>>## NOTE :
>> performanc monitoring tools :
>> [ top , ps , pstree , lsof ]
>> [ firefox & ] > to run the process in background within the shell
terminal closing can close every thing start with terminal
> [ fg ] > to check the background process
> [ bg ] > as well && [ jobs ]
>> [ echo $$ ] > to see current process
>> [ htop, sar , iostat -> hdd performance check, vmstat, iometer ,
ipref -> NW bandwidth, tcdump ] > performance monitoring tools
>> [ top -n1 > /opt /top.txt ] > we cant copy the output of top
command unless and until we use “-n1” to backup
19