-
Notifications
You must be signed in to change notification settings - Fork 4
/
Important Commands.txt
130 lines (94 loc) · 3.33 KB
/
Important Commands.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
KERNEL MODULES
uname -a : unix name
/boot : vmlinuz (kernel file)
/usr/lib/modules : modules for kernel
or /lib/modules
lsmod : pull up your modules
modinfo : module information
insmod : install module
rmmod : remove module
Activate the module :
reboot
modprobe : add/remove module from kernel without installation (pen drive, etc)
/etc/modprobe.d (new) or modprobe.conf (old)
modprobe -a <modname>
sysctl -a (parameter being passed to the kernel)
-------------------------------------
Kernel File Locations
/etc/modprobe.d/ or /etc/modules-load.d/ : conf file generated at system installation or created by admin
/lib/modprobe.d/ : generated by third party apps
/usr/lib/modprobe.d/, if exists, typically linked to /lib/modprobe.d/
/run/modprobe.d : generated at runtime
insmod : insert/install/load single module to linux kernel
modprobe : more advance and easier than insmod, load any additional dependencies if needed
depmod : scans system, determines any needed module, reviews and updates the module.
PATA parallel interface 2 device per adapter /dev/hdx (x = a,b,c,d...)
SATA serial interface 4 device per adapter /dev/sdx (x = a,b,c,d...)
SCSI parallel interface 8 device per adapter
-----------------------------------------
BOOT PROCESS
/boot : Kernel and initram disk + (grub and grub2)
/boot/grub2/grub.cfg (Boot menu options) DO NOT MODIFY
/boot/efi/EFI/centos/
/etc/grub.d/40_custom (EDIT THIS ONE)
grub2-mkconfig
(Finds vmlinuz & initrd)
vmlinux : non compressed
vmlinuz : compressed
initramfs = initrd
dracut: create initial ramdisk images for preloading modules
-------------------------------------
NETWORK
/etc/sysconfig : Centos
/etc/sysconfig/network-scripts/ : Script files for interface
/etc/network OR /etc/netplan: Ubuntu
Global settings i.e. DNS :
/etc/sysconfig/network : default value
/etc/resolv.conf : DNS
/etc/hosts : Override DNS
/etc/hostname : Computer's name (Use hostnamectl command to change this)
ss -atp (all session, tcp, port)
ss --route
ss --program (programs that have port open)
ss --process
-------------------------------------
STORAGE
lsblk : list block
fdisk : MBR
gdisk : GPT
parted : partition editor (advance)
LVM : /usr/sbin/pv* vg* lv*
Physical Volume
Volume Group
Logical Volume
pvcreate, pvdisplay
vgcreate, vgdisplay
lvcreate -L 1500G vgname -n lvname
lvdisplay
/dev/mapper/lvname
vgextend
lvresize -L +1T /dev/lvname
lvs
resize2fs or xfs_resize
lvremove --> vgremove --> pvremove
-------------------------------------
FILESYSTEM
udev : detects new hw connects to system.
/dev folder
/etc/fstab : table that indicates the drive device file
df : disk usage by partition
du : disk usage by directory
iostat : real time chart
lsblk : display partition sizes and mount point
blkid : displays info about block devices such as storage dev
chattr : change attribute
debugfs : view/modify filesystem structure
dumpe2fs : block and superblock info
e2label : changes label
resizee2fs : expands/shrinks filesystem
tune2fs : modify filesystem parameters
xfs_admin and xfs_info is for xfs filesystem.
--------------------------------------------
pvcreate : create physical volume
vgcreate : groups physical volumes in a virtual log group
lvcreate : creates logival volume in physical partition