Linux Flashcards
What is Linux?
Just like Windows, iOS, and Mac OS, Linux is an operating system.
An operating system is software that manages all of the hardware resources associated with your desktop or laptop or server.
Traceroute
This command is a utility that records the route through the internet between your computer and a specified destination. It’s is used for understanding where are problems in the internet network and for getting a details.
Ex: traceroute google.com -p 80
FTP log file
/var/log/xfrlog
Log files
/var/log/secure
/var/log/messages
/var/log/audit/audit.log - SELINUX
/var/log/xferlog - FTP
Selinux log file
/var/log/audit/audit.log
tar
Is used to create compressed archive files and that can be moved easily from one disk to another disk or machine to machine
tar cf (to create tar for file) tar xvf (to untar) tar zxf (untar & dicompress )
gzip (to compress file size)
gzip -d (to decompress)
what is swap?
Swap space in linux is used when the amount of the physical memory (RAM) is full.
If system is full (RAM) inactive pages in memory are moved to swap space.
YUM server
1) Port 80
2) Client configuration file files: /etc/yum.repos.d/prod.repo
3) vi prod.repo
[prod]
baseurl=http://ip/centos/version
gpgcheck=0
4) yum clean all (clean cashe)
5) yum list (list available packages that are not in the system yet)
6) yum install packagename (install package)
7) yum remove package name (to remove the package)
8) yum update (to update packages)
Wha tis Mac address?
It’s Media Access Control Address, stored in hardware.
Unique number assigned to network interface card.
Crontab
Used to repeat the job
1) /etc/crontab (script file)
2) crontab -l ( to check for cron)
3) ps -ef crond ( to check for currently running cron)
4) crontab -r ( to remove cron jobs)
5) crontab -e ( to open & write a cron)
/var/spool/cron (to get cron information)
/etc/cron.deny (to specify deny user)
/etc/cron.daily/ ( daily schedules)
Ex: to run the cron job every minute
* * * * * /root/backup.sh
5 stars: 1st star is for minute 2nd star is for hour 3rd star is for day of the month 4rd is for a month 5th is for day of the week
Ex: to run job every 30 minutes
30 * * * * /root/backup.sh
sar (command)
System Activity Report
It’s is used for getting information of CPU, RAM, swap load average.
sar -q (to check load average)
sar -r (to check load average of RAM
What is Load Average and how to check?
It’s a number of the processes in the queue to be executed
top (to check load average of the system)
NFS
Network file sharing
Uses RPC - remote procedure calls. NFS uses to communicate with different boxes.
1) Ports: 111, 2049
2) rpcinfo -p (to check for nfs ports)
3) nfs-utils (package name)
4) /etc/exports ( configuration file)
5) showmount -e hostname (to check shared file)
6) exportfs -v ( to check what I shared)
7) exportfs -r ( to reload export file)
8) /etc/fstab (file to make presistance with reboot)
What is Inode?
An inode is a record in a disk table, which contains information about a file or folder.
Inode contains information related to the file or folder:
1) Hard links
2) Number of links
3) File size
4) Type of the file
5) Owner of the file
6) Group owner of the file
7) Permitions
8) Number of blocks
9) Size of the blocks
10) Last access time
11) Last modified time
Inode doesn’t contain following information:
1) Name of the file
2) Creation time
LVM
It’s Logical Volume Manager is nothing but extra software to sue for managing a disk.
pvcreate (create physical volume)
vgcreate (create volume group)
lvcreate (create logical volume)
pvs, vgs, lvs ( to display)
pvdisplay ( to display physical volume)
vgdisplay (to display volume group)
lvdisplay (to display logical volume)
lvremove (to remove lvm)
vgremove (to remove volume group)
pvremove ( to remove physical volume)
Update vs. Upgrade
Update - applying the new patches and changes to the existing file
Upgrade - when existing file is being uninstalled and new on is being installed on it’s place.
DNS
Domain Name Service
Used to resolve the hostname to IP address and IP address to the hostname.
named - DNS daemon
1) Port= 53, UDP
2) Packages:
bind
bind-chroot
/etc/named.conf (main configuration file)
/etc/resolv.conf ( client configuration file)
/etc/hosts (local resolve file)
DHCP vs. Static
DHCP - Dynamic host configuration protocol (automatically assigns IP address to the host, used for PXE)
Static - manually configure network, assign IP address in network interface card.
DNS: A-record
A - record specifies IP address (IPv4) for a given host.
It is used for the conversion of domain names to the corresponding IP address.
DNS: AAAA - record
AAAA record specifies IPv6 address for the given host.
Same as A- record differences in the type of IP address (IPv6 address record)
Virtual IP vs. Non-virtual IP
Virtual IP has a colon.
Non-virtual IP doesn’t have colon
To configure IP with persistence to reboot create a file “ifcfg-interface name, under /etc/sysconfig/network-scripts/
TCP
TCP - Transmission Control Protocol
Provides reliable, ordered, and error-checked delivery between applications running on hosts, that are communicating by an IP network.
Protocol number 6.
Transport layer
- Reliable
- Connection to be established
3) Slow
IPTABLES
Iptabels is a user-space program that allows a system, administrators to configure the tables provided by the Linux Kernel Firewall.
1) service iptables status (to check the status)
systemctl status iptables.service
2) Config file: /etc/sysconfig/iptables
3) After iptables has been modified restart iptable
HTTPD
HTTPD ( Purpose to serve websites)
Port=80, secure port 443, TCP
httpd - (package name)
/etc/httpd/conf/httpd.conf ( config file)