linux
linux
History of Linux
● Linux is open-source
2. Linux Meaning
3. Open-Source Software
● No royalty fees
● Linux is open-source
5. Linux Distribution
6. Linux Distros
9. Red Hat
○ sh (Bourne)
○ csh (C Shell)
○ ksh (Korn)
● x86 architecture
● Cost-effective
● From DVD
● From network:
○ HTTP / HTTPS
○ FTP
16. PuTTY
● Useful commands:
● Example: ls -l /etc
○ ls – command name
○ -l – option
○ /etc – argument
● / – Root directory
● Common directories:
○ /var – Logs
○ Example: /home/john/portfolio
● Sections:
○ OPTIONS – Switches
○ EXAMPLES – Sample usage
● uname -p – Processor
● uname -i – OS architecture
● ls – List files
● ls -l – Long list
● ls -a – All files
● ls -R – Recursive
● - – Regular file
● d – Directory
● l – Link file
● c – Character device
● s – Socket
● p – Pipe
● b – Block device
● cd – Change directory
● ls – List files
● cp – Copy file
● mv – Move or rename
● rm – Delete file
● Example:
● Common editors:
● Esc + u – Undo
● :w – Save
1. User Types:
2. UID:
● Each user has UID (User ID). OS uses UID to track users.
3. User Commands:
4. Create User:
● useradd username
● Options:
-d = home folder
-c = description
-s = shell
-u = UID
-G = group
-m = create home
5. Modify User:
6. Password Commands:
7. Delete User:
8. Danger in Delete:
CONFIGURATION FILES
1. /etc/passwd:
2. /etc/shadow:
● Stores passwords
3. /etc/group:
ACCOUNT POLICY
1. chage Command:
● Options:
-m = min days
-M = max days
-I = inactive days
-E = expiry date
-W = warning days
GROUPS
2. Group Commands:
3. Types:
SWITCH USER
1. su = switch user
● Needs password
SUDO
● File: /etc/sudoers
FILE PERMISSIONS
1. Owners:
2. Permissions:
● Read = r
● Write = w
● Execute = x
3. Types:
● File:
r = read content
w = change content
x = run file
● Directory:
r = list files
w = add/delete files
x = go inside
SYMBOLIC MODE
1. Use letters:
● u = user
● g = group
● o = others
● a = all
2. Change Permission:
● + = add
● - = remove
● = = set exact
3. Examples:
NUMERIC MODE
1. Values:
● Read = 4
● Write = 2
● Execute = 1
2. Examples:
OWNERSHIP
2. Values:
● Root = 022
● User = 002
3. Files:
● /etc/login.defs
● /etc/bashrc
2. Commands:
SPECIAL PERMISSIONS
1. Setuid (u+s):
● Value = 4
2. Setgid (g+s):
● Value = 2
● Used in /tmp
● Value = 1
8. Commands
• df – check disk space
• fdisk – create partition
9. Important
• Do not replace main VHDX file
• Always create new disk under IDE Controller 0
1. df Command
• Shows total, used, free disk space
• -h shows values in MB, GB
2. du Command
• Shows folder or file disk usage
10.Delete Partition
• Use d option inside fdisk
11.Fstab File
• Located at /etc/fstab
• Stores file system mount info
Type Commands
6.
fstab Entry Format
• Device MountPoint FileSystem defaults 0 0
1. POST
Power On Self Test checks hardware condition.
5. Kernel
Loads RAM disk and drivers. Mounts root file system. Starts system initialization.
2. Runlevel 0
Shutdown or halt system.
Command: init 0 or shutdown.
3. Runlevel 1
Single user mode.
Used for troubleshooting.
4. Runlevel 2
Multi-user mode without network.
5. Runlevel 3
Multi-user mode with network.
Default runlevel. Commonly used.
6. Runlevel 4
User-defined.
7. Runlevel 5
Multi-user mode with network and GUI.
8. Runlevel 6
Reboot system.
Command: init 6 or reboot.
1. Process
Running program in Linux. Each has a PID (Process ID).
Every process comes from systemd. A process can create a child process.
2. Commands
● ps -H – Show in hierarchy
3. top
Shows real-time system info. Shows CPU, memory, priority, and nice value.
1. Daemon
Background process. Starts at boot. Stops only by manual action or shutdown.
Managed by systemd.
3. Fork
Parent process copies address space to create child process.
1. NetworkManager
Controls and manages active network connections. Keeps network working.
Action Command
1. /etc/services
Maps service names to port numbers and protocols.
2. netstat
Shows network connections, routes, interfaces.
ss (Socket Statistics)
● Options:
○ -t – TCP sockets
○ -u – UDP sockets
● Multiple repositories
● Simple config
● Fast operations
● Name: coreutils
● Version: 8.32
● Release: 31
● Arch: x86_64
1. Meaning
Running many operating systems on one machine using a hypervisor.
Types of Virtualization
● Example: Xen