Thursday, February 8, 2018

UNIX/Linux/Ubuntu system administration DAY 09

1. Linux/Unix commands

1. syslogd: logging capability
2. /etc/syslog.conf
3. /etc/rc.d/syslogd

1. vmstat 3: 
2. iostat 3
3. uname -r: linux version

1. mount
2. /etc/fstab
3. du
4. df
5. clear

Hardware and kernels
1. dmesg: hardware and kernel
2. lspci -k: basic information about the devices and modules
3. lsusb -t: usb devices are connected
4. dmidecode: look at CPU, RAM, Motherboard
5. dmidecode -t processor
6. x86info: overview of CPU

lsmode|less: find kernel module
modinfo sr_mod: to find out cd-rom drive info
modprobe -r -v sr_mode: unload the cd-rom drive
modprobe sr_mod: load cd-rom drive module

1. ls /proc
2. cat /proc/cpuinfo

The boot process
1. BIOS initilizes
2. The bootloader is called by the BIOS
3. The bootloader loads the first kernel image
4. The kernel then mounts filesystems and starts the appropriate system services
5. The system services finish starting up, and a login screen is presented.


1. arp 
2. ping
3. dig: DNS lookup utility
4. mtr: combines Ping and Traceroute into 1 program
5. netstat
6. nbstat
7. route
8. hostname

SSHD
1. scp (secure copy): secure transfer of files between two computers, operates on port 22
2. rcp (remote copy)
3. scp is replaced by SFTP protocol
4. sftp: ssh file transfer protocol
5. SFTP Simple File Transfer Protocol is no longer widely used

Network management using command line

1. sudo ifup -av: activate the network 
2. sudo ifdown -av: deactivate networking for all devices
3. sudo nm-tool: status of local network devices, driver, hardware address, wireless capabilities
4. ifconfig
5. iwconfig: wireless network configuration, detects wireless cards
6. iwlist: finds access points
7. route -n: displays routing table
8. sudo iwlist etho scan: find wireless hardware address
9. cat /etc/resolv.conf: looks at configuration file
or cat /etc/hosts
10. network-admin: GUI for network configuration
11. sudo route add default gw 192.168.0.1: add the default route via gateway
12. /etc/dhcp3/dhclient.conf: IP address of gateways, LAN domain name, DNS IP address, host-name, NTP server IP address
13. netstat -abn
14. cat /var/log/auth.log: look at all previous sudo-related commands

Network configuration files

1. /etc/hosts: hostname/IP address database
2. /etc/resolv.conf: DNS server IP address (nameserver)
3. /etc/network: folder storing configuration files
4. less /etc/network/interfaces
iface etho inet dhcp: use dhcp for assigning IP addresses

Search order
1. /etc/host.conf: order hosts, bind
2. /etc/nsswitch.conf: hosts: files dns

2. Red Hat Certified System Administrator (RHCSA)

Network interface

1. cd /etc/sysconfig/network-scripts
2. cat ifcfg-lo
3. cat ifcfg-eth0

Network manager handles the device.

1. system-config-network is replaced by network manager
2. system-config-network tool

Turn off NetworkManager in order to use system-config-network tool

1. service NetworkManager stop
2. chkconfig NetworkManager off
3. system-config-network

II. Network commands

1. ifconfig
2. ifconfig -a
3. ifconfig eth1 172.166.10.52 netmask 255.255.255.0
4. ifdown eth1: to shut the interface eth1 down
5. ifdown eth1 boot: 
6. ifup eth1
7. ifup eth1 boot
8. route
9. route add default gw 192.168.75.2 dev eth0
10. ip addr show : output like ifconfig command
11. ip route : view current routing table
12. ip -s link check if there is any drop packet
13. dhclient eth1: get DHCP ip address
14. ip addr show eth1
15. cd /etc/sysconfig
16. cat iptables: all firewall rules in the system
17. system-config-firewall
18. cat /etc/resolv.conf
19. cat /etc/hosts: resolve name

System logs
1. /var/log/messages: sys
2. /var/log
3. /var/log/dmes
4. /var/log/secure
5. /var/log/audit/audit.log
6. /var/log/yum.log
7. /var/log/boot

Display and understand system logs
1. tail /var/log/messages  

Mounting USB drives in Windows Subsystem for Linux

Windows Subsystem for Linux can use (mount): SD card USB drives CD drives (CDFS) Network drives UNC paths Local storage / drives Drives form...