Shell Scripting
Shell scripting in Linux allows users to automate tasks using shell commands and scripting constructs. Here are some basic commands and concepts:
- Shebang:
#!/bin/bashat the beginning of a script specifies the shell interpreter. - Variables:
VAR=valueassigns a value to a variable. - Conditional Statements:
if,else,eliffor decision-making. - Loops:
for,whilefor iterating over lists or executing commands repeatedly. - Functions:
function_name() { ... }for defining reusable code blocks.
Package Management
Package management involves installing, updating, and removing software packages. Basic commands include:
- Installing Packages:
apt-get install <package>(Debian-based),yum install <package>(Red Hat-based). - Updating Packages:
apt-get update,yum update. - Removing Packages:
apt-get remove <package>,yum remove <package>.
Virtualization
Virtualization allows running multiple operating systems or environments on a single physical machine. Basic concepts include:
- Hypervisor: Software that enables virtualization (e.g., VirtualBox, KVM).
- Virtual Machine (VM): Guest OS running on a host machine.
- Commands:
virshfor managing KVM-based VMs,VBoxManagefor VirtualBox.
File Storage
Managing file storage involves handling disks, partitions, and file systems. Basic commands include:
- Disk Partitioning:
fdisk,partedfor creating and managing partitions. - File Systems:
mkfsfor creating file systems (e.g.,mkfs.ext4for Ext4). - Mounting:
mountto attach a file system to the directory tree. - Unmounting:
umountto detach a file system.
User and Group Management
Linux allows creating, modifying, and deleting users and groups. Basic commands include:
- User Management:
useradd,usermod,userdel. - Group Management:
groupadd,groupmod,groupdel. - Permissions:
chmodfor changing file permissions,chownfor changing file ownership.
Process Management
Monitoring and controlling processes is essential for system administration. Basic commands include:
- Listing Processes:
psto list processes,topfor real-time process monitoring. - Killing Processes:
killto terminate a process by ID or name. - Monitoring:
htopfor interactive process viewer.
Top comments (0)