Linux Flashcards

1
Q

What is Linux?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Traceroute

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

FTP log file

A

/var/log/xfrlog

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Log files

A

/var/log/secure
/var/log/messages
/var/log/audit/audit.log - SELINUX
/var/log/xferlog - FTP

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Selinux log file

A

/var/log/audit/audit.log

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

tar

A

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)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

what is swap?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

YUM server

A

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)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Wha tis Mac address?

A

It’s Media Access Control Address, stored in hardware.

Unique number assigned to network interface card.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Crontab

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

sar (command)

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is Load Average and how to check?

A

It’s a number of the processes in the queue to be executed

top (to check load average of the system)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

NFS

A

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)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is Inode?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

LVM

A

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)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Update vs. Upgrade

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

DNS

A

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)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

DHCP vs. Static

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

DNS: A-record

A

A - record specifies IP address (IPv4) for a given host.

It is used for the conversion of domain names to the corresponding IP address.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

DNS: AAAA - record

A

AAAA record specifies IPv6 address for the given host.

Same as A- record differences in the type of IP address (IPv6 address record)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

Virtual IP vs. Non-virtual IP

A

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/

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

TCP

A

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

  1. Reliable
  2. Connection to be established
    3) Slow
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

IPTABLES

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

HTTPD

A

HTTPD ( Purpose to serve websites)

Port=80, secure port 443, TCP

httpd - (package name)

/etc/httpd/conf/httpd.conf ( config file)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

sshd

A

SSHD - daemon program for ssh
Uses Network layer, transport layer, hardware layer.

Port=22

openssh-server (package name)
openssh-clients (package name)
/etc/ssh/sshd_config (config file)

/var/log/secure (log file)

26
Q

Selinux

A

Selinux is security, enhanced Linux. It’s a Linux Kernel security module that provides a mechanism for supporting access control security policies.

1- Enforcing (enabled)
2- Permissive (all policies in place)
3- Disabled (no selinux running)

sestatus (check status of selinux)
getenforce (check status of selinux)

ls -Z (to check permission)
semanage fcontext -l (to check all file context)

/var/log/audit/audit.log (log file)

27
Q

Kernel modules

A

vmlinuz - responsible to detect the devices

initramfs - responsible to initialize drivers or modules

28
Q

Purpose of directories

A

/dev - represents devices, contains all devices
/bin - contains all regular user’s commands
/sbin - contains all root commands
/proc - contains all system memory information
/etc - contains all configuration files
/opt - optional software, 3rd part
/usr - optional files/directories from same vendor
/tmp - contains all temprory files

29
Q

rsync

A

rsync it’s file copying tool and is the most commonly used command for copying and synchronizing files and directories remotely as well as locally.

30
Q

How to check kernel version ?

A

uname -a

31
Q

How to check IP address?

A

ifconfig

ip addr show

32
Q

How to check free disk space?

A

df -hT

33
Q

How to check the size of the directory?

A

du -sh directory name

34
Q

DNS PTR record

A

PTR record used do lookup domain names based on an IP address

35
Q

What is Telnet?

A

Telnet is a simple, text-based network protocol that is used for accessing remote computers over TCP/IP networks like the internet.

Port: 23

36
Q

What is Netmask & Subnet?

A

It tells how many networks you can configure, how many hosts you can assign in that IP address range.

37
Q

What is CIDR?

A

It tells how many bits in your subnet. CIDR value=8

38
Q

What is IP? Difference between ipv4 and ipv6?

A

IP stands for Internet Protocol
IPv4 - 32 bit (internet protocol version 4)
Ipv6 - 128 bit (internet protocol version 6)

39
Q

What is UDP?

A

UDP is user datagram protocol

Uses a simple connection less transmission model with a minimum of protocol mechanism

Protocol number 17
Transport layer

1) non reliable
2) connection less
3) faster

40
Q

DNS CNAME record

A

CNAME record specifies a domain name that has to be queried in order to resolve the original DNS query.
CNAME records are used for creating aliases of domain names.

Canonical name or nick name

41
Q

What is FTP?

A

Purpose of ftp is transfer files

Port : 21, 20 -for data transfer
TCP

/etc/vsftpd/vsftpd.conf - config files
/etc/vsftpd/user_list - user block list

vsftpd - package for ftp

tailf /var/log/xferlog - command to check who login and see operations
sftp -vv ip (to see background)

get - to download file
put - to put file

42
Q

What is Daemon?

A

Daemon is a computer program that runs as a background process.

43
Q

What is VPN ?

A

VPN is used to connect remotely to the network.

44
Q

What is zombie process?

A

When a process dies on Linux, it is not all removed from the memory immediately, it’s stays in memory and becomes a zombie process.

top, ps - to display zombie process

To clean zombie process we have to kill parent process

kill -9 processid

45
Q

If user can’t login to the server where would you check?

A

Check log files
/var/log/secure

It could be wrong password, user blocked, wrong port number used)

46
Q

What is SAN?

A

SAN - storage area network

Doesn’t have a filesystem, you have to identify, create filesystem & mount

47
Q

What is NAS?

A

NAS is network attached storage

Has preconfigured filesystem, just need to be mounted

48
Q

What is ping command?

A

Ping command is used to check if there is a network connection to another computer

Ping uses ICMP, Network layer protocol.

49
Q

What is DNS MX record?

A

MX record - mail exchange record
Responsible for excepting and sending mails

Port: 25
Protocol: TCP
Connection oriented

50
Q

What are the filenames that are presented by a dot?

A

Dot files are hidden files.

These files may hold important data or setup info and hiding them makes it less likely that they will get accidentally deleted

51
Q

What is PXE?

A

PXE stands for Preboot Execution Environment

Instructs a client computer to boot, run or install an OS directly from the network interface

DHCPD - package for pxe installation
DHCPD is Dynamic host configuration protocol

xinetd - package to use tftp
tftp-server, syslinux - packages to configure boot

Port: 67
UDP
TFTP port 69. UDP
DHCP dynamic host configuration protocol

/etc/dhcp/dhcpd.conf - config.files
/var/lib/dhcpd - to see assigned IP

52
Q

What does sudo?

A

Sudo - Execute a command as another user (as super user or owner)

/etc/sudoers - file to add users
/etc/sudoers.d/ - directory for users, they can have own sudo file

sudo -l - to list users
visudo - e -f /etc/sudoers - to check errors
visudo - user ALL ( ALL) ( to give a user root privileges)

53
Q

How to set up sicky bit?

A

chmod 1777 (directory name)

54
Q

How to set up setuid?

A

chmod u+s or 277

55
Q

How to set up setgid?

A

chmod g+s or chmod 377

56
Q

What is networking?

A

Networking is a connection between two or more machines to communicate with each other.

57
Q

What is SMTP?

A
SMTP is simple mail transport protocol
Responsible for communication between mail servers uses 
port: 25
connection oriented
uses TCP
58
Q

What is the Filesystem?

A

Filesystem is method which OS uses to keep track of files on a disk or partition, that is the way the files are organized on the disk.
Redhat 7 - EXT4, XFS

mkfs -t xfs diskname - to create filesystem
when we create filesystem, small blocks got created size of blocks 4 KB.

59
Q

What is Bounding?

A

To make 2 network cards logically 1 is call Network Bounding

  1. Bounding has to be loaded in the memory
  2. Create the file bound0
  3. Configure 2 network card which you want to bound
  4. Make presentence with reboot.
60
Q

Purpose of directories

A

/dev - represents devices, contains all devices
/bin - contains all regular users commands
/sbin - contains all root commands
/proc - contains all system memory information
/etc - contains all configuration files
/opt - optional software
/usr - optional, files & directory from same vendor
/tmp - contains all temprory files