13- how to check system load without top command?
w
uptime
14- By default load average is shown in how many intervals?
1,5 and 15 min intervals
15- How can you get the physical and virtual memory statistics?
free -m or g
vmstat -a (active and inactive memory), -d disk stats, -t time
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----
r b swpd free inact active si so bi bo in cs us sy id wa st
0 0 0 12004712 1005508 2539048 0 0 1 1 20 0 0 0 100 0
0
vmstat -a 2 (every 2 sec) 4 (4 intervals)
16- How to check cpu utilization and other statistics?
use sar which is part of sysstat package
sar -u shows cpu utilization stats for the current day
o/p
Linux 2.6.32-754.9.1.el6.x86_64 (icduspeshweb01) 12/29/2018 _x86_64_
(8 CPU)
12:00:01 AM CPU %user %nice %system %iowait %steal %idle
12:05:01 AM all 0.14 0.00 0.17 0.00 0.00 99.69
12:10:01 AM all 0.14 0.00 0.16 0.00 0.00 99.70
sar -u 2 3 (shows realtime cpu stats every 2 secs with 3 intervals)
sar -r memoy utilization
[aibraka@icduspeshweb01 ~]$ sar -r
Linux 2.6.32-754.9.1.el6.x86_64 (icduspeshweb01) 12/29/2018 _x86_64_
(8 CPU)
12:00:01 AM kbmemfree kbmemused %memused kbbuffers kbcached kbcommit %commit
12:05:01 AM 12113840 4219408 25.83 389268 1580688 6439436 31.52
12:10:01 AM 12107236 4226012 25.87 389352 1580704 6444064 31.54
sar -S swap space
17- How to find process id of a process and kill it immediately?
start cat
pidof cat
kill -9 PID
18- How to list all open files by specified user ?
lsof -u user
19- How to list all files opened by a particular command?
lsof -c cat
20- how can you list all network connection by port 22?
lsof -i :22
21- how to view all messages generated by the system since the last reboot on
RHEL7/CentOS7?
journalctl
journalctl |grep ssh
22- What are 2 different ways of showing the kernal message?
dmegs
journalctl -k
23- how can you contiously monitor the logs as they come in ?
journalctl -f
tail -f /var/log/messages
24-Where can you find messages related to the installation of Linux ?
anaconda.cfg
/var/log/anaconda/anaconda.log
25- Where are the most log files are located ?
/var/log
26- To improve performance, how can you safely set the
limit of the process for the super-user roto to be unlimited?
ulimit -u unlimited
27- Where can you set the resource limits for users logged
in via PAM?
/etc/security/limits.conf
28- how to check ulimit for a user?
ulimit -a
29-How to check and increase the limit of opened files in linux?
cat /proc/sys/fs/flie-max
To change:
1- vi /etc/sysctl.conf
(and add line)
2- fs.file-max=98321
3- sysctl -p
cat /proc/sys/fs/file-max
30. How to view run time kernel parameters?
sysctl -a
31. how to change runtime kernel parameter for maximum
shared segment size in bytes?
append >> kernel.shmmax=184467440 to /etc/sysctl.conf
sysctl -p
32- how to view boot time parameters and which file is
modified to change these parameters?
To view cat /proc/cmdline
These are supplied /boot/grub2/grub.cfg
32- How to disable ping?
Temp:
echo "1" > /proc/sys/net/ipv4/icmp_echo_ignore_all
Permanent
Step1: Edit the sysctl.conf file and
net.ipv4.icmp_echo_ignore_all = 1
Step2: Execute sysctl -p to enforce this setting immediately
# sysctl -p
33. How to find all files in /bin with 755 permissions?
find /bin -perm 755 -ls
34. how to extend the swap space?
1. vgs - look for free space
2. lvextend -L 4G /dev/VG-name/LV-name
3. swapon -s
will still show the old swap size
4. swapoff -v /dev/VG-name/LV-name
5. mkswap /dev/VG-name/LV-name
6. swapon -va /dev/VG-name/LV-name
34- How to extend a logical volume?
1. lvextend -L 8G /dev/vg/lv
35- How to reduce a logical volume?
unmount the file system
run e2fsck
reduce the logical volume (lvreduce -L 5G /dev/vg/lv)
resize2fs /dev/vg/lv
mount the file system
36- how to stop the logical volume? or deactivate the logical volume?
umount the file system
lvchange -an /dev/vg_name/lv_name
37- How to activate the logical volume which is in deactivated state ?
lvchange -ay /dev/vg_name/lv_name
38- How to disable the volume group? or deactiviate the volume group?
vgchange -an volume_group_name
39- how to enable the volume group? or activate the volume group?
vgchange -ay volume_group_name
40- What is the default size of a physical extent in LVM?
4MB
physical volume is divded into several smaller logical pieces when its added to a
VG
These logical pieces are knwon as PE's
41- How to find files that are over 10MB in size?
find /usr -size +10M
42- How to scan for new disks added to Linux machine?
$ echo "---" /sys/class/scsi-host (or) fc-host/host0,1,2/scan
43- How to create a raid 0 volume?
$ mdadm --create /dev/md0 --level=0 --raid-devices=2 /dev/sdd /dev/sde
44- How to check the status of Raid in linux?
cat /proc/mdstat
mdadm --detail (to view the created volume)
45- How to manually fault the disk ?
mdadm /dev/md1 -f /dev/sdh
mdadm --detail /dev/md1 - To check the status
46- How to recover from the faulty disk?
mdadm /dev/md1 -r /dev/sdh - To remove the disk
mdadm /dev/md1 -a /dev/sdh - To add the disk
47- What is configuration file for raid ?
The raid is temporary until or unless if the config details are present in the
config file.
/etc/mdadm.conf. After creating raid copy the output below to config file to
persistent
across reboot.
mdadm --detail -scan >> /etc/mdadm.conf
48- How to create a snapshot volume in lvm?
lvcreate -L150M -s -n backup /dev/vg1/data
-s -> snapshot
-n -> name of the new volume attr
backup -> backup volume name
/dev/vg1/data -> create a new volume called backup against this volume.
mount /dev/vg/backup /mnt
49- How to create a striped logical volume?
lvcreate -L 300M -i3 -I64 -n lvolstrp /dev/vg01
300M - Volume size
i3 - number of pv's to be used
I64 - Stribe size is 64KB
-n - switch for adding name
lvolstrp - name of the volume
/dev/vg01 - vg name
50- How to create mirroed logical volume?
lvcreate -L +200M -m1 -n
+200 M - Size of the volume
m1 = mirror copy
-n = name switch
mirrorvol - volume name
/dev/vg01 - volume group name
51. How to recover a failed metadata disk in lvm ?
1. copy the UUID from the pvdisplay -v
2. pvcreate --uuid "UUIDoFthe disk" --restorefile
/etc/lvm/archive/vg01_latestfile.vg /dev/sdc1 (Newdisk)
3. vgcfgrestore /dev/vg01
4. Talk to backup team to restore the backup from the backup software.
52. How to check if there is/are any issues with lvs?
lvs -a -o +devices
53- What are NFS services ?
Services at NFS server
nfsd,rpcbin, rpc.statd, rpc.idmapd, rpc.rquotad & rpc.mountd
Services at NFS client:
nfsiod & rpcbind
54- What are the commands to manage kernel modules?
lsmod
modprobe <modname> -> to insert a module
modprobe -r <modname> ->to remove a modlue
modinfo
55- How to change the kernel parameters?
# echo 0 > /proc/sys/net/ipv4/ip_forward
# sysctl -w
# sysctl -p -> to persistent across reboot (/etc/sysctl.conf)
56- Booting procedure ?
BIOS -> MBR - LILO/GRUB -> kernel -> init
57- How to enable kdump on RHEL 7?
1. install kexec-tools using yum
# yum install kexec-tools
2. Update the GRUB2 file to Reserver Memory for Kdump kernel
# vi /etc/default/grub
crashkernel=<Reserverd_size_of_RAM>
3. Execute the below command to regenerate GRUB2 configuration.
# grub2-mkconfig -o /boot/grub2/grub.cfg
4. Reboot the box
# shutdown -r now
5. edit /etc/kdump.conf file and specify as to where to save the vmcore dump file
example.
path /var/crash
6. Enable and start the kdump services
# systemctl start kdump.service
# systemctl enable kdump.service
58- How to configure REdhat satellite server 6.2
Pre-requsite
1. NTP should be in sync with local NTP server if there is any otherwise (internet)
2. Host should have FQDN
3. If the satellite server is behind the FW, then OS FW and selinux can be
disalbled.
4. # subscription-manager register --username=username --password=password
--proxy=proxyserver:ports
5. # subscription-manager list --available |less
6. # subscription-manaer attach -auto
The system has been registered with ID.
To see what subscription have been consumed on the system,
7. #subscription-manager list-consumed
8. # subscription-manager repos --disable "*"
9. # subscription-manager repos --enable=rhel-7-server-rpms -enable=rhel-server-
rhscl-7-rpms --enable=rhel-7-satellite-tools-6.2-rpms
10. #yum repolist enabled --> to see the enabled repos
11. # yum updates -> update all packages
12. Reboot the server
13. # mount satellite-6.2.6-rhel-6-x86_64-dvd.iso /media -o loop
cd /media
./install_packages