-
Notifications
You must be signed in to change notification settings - Fork 0
/
lpic101.txt
2073 lines (1137 loc) · 57.5 KB
/
lpic101.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#It's Better to Open this document with Notepad++#
###################################################
# LPIC 101-102 #
# Session 1/2 #
###################################################
Linux Important Directory:
0. / : is root of all this Directory
1. bin: Linux User Binary Comma22.nd Like: mv, rm, touch,... .
2. Sbin: super Linux User Binary Command Like: Dhcp, systemctl, service, apt .
3. dev: Device file Exist Here.( Disk, CDrom, Floppy, Flash,...) .
4. Var: Linux Variable File ( Log file, Inbox, Mail,... .
5. tmp: Temporary file is here.
6. boot: Linux Boot file, Boot Loader, Kernel file.
7. etc: Linux Configuration file here.
8. root: root User Home Directory( Diffrent with another user Directory).
9. lib: Linux Library file.
10. lib64: New library and 64bit library file.
11. home: user home directory is here.
12. mnt: mount point of temporary file system.
13. media: Removable media mount this directory.
14. opt: Add-on application software packages.
15. srv: data for service provided by this system.
16. proc: virtual file system documenting kernel and process status as text fil.
17. usr: user file Directory. and every program user setup move to this directory and have many directory like bin, boot, ... .
Notice:For first time when KernelUp all of information and Hardware details recorded on Proc
Basic Commands:
CLI : sommand line Interface / Modernest CLI for Linux is Bash and is default shell.
Note:
1) ls : Shoe list of file ( "dir" in windows)
ls /home
ls / home/ admin
ls / ( show root Directory)
2) pwd: print working Directory
3) mkdir: Make directory
4) cd : Change directory
5) touch : Maked a file to any DIrectory we want. we can make multi file, like: touch m1 m2 m3 m4
6) tree : Show the tree of directory that we are here.
7) rm: Remoce file command
# Note : if you want to delete file in directory we should use -r ( switch) that is recursive switch when you shoul use -f swicht, the kernel force delete file and directory.
8) mkdir -p : that help to use to make panel and tree of file for examle is wrong to use: mkdir /home/A
or use this option you can use thi command: mkdir -p /home/A/b. in fact the command structure is : mkdir <path>/"file or directory name"
9) cp: copy file or director( with -r switch): cp -r <source> <destination>
10) su: switch user
11) hostname : with this command we can change our host name foe examle: hostname sysadmin
the stracture is [ user @ hostname DIR]
# Regular Expression:
1) * : everything
[a-z]* : everything that contains in first letter file name is a to z (lower case)
[a-z][1,2]* : first letter is a to z, second letter is numbers 1 to 2 and after is everything.
[a-z,A-Z][0-9]* : first letter is a-z(lower case) or A-Z(upper case) and second is numbers and after is everything.
2) ; : [Enter] we can do many work in 1 line command, it;s means that we can do multi task in one line.
3) ~ : is home directory and is shourtcut that any user can use this to move on to home dirctory. for examle: cd ~
Notice: we have note rename command, we use move command and choice smae path with new name.
tab : use with tab keyboard key to complete command.
###################################################
# LPIC 101-102 #
# Session 3 #
###################################################
1)fdisk -l : list disk status and get information from disks of pc.
hda : IDE disk
sda : SATA disk
Partitions : Primary Partitionson is primary and extended.
limited of Partions is 4, for solve this problem Extended partions use.
Primary
extended
Logical: Logical created in extended.
CHC: Cylandr Head Sector.
a: Means Disk is primary
b: Means Disk is Secondary.
m: Use for manaul
Sector 0 is 512 MB in 3 part: 1.MBR 2.PT 3.CRC
1. Master Boot Record
2. Partion Table
3. Cheack Health of disk.
2)fdisk /dev/sda
Primary
-Master /dev/sdda
-slave /dev/sddb
Secondary
-Master /dev/sdc
-slave /dev/sdd
Addressing Data on Partition
FAT
NTFS
XFS
JFS
ZFS
EXTENDED FS 2/3/4 (ext2/3/4) (Linux) <===========
Resierfs
btrfs
ISO9660(CDROM)
UDF(DVD)
mkfs : make file system, it means if you want to use partions you should make it as special file system like: ext4. ntfs. fat32, iso, ...
Notice: every block has Address becuse we should read and write files, file system do this act for files and addresses every files locations.
Notice: inode is every blocks thats file locate there.
makfs -t ext4 /dev/sd* : for formating partions and change file system.
#####################Mount/Umount#############################################################################
for mounting Device for use this command:
mount ( show all mounted devices)
mount <Device Files> <mount point>
mount /dev/sdb1 /home/sysadmin/p1
Notice: When device mounte that it have file system.
#for umounting Device for use this command:
umount /dev/sda1 (you should exit from directory and mount it.)
#Mount option:
ro/rw/ noexec
ro: read-only
rw: read-write
noexec: no file can execute.
default is exec and noexec cause no file execute.
-o switch is for choice options of mounting device.
mount -o ro/rw/noexec /dev/sda1 /home/sysadmin/p1
Notice: Linux cannot mount automatically device for automat mounting we should change setting on this directory:
/etc/fstab ( and write details of mounted device on this table)
<file_system> <mount_point> <file_system> <mount_option> <options> <dump> <pass>
======================================================================================================================================
/dev/sdb1(or UUID) /home/sysadmin/p1 ext4 ro,noexec or .. default 0 1
file_system: path of devices decide to mount
UUIDs: UUIDs are generated by the maked file system utilities(mks.*) when you create a file system. blkid will show you of the UUID of mounted devices and portitions.
<dir>: tells the mount command where it should mount the <file system> to.
<type>: defines the file system type of the device or partition to be mounted. Many different file systems are supported. Some examples are: ext2, ext3, reiserfs, xfs, jfs, smbfs, iso9660, vfat, ntfs, swap, and auto. The 'auto' type lets the mount command to attempt to guess what type of file system is used, this is useful for removable devices such as CDs and DVDs.
<options>: define particular options for filesystems. Some options relate only to the filesystem itself. Some of the more common options are:
auto: file system will mount automatically at boot, or when the command 'mount -a' is issued.
noauto: the filesystem is mounted only when you tell it to.
exec: allow the execution binaries that are on that partition (default).
noexec: do not allow binaries to be executed on the filesystem.
ro: mount the filesystem read only.
rw: mount the filesystem read-write.
sync: I/O should be done synchronously.
async: I/O should be done asynchronously.
flush: specific option for FAT to flush data more often, thus making copy dialogs or progress bars to stays up until things are on the disk.
user: permit any user to mount the filesystem (implies noexec,nosuid,nodev unless overridden).
nouser: only allow root to mount the filesystem (default).
defaults: default mount settings (equivalent to rw,suid,dev,exec,auto,nouser,async).
suid: allow the operation of suid, and sgid bits. They are mostly used to allow users on a computer system to execute binary executables with temporarily elevated privileges in order to perform a specific task.
nosuid: block the operation of suid, and sgid bits.
noatime: do not update inode access times on the filesystem. Can help performance.
nodiratime: do not update directory inode access times on the filesystem. Can help performance. You do not need to enable this flag if you have already enabled noatime.
relatime: update inode access times relative to modify or change time. Access time is only updated if the previous access time was earlier than the current modify or change time (similar to noatime, but doesn't break mutt or other applications that need to know if a file has been read since the last time it was modified). Can help performance.
<dump>: is used by the dump utility to decide when to make a backup. When installed, dump checks the entry and uses the number to decide if a file system should be backed up. Possible entries are 0 and 1. If 0, dump will ignore the file system, if 1, dump will make a backup. Most users will not have dump installed, so they should put 0 for the <dump> entry.
<pass>: fsck reads the <pass> number and determines in which order the file systems should be checked. Possible entries are 0, 1, and 2. The root file system should have the highest priority, 1, all other file systems you want to have checked should get a 2. File systems with a <pass> value 0 will not be checked by the fsck utility.
we can use label to locate path devices fo examle:
e2label /dev/<disk-or-partions> <label_name>
### for testing setting of mount table by mount command, mount a device once a time.
Notice: in new kernel with " resize2fs " we can resize lv and add extra size, so:
resize2fs <LV_PATH>
###################################################
# LPIC 101-102 #
# Session 4 #
###################################################
partprobe: this command scan partions and scan all of partions.
Linux LVM Configuration
senario: added 3 disk to primary physical disk: 1-sda: 100GB(IDE) 2-sdc:100gb(SATA) 3-sdd:200G(SATA) 4-sdb:20(linux disk and primary)
so add extra size to LVM Group
#Added extra hard to LV:
Step 0:
fdisk /dev/sda1
from switch "n" create new primary partion with 100GB Capacity. and w to write it.
make primary partion.
set partion number(1-4)
set cylinder or size of disk
after set partitions set this command: partprobe
Step1: create physical volume(s):
1-1 Change Partition System ID to "8e" : becuse "8e" is partion type of linux LVM.
fdisk /dev/sda
change partion with "t" to "8e".
1-2 Create Physical Volume: When we make LV with multi partions, linux devided partions to many little block and numbrize those, so you should explain to linux that which partions are in LV with pvcreate command. for example:
#pvcreate /dev/sda1 /dev/sda2 /dev/sdb5 /dev/sdb6 /dev/sdc1 /dev/sdc2 /dev/sdc5
#pvs : Physical volume show, to show physical volume created
Step2: create volume group(s):
vgcreate <volume_name> <partitions> #for example:
vgcreate vg1 /dev/sda2 /dev/sb1 /dev/sdc1 /dev/hda1
vgs # this command show vgs create
Step 3: Create Logical Volume(s) (LV)
switches: -n: name of lv, -L: lv capacity
#lvcreate -n LV1 -L 20GB VG1
#lvcreate -n LV2 -L 20GB VG1
#lvs
Step 4: Format LVs: for use LVs we should change to fs with mkfs -t <partion_type> <device_path> or
mkfs.<partion_type> <device_path>
#mkfs -t ext3 /dev/VG1/LV1
#mkfs -t ext3 /dev/VG1/LV2
Step 5: Mount LVs
#mount /dev/VG1/LV1 /hamid/lv1
#mount /dev/VG1/LV2 /hamid/lv2
#mount
Step 6: Permanent Mount Point
/etc/fstab
#Notice: for add extra space to LV use this command: lvresize -L + or - Number of Gig <device_path>
#notice: if the space for resize was low you can add hard to linux and create physical volume and make partitons then added to lv with this command:
vgextend <vg_name> <vg_path>
vgextend vg1 /dev/sde1
#####################################################################################################
####################################### SWAP ########################################################
#####################################################################################################
One of basically hardware of a Pc is Memory, and Memory is expensive device.
Swap, help to improve system performance, for expamle when ram get full, system use swap for helping Ram, for example when you set 8Gb ram ang 16Gb ram you can use 24Gb capacity Memory for increase your Performance.
in windows we can set manaully or Automatic set Virtual Memory that do same work as Swap, name is Virtual Memory:
Advanced system / System Properties / performance / Advanced / virtual Memory.
Best Practice: set swap as you need, but every vendor has different plan, for example microsoft set swap capacity as Memory capacity, some vendors say set swap with this plan, Swap: 1.5 or 2 * ram capacity, but it's depend to your work and need.
How to define swap version :
1- fdisk/dev/sdd2 ( make a new partition and set Capacity)
2- set partiton table as swap.
3- make swap file system with mkswap /dev/sd**
4- Attach Swap partion to kernel with "swapon" command: swapon /dev/sd**
5- verify swap space in linux to show whick swap is on wit "-s" switch: swapon -s
6- for Derrach swap from system use command: swapoff
NOtice: Swap not Mounted but it can be permanent.
<file_system> <mount_point> <type> <mount_option> <options> dump pass
===========================================================================================================================
/dev/sd** no swap swap default 0 0
#######################SWAP_FILE#############################################
Notice: Maybe we have not enough Space to create disk, you can choice specific space to your disk then do this steps:
Step 1: Create 1GB File with Specific Capacity that we want Swap file with dd: Convert and copy files
dd if=/dev/zero of=/root/myswap bs=1024 count=1000000
bs: block size count: count of block size
Step 2: Create Swap Space on File
#mkswap /root/myswap
Step 3: Attach Swap into Kernel
#swapon /root/myswap
Note: free -m ---> Show Memory Status
Note: free -m : Show Memory Status and usage
###################################################
# LPIC 101-102 #
# Session 5 #
###################################################
# Linux Run Level:
0 : halt
1 : CLI/No Network/Single User Mode/No Login ---> Tshoot ---> Password Recovery
2 : CLI/No Network/Multi User Mode
3 : CLI/Network/Multi User Mode
4 : -------
5 : GUI/Network/Multi User Mode (Full)
6 : Reboot/Restart
Note: It's difference between runlevels of debian and Red hat.
Debian Base linux Default Runlevel: 5
Redhat base linux Default Runlevel: 2
to show run level of linux use this command: runlevel
to change runlevel use this command: init <number_runlevel> for example for switch to runlevel 3: init 3
############## Linux Service Managment ##############
Method 1: Change runlevel Shortcut:
each runlevel has specific directory that in every directory has shourtcat that point to service.
so we can manage which service works on which runlevel.
runlevel and they shourtcut placed on path: /etc/rc(0-6).d
the part if runlevel: 0 to 6
Note: if first of shortcut name of service was "s" it means service strats in this runlevel and when it's k it means service kill and stop..
to change status of services in specific run level you should change to start character from "s" to "k" or redo from 'mv" command.
stracture: S|K <number><name> : number is very important becuse services maybe has dependency and you must know which service should start first. for kill is same too.
Method 2: Manaul change runlevel with chkconfig: you can change service run level on|off with chkconfig
1. chkconfig --list : to show service status in All Runlvel
2. chkconfig --level <Runelvels> <Service_Name> on|off : for change status of service to specific runlevel.
NOtice: on ubuntu 20.04 and later you should setup deb package of chkconfig
Method 3: use "ntsysv" command for change Runlevel ( for redhat and centos)
ntsysv --level 2345(in level 2&3&4&5)
############## Type of files ##############
ls -l
- : Regular File
d : directory
b : block device File
l : link ( microsoft named shourtcut)
.
.
.
############## Links ##############
linux has 2 type of link : hard/soft link, this use for
type 1: is soft or symbolic link
for make link file in linux use"ln" command:
ln -s <orginal_Path_file><link_name>
-s command means create soft link.
type 2: is Hard link
ln <orginal_Path_file><link_name>
example: ln file1 file2
Use "ls -li" <path_devices> : show inode of files.
#stat <file_name> : show completly details of file
#dumpe2fs <Device_File> : with this command can see your partition information completly.
############## More switch for print/show files ##############
-cat <File_Path>
-tac <File_path>
-more <File_path> ---> Scroll Down
-less <File_path> ---> Scroll Up/Down
-head <File_path>
head -n <LINE#> file4 ---> show n first line of file
*Default n=10
-tail <File_path>
tail -n <LINE#> file4 ---> show n Last line of file
*Default n=10
############## Management Linux ##############
for manage linux. you may need to know managment many parts od linux:
Disk Mgmt
Runlevel Mgmt
Service Mgmt
User Mgmt
Group Mgmt
Permission Mgmt
Software Mgmt
Library Mgmt
Driver Mgmt
Process Mgmt
and etc.
###################################################
# LPIC 101-102 #
# Session 6 #
###################################################
linux character and Chaining Command:
1. Ampersand Operator (&): The function of ‘&‘ is to make the command run in background. Just type the command followed with a white space and ‘&‘. You can execute more than one command in the background, in a single go.
Run one command in the background: ping c5 www.tecmint.com &
2. semi-colon Operator (;): The semi-colon operator makes it possible to run, several commands in a single go and the execution of command occurs sequentially.
root@localhost:/home/tecmint# apt-get update ; apt-get upgrade ; mkdir test
3. AND Operator (&&): The AND Operator (&&) would execute the second command only, if the execution of first command SUCCEEDS.
root@localhost:/home/tecmint# ping -c3 www.tecmint.com && links www.tecmint.com
4. OR Operator (||): The OR Operator (||) is much like an ‘else‘ statement in programming. The above operator allow you to execute second command only if the execution of first command fails, i.e., the exit status of first command is ‘1‘.
tecmint@localhost:~$ apt-get update || links tecmint.com
5. NOT Operator (!): The NOT Operator (!) is much like an ‘except‘ statement. This command will execute all except the condition provided. To understand this, create a directory ‘tecmint‘ in your home directory and ‘cd‘ to it.
tecmint@localhost:~/tecmint$ rm -r !(*.html)
6. AND – OR operator (&& – ||): The above operator is actually a combination of ‘AND‘ and ‘OR‘ Operator. It is much like an ‘if-else‘ statement.
tecmint@localhost:~/tecmint$ ping -c3 www.tecmint.com && echo "Verified" || echo "Host Down"
7. PIPE Operator (|): This PIPE operator is very useful where the output of first command acts as an input to the second command.
tecmint@localhost:~/tecmint$ ls -l | less
8. Command Combination Operator {}: Combine two or more commands, the second command depends upon the execution of the first command. For example, check if a directory ‘bin‘ is available or not, and output corresponding output.
tecmint@localhost:~$ [ -d bin ] || { echo Directory does not exist, creating directory now.; mkdir bin; } && echo Directory exists.
9.Precedence Operator (): The Operator makes it possible to execute command in precedence order.
Command_x1 &&Command_x2 || Command_x3 && Command_x4.
In the above pseudo command, what if the Command_x1 fails? Neither of the Command_x2, Command_x3, Command_x4 would executed, for this we use Precedence Operator, as:
(Command_x1 &&Command_x2) || (Command_x3 && Command_x4)
In the above pseudo command, if Command_x1 fails, Command_x2 also fails but Still Command_x3 and Command_x4 executes depends upon exit status of Command_x3.
10. Concatenation Operator (\): The Concatenation Operator (\) as the name specifies, is used to concatenate large commands over several lines in the shell. For example, The below command will open text file test(1).txt.
tecmint@localhost:~/Downloads$ nano test\(1\).txt
11. Combination Operator ({}): The execution of the command succeeding this operator depends on the execution of the first command. The set of commands combined using {} operator executes when the command preceding it has successfully executed.
[ -f hello.txt ] && echo "file exists" ; echo "hello"
[ -f hello.txt ] && { echo "file exists" ; echo "hello"; }
############## Linux User Mgmt ##############
/etc/passwd : All of users database locate here.
## This is a standard syntax of user details that write to passwd file. ##
<Username>:x:<User ID>:<Group ID>:<Comment>:<Home Directory>:<Shell>
UID: is number that unix choice for labeled user.
system user UID <500
Regular user UID >=500
############## Adding User into Linux ##############
#Adding User: ( with useradd or adduser commands )
useradd guest
<Option>
-d Home_Directory
-s shell
-u user id
-g group id| group name
-G supplmentary Groups
-c comment
Example: useradd -c "guestusr" -d /test/guest -s /bin/sh -u 1000 guestusergroup
#less /etc/passwd | grep -i guest
############## Modify User into Linux ##############
#Modify User:
usermod <Options> <Username>
Example: usermod -u 2000 guest
#less /etc/passwd | grep -i guest
############## Delete User into Linux ##############
#userdel <Username>
Example: #userdel mohammad
-r ---> remove hoem directory also
-f ---> force remoce loggedin user
Note: id <Username> ; with this command user linux shows user information.
Note: /etc/login.defs ( login Configuration and details are in this files.)
Note: Password + Policy are occured in the: /etc/shadow
Note: usermod -L : Lock User's Password
usermod -U : Unlock User's Password
############## Linux Group Mgmt ##############
/etc/group ----> Linux Groups Database
IT:x:1001:
<Group_Name>:x:<Group_ID>:<it could be non zero>
############## Add Group ##############
#groupadd <Group_Name>
Example: groupadd IT
Example: groupadd -g 2500 IT
gpasswd IT
:**********
:**********
############## Modify Group into Linux ##############
#groupmod
-n : newname
Example: #groupmod -n NEWIT IT
#groupmod -g 2001 IT
############## Delete Group into Linux ##############
#groupdel <Group_Name>
Notice: if a group of user changed, it's file owner changed too.
############## Linux user Permission ##############
# for see permission of file or directory. simple command is: ls -l
ls -l :
file include 10 block: 0123456789
block: 0 is type:
0: File Type
-: Regular File
d: directory
l: link
b: block device
.
.
.
.
Block 1 to 9 set for permissions. for example:
owner/group/other
123/456/789 : first three number: owner permission.
second three number: group permission.
third three number: other permission.
another type of p permishion is : r , w , x
r: read
w: write
x: execute
rwx/rwx/rwx/
notice: if in permission you see " - " it's means for this part permission not set.
############## Change Permissions in Linux ##############
# you can change Permission with this command : chmod
chmod ABC file2
A: owner
B: owner
C: other
rwx rwx rwx r:4 w:2 x:1
421 421 421
Example: chmod 764 : rwx/rw-/r--
# Character mode for change permission:
u: owner
g: group
o: other
a: all
r: read
w: write
x: execute
Example: chmod u=rwx,g=rw,o=r file1
# use specific character : + , - , =
Example: u-x,g=r,o+w file1
############## Change Ownership ##############
# change ownership with chown command.
chown <new owner> <file_path>
Example: chown guest file1
Note: you can change the group owner with chown too.
#chown <NEW_OWNER>:<NEW_GROUP> <FILE_PATH>
#chown <NEW_OWNER>.<NEW_GROUP> <FILE_PATH>
###################################################
# LPIC 101-102 #
# Session 7 #
###################################################
############## Software Managment ##############
GCC ( Gnu C Compiler)
nano-2.4.2.tar.gz
A-Install From Source Code
Step 1: Decompress
Step 2: UnArchive
#tar xzvf nano-2.4.2.tar.gz
z: gzip
x: xtract
#tar xjvf nano-2.4.2.tar.bz2
j: bzip
Step 3) cd Directory
Step 4) less INSTALL
Step 5) ./configure
Step 6) Compile ----> "make"
Step 7) Install ----> "make install"
Note: Default Installation Directory: /usr/local/
############## Install Linux Package ##############
Note:
Redhat-----> .rpm (redhat Package manager)
Debian----> .deb
############## Query rpm databas ##############
#dpkg -i <debian package> : install debian Package
#dpkg -r <debian package> : Remove debian Package
#dpkg -P <debian package> : purge debian Package
#dpkg -V <debian package> : Verify debian Package
anothe switches:
dpkg
--yet-to-unpack Print packages selected for installation.
--predep-package Print pre-dependencies to unpack.
--add-architecture <arch> Add <arch> to the list of architectures.
--remove-architecture <arch> Remove <arch> from the list of architectures.
--print-architecture Print dpkg architecture.
--print-foreign-architectures Print allowed foreign architectures.
--assert-<feature> Assert support for the specified feature.
--validate-<thing> <string> Validate a <thing>'s <string>.
--compare-versions <a> <op> <b> Compare version numbers - see below.
###################################################
# LPIC 101-102 #
# Session 8 #
###################################################
############## Install Packages ##############
# repository: is a placed that you update your linux program and kernel.
#apt or apt-get : a program that get applications.
#apt : is new version of apt-get
#apt install apt-get install ( Package install)
#apt remove apt-get remove (Remove Package)
#apt purge apt-get purge (Remove Package that have config files)
#apt update apt-get update (Update index Repository)
#apt upgrade apt-get upgrade (Upgrade all of repository)
#apt autoremove apt-get autoremove (Remve Unusable Package)
#apt full-upgrade apt-get dist-upgrade (Upgrade Repository, Dependency and Package)
#apt search apt-cache search (search a Application)
#apt show apt-cache show (Show package details)
New on apt:
#apt list (Show list of packages)
#apt edit-resource (Edit repository list).
############## Software Mgmt ##############
-Install From Source Code
-Install From Package(rpm)
-Automatic Install Using Yum
Application+Utiliteis + ....
Library
Drivers
Example: APPLICATION_X----> Run ---> Library_x : every Application Run same library.
############## Linux Library mgmt ##############
/lib
/lib64
/usr/lib
###################################################
# LPIC 101-102 #
# Session 9 #
###################################################
############## Linux Library Mgmt ##############
Linux Standard Library Location:
/lib/*.so
/lib64/
/usr/lib
/usr/lib64
Note: Linux Library Config File: "/etc/ld.so.conf"
include ld.so.conf.d/*.conf
############## Linux Mgmt Comands ##############
-ldd <Application_Binary_Path> : show shared Library and it's dependencies
Example: #ldd /sbin/fdisk
ld.so.cache: is binary file that locate binary files and dependencies on it, it's path of all of libraries that are in: /lib , /lib64 , /usr/lib, /usr/lib64 .
-ldconfig ====> Re-Build ld.so.cache
#ldconfig---> rebuild Cache
#ldconfig -p ---> print cache
Example:
Application -----> Error: libc.so.6.1
Linux : /lib64/libc.so.6.2 ----> /lib64/libc.so.6.1
Download Library/Compile Library ----> *.so.? -----Copy --->
==============================================================================
############## Linux Kernel Module/Object Mgmt ##############