Linux Core/Commands Flashcards
[Linux]
What commands do you use to change file permissions & ownership?
chmod (for permissions)
& chown (for ownership)
[Linux]
How would you start a service in RHEL?
Systemctl start [service name]
[Linux]
How would you install a package?
yum install [package name]
[Linux?]
What is SMTP & post-fix?
smtp = (Simple Mail Transfer Protocol) is a set of rules for sending and receiving emails over the internet using TCP & default port 25
Post-fix = open source, fast, secure, easy-to-configure MTA (mail transer agent), uses port 25 (typical SMTP port)
[Linux]
Where are system log files typically stored for RHEL?
/var/log/messages = general system messages
+journalctl -k (for kernel logs)
/var/log/secure = authentication logs
/var/log/httpd = Apache web server logs (access & error logs)
/var/log/cron = logs of scheduled CRON jobs
[Linux]
What are IP tables?
a tool used to configure & manage packet filtering + network traffic rules.
[Linux]
What command is used patch manually?
$ yum update
[Linux]
What do you use /var/log or /var/log/messages for?
to check system logs
& messages regarding security events, user activities, application logs & kernel messages
ex: use ‘grep’ (search/find), ‘tail’ (last commands used), & ‘less’
[Linux]
What are some big differences between RHEL7 & RHEL8?
1) Package management:
RHEL7 uses YUM
vs
RHEL8 uses DNF (faster & more efficient)
2) Kernal Upgrade:
RHEL7 uses 3.10
vs
RHEL8 uses 4.18 (better hardware support, performance & security)
3) Software Packaging
RHEL7 uses traditional RPM packaging
vs
RHEL8 introduces Application Streams, allowing multiple versions of software to be installed and maintained simultaneously
4) Networking
RHEL7 uses iptables for firewall management
vs
RHEL8 replaces ‘iptables’ with ‘nftables’ (simplifies network filtering) + ‘network-scripts’ is now ‘NetworkManager’
5) Security Enhancements
RHEL8 improves encryption & security compliance (with OpenSSL 1.1.1 + TLS 1.3), system-wide cryptographic policies, & rootless containers (reducing the need for root privileges)
6) Desktop Environment
RHEL7 uses GNOME 3.22 with X.org
vs
RHEL8 uses GNOME 3.28 with Wayland (X.org still available)
7) Storage & Filesystem Changes
RHEL7 supports XFS, ext4 and Brtrf
vs
RHEL8 drops Btrf, (keeps XFS & ext4) + adds Stratis (easier storage management)
8) Containerization changes
RHEL7 uses Docker
vs
RHEL8 drops Docker and uses Podman, Buildah & Skopeo (more secure & rootless containers)
[Linux]
How do you do rollbacks in RHEL/CentOs?
**From the snapshot
Using package manager:
$ dnf history undo [transaction_id]
[Linux]
What are the three components of the Linux OS?
Kernel (core)
Shell (CLI/User Interface)
File System (how data is stored, organized & accessed)
[Linux]
What is the difference between UNIX and Linux?
Unix: commercial (expensive), primarily used in enterprise environments
Linux: Open source, flexible, widely used (personal to enterprise)
[Linux]
What is bash?
Command-line shell (execute commands directly) & scripting language (for automating task)
ie: ls, cd, grep
[Linux]
What is a CronTab?
Config file used to schedule and automate task
(left to right: minute, hour, day, month, day-of-the-week)
[Linux]
What do you use the root account for?
unrestricted privileges & only critical system admin task.
It is best practice to use ‘sudo’ instead of direct root access
[Linux]
Where is the password file located in linux?
/etc/passwd
OR
(encrypted) /etc/shadow
[Linux]
What is chmod [file/folder]?
Change permissions of [file]
$ chmod [u/g/o + r/w/x] [files/dir]
[Linux]
What is a ext3 file system?
3rd extended file system; slowly being phased out by ext4.
major upgrade over ext2 was JOURNALING, which improved reliability (data integrity) & prevented data corruption during power loss or system crash (fast recovery)
-easily convert ext2 to ext3
-not as scalable as ext4 or XFS
-doesnt handle large files/volumes as well as ext4
[Linux]
Difference between Linux and Unix
UNIX is proprietary & commercial while Linux is free & open source
[Linux]
What are the different files types in Linux?
files
directories
special files (represent devices ie /dev/sda)
Symbolic links (point to other files)
FIFO files [aka pipes] used for inter-process communication)
[Linux]
How do you check CPU usage?
$ top or $ htop
[Linux]
What are the different run levels in Linux?
0 = HALT (shuts down the system)
1 = Single-user mode (for maintenance)
2 = Multi-user mode w/o networking
3 = Multi-user mode WITH networking
4 = unused/customizable
5 = Multi-user w/ GUI
6 = REBOOT
[Linux]
What command to check current runlevel?
$ runlevel
[Linux]
What command to change runlevel?
$ init [number] = switch to runlevel [number]
[Linux]
How to create, delete and assign password for users in Linux?
$ useradd [username]
$ userdel [username]
$ passwd [username]
[Linux]
explain hardlink vs softlink
A hard link is a direct reference to the data vs a softlink is a shortcut/reference to another file or directory.
[Linux]
How do you check disk usage?
$ df -h
[Linux]
How do you check memory usage?
$ free -m
[Linux]
How do you check network usage?
$ iftop or $ netstat -tulnp
[Linux]
How do you check Disk I/O usage?
$ iostat
[Linux]
What is SELinux? & its purpose?
a module that increases security by limiting process actions
extra features: Type Enforcement (TE), Role-Based Access Control (RBAC), Multi-Level Security (MLS)
[Linux]
What is fstab?
(File System Table): contains information about disk partitioning & storage devices that should be automatically mounted at boot
-located in /etc/fstab
[Linux]
What are the modes of SELinux?
& how to check current mode
Enforcing, Permissive, & Disabled.
Check by using: $ sestatus
[Linux]
How to change modes in SELinux, temporarily & permanently
Temp: $ setenforce 1 or 0 [1=enforcing, 0=permissive]
Perm: goto /etc/selinux/config change “SELINUX=____” to enforcing, permissive or disabled, then save & reboot.
[Linux]
What is an inode?
An inode (Index Node) is a data structure used by file systems in Linux to store metadata about a file or directory.
(harddrive identifier)
It contains information such as:
File type, Permissions, Ownership, Size of the file, Timestamps
[Linux]
What file stores a user encrypted password?
etc/shadow
[Linux]
how do you check cpu usage?
$ htop / $ top
[Linux]
How to list running processes?
$ ps -a / $ top
[Linux]
What does $ SU command do?
switch user