2024-09-02 16:42:08 -06:00
|
|
|
# Using the Linux Terminal (BASH Shell)
|
|
|
|
|
|
2024-09-04 11:18:26 -06:00
|
|
|
## 1. **Opening the Terminal**:
|
|
|
|
|
- You can open the terminal in various ways:
|
|
|
|
|
- **Shortcut**: Press `Ctrl + Alt + T`.
|
|
|
|
|
- **Application Menu**: Search for "Terminal" in your applications.
|
|
|
|
|
- **Command**: Use the `gnome-terminal` command.
|
|
|
|
|
|
|
|
|
|
## 2. Basic Navigation:
|
2024-09-02 16:42:08 -06:00
|
|
|
- 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
|
|
|
|
|
|
2024-09-04 11:18:26 -06:00
|
|
|
## 3. File Operations:
|
2024-09-02 16:42:08 -06:00
|
|
|
- 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
|
|
|
|
|
|
2024-09-04 11:18:26 -06:00
|
|
|
## 4. Text Editing:
|
2024-09-02 16:42:08 -06:00
|
|
|
- nano: Simple text editor
|
|
|
|
|
- vim: Advanced text editor
|
|
|
|
|
- emacs: Another advanced text editor
|
|
|
|
|
|
2024-09-04 11:18:26 -06:00
|
|
|
## 5. File Permissions:
|
2024-09-02 16:42:08 -06:00
|
|
|
- chmod: Change file permissions
|
|
|
|
|
- chown: Change file owner
|
|
|
|
|
- chgrp: Change group ownership
|
|
|
|
|
|
2024-09-04 11:18:26 -06:00
|
|
|
## 6. Process Management:
|
2024-09-02 16:42:08 -06:00
|
|
|
- ps: List running processes
|
|
|
|
|
- top: Dynamic view of system processes
|
|
|
|
|
- kill: Terminate a process
|
|
|
|
|
- fg/bg: Bring process to foreground/background
|
|
|
|
|
|
2024-09-04 11:18:26 -06:00
|
|
|
## 7. System Information:
|
2024-09-02 16:42:08 -06:00
|
|
|
- uname: Display system information
|
|
|
|
|
- df: Show disk usage
|
|
|
|
|
- du: Display directory space usage
|
|
|
|
|
- free: Show memory usage
|
|
|
|
|
|
2024-09-04 11:18:26 -06:00
|
|
|
## 8. Network Commands:
|
2024-09-02 16:42:08 -06:00
|
|
|
- ifconfig: Configure network interfaces
|
|
|
|
|
- ping: Test network connectivity
|
|
|
|
|
- ssh: Secure shell for remote access
|
|
|
|
|
- scp: Securely copy files between hosts
|
|
|
|
|
|
2024-09-04 11:18:26 -06:00
|
|
|
## 9. Package Management:
|
2024-09-02 16:42:08 -06:00
|
|
|
- apt-get (Debian/Ubuntu): Install, update, remove packages
|
|
|
|
|
- yum (CentOS/Fedora): Similar to apt-get
|
|
|
|
|
- dnf (Fedora): Next-generation package manager
|
|
|
|
|
|
2024-09-04 11:18:26 -06:00
|
|
|
## 10. File Compression:
|
2024-09-02 16:42:08 -06:00
|
|
|
- tar: Archive files
|
|
|
|
|
- gzip/gunzip: Compress/decompress files
|
|
|
|
|
- zip/unzip: Create/extract zip archives
|
|
|
|
|
|
2024-09-04 11:18:26 -06:00
|
|
|
## 11. Text Processing:
|
2024-09-02 16:42:08 -06:00
|
|
|
- grep: Search for patterns in files
|
|
|
|
|
- sed: Stream editor for text manipulation
|
|
|
|
|
- awk: Pattern scanning and text processing
|
|
|
|
|
|
2024-09-04 11:18:26 -06:00
|
|
|
## 12. Redirection and Pipes:
|
|
|
|
|
- >: Redirect output to a file OVERWRITING original file if it exists
|
|
|
|
|
- >>: Append output to a file or create a new file.
|
2024-09-02 16:42:08 -06:00
|
|
|
- <: Read input from a file
|
2024-09-04 11:18:26 -06:00
|
|
|
- |: Pipe output of one command to another "command chaining"
|
2024-09-02 16:42:08 -06:00
|
|
|
|
2024-09-04 11:18:26 -06:00
|
|
|
## 13. User Management:
|
2024-09-02 16:42:08 -06:00
|
|
|
- useradd: Add a new user
|
|
|
|
|
- userdel: Delete a user
|
|
|
|
|
- passwd: Change user password
|
|
|
|
|
|
2024-09-04 11:18:26 -06:00
|
|
|
## 14. Advanced Commands:
|
2024-09-02 16:42:08 -06:00
|
|
|
- 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
|
|
|
|
|
|
2024-09-04 11:18:26 -06:00
|
|
|
## 15. Shell Scripting:
|
2024-09-02 16:42:08 -06:00
|
|
|
- Variables: var_name=value
|
|
|
|
|
- Conditionals: if, elif, else
|
|
|
|
|
- Loops: for, while
|
|
|
|
|
- Functions: function_name() { commands; }
|
|
|
|
|
|
2024-09-04 11:18:26 -06:00
|
|
|
## 16. Job Control:
|
2024-09-02 16:42:08 -06:00
|
|
|
- jobs: List active jobs
|
|
|
|
|
- &: Run a command in the background
|
|
|
|
|
- Ctrl+Z: Suspend a running process
|
|
|
|
|
- Ctrl+C: Terminate a running process
|