LWM-Linux/02 - Basic System Operations/Using Linux Terminal (Shell BASH).md

90 lines
2.6 KiB
Markdown

# Using the Linux Terminal (BASH Shell)
## 1. Basic Navigation:
- pwd: Print working directory
- ls: List files and directories
- cd: Change directory
- mkdir: Create a new directory
- rmdir: Remove an empty directory
- touch: Create an empty file
## 2. File Operations:
- cp: Copy files or directories
- mv: Move or rename files/directories
- rm: Remove files or directories
- cat: Display file contents
- less: View file contents page by page
- head/tail: View beginning/end of a file
## 3. Text Editing:
- nano: Simple text editor
- vim: Advanced text editor
- emacs: Another advanced text editor
## 4. File Permissions:
- chmod: Change file permissions
- chown: Change file owner
- chgrp: Change group ownership
## 5. Process Management:
- ps: List running processes
- top: Dynamic view of system processes
- kill: Terminate a process
- fg/bg: Bring process to foreground/background
## 6. System Information:
- uname: Display system information
- df: Show disk usage
- du: Display directory space usage
- free: Show memory usage
## 7. Network Commands:
- ifconfig: Configure network interfaces
- ping: Test network connectivity
- ssh: Secure shell for remote access
- scp: Securely copy files between hosts
## 8. Package Management:
- apt-get (Debian/Ubuntu): Install, update, remove packages
- yum (CentOS/Fedora): Similar to apt-get
- dnf (Fedora): Next-generation package manager
## 9. File Compression:
- tar: Archive files
- gzip/gunzip: Compress/decompress files
- zip/unzip: Create/extract zip archives
## 10. Text Processing:
- grep: Search for patterns in files
- sed: Stream editor for text manipulation
- awk: Pattern scanning and text processing
## 11. Redirection and Pipes:
- >: Redirect output to a file
- >>: Append output to a file
- <: Read input from a file
- |: Pipe output of one command to another
## 12. User Management:
- useradd: Add a new user
- userdel: Delete a user
- passwd: Change user password
## 13. Advanced Commands:
- find: Search for files in a directory hierarchy
- xargs: Build and execute command lines from standard input
- sort: Sort lines of text
- uniq: Report or omit repeated lines
## 14. Shell Scripting:
- Variables: var_name=value
- Conditionals: if, elif, else
- Loops: for, while
- Functions: function_name() { commands; }
## 15. Job Control:
- jobs: List active jobs
- &: Run a command in the background
- Ctrl+Z: Suspend a running process
- Ctrl+C: Terminate a running process