Merge pull request #18 from NatePick/main

Fixed the link to the code of conduct
This commit is contained in:
Ganome 2024-09-07 10:23:01 -06:00 committed by GitHub
commit 65a620b912
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
26 changed files with 380 additions and 865 deletions

View File

@ -14,184 +14,141 @@ Linux follows a hierarchical file system structure, starting with the root direc
## 2. Basic Commands:
### - Listing files and directories:
```
ls [options] [directory]
```
`ls [options] [directory]`
Common options:
- -l: Long format
- -a: Show hidden files
- -h: Human-readable file sizes
### - Changing directories:
```
cd [directory]
```
- cd ..: Move up one directory
- cd ~: Go to home directory
- cd /: Go to root directory
`cd [directory]`
- `cd ..`: Move up one directory
- `cd`: Go to home directory
- `cd /`: Go to root directory
### - Creating directories:
```
mkdir [options] directory_name
```
`mkdir [options] directory_name`
Common options:
- mkdir -p: Create parent directories if they don't exist
- -p: Create parent directories if they don't exist
### - Removing directories:
```
rmdir [options] directory_name
```
Common options:
- rm -r directory_name: Remove non-empty directories
`rmdir [options] directory_name`
### - Creating files:
```
touch file_name
```
### - Creating empty files:
`touch file_name`
### - Copying files and directories:
```
cp [options] source destination
```
`cp [options] source destination`
Common options:
- cp -r: Copy directories recursively
- -r: Copy directories recursively
### - Moving/renaming files and directories:
```
mv source destination
```
`mv source destination`
### - Removing files:
```
rm [options] file_name
```
`rm [options] file_name`
Common options:
- rm -f: Force removal without prompting
- -f: Force removal without prompting
## 3. File Permissions:
Linux uses a permission system with read (r), write (w), and execute (x) permissions for owner, group, and others.
### Viewing permissions:
```
ls -l
```
`ls -l`
### Changing permissions:
```
chmod [options] mode file
```
Example: chmod 755 file_name
`chmod [options] mode file`
Example: chmod 755 file_name "to make a file permissions RWX-Owner, RX-Group, RX-Others
### Changing ownership:
```
chown [options] user:group file
```
`chown [options] user:group file`
## 4. File Manipulation:
### Viewing file contents:
```
cat file_name #Print entire file at once
less file_name #View file in a pager format
more file_name #View file in a pager format
head file_name #View top 10 lines (default) of a file
tail file_name #View last 10 lines (default) of a file
```
- `cat file_name` #Print entire file at once
- `less file_name` #View file in a pager format
- `more file_name` #View file in a pager format
- `head file_name` #View top 10 lines (default) of a file
- `tail file_name` #View last 10 lines (default) of a file
### Searching file contents:
```
grep [options] pattern file
```
`grep [options] pattern file`
Common options:
- -i: Insensitive Case Search
- -R: search recursively in parent Directory, as well as all child directories.
- -n: Return the line number in the file where the match occured
### Comparing files:
```
diff file1 file2
```
`diff file1 file2`
## 5. Advanced File Management:
### Finding files:
```
find [path] [expression]
```
Example: find /home -name "*.txt"
`find [path] [expression]`
Common Options:
- -iname: Insensitive case search
- -name: Case Sensitive search
Example: `find /home -name "*.txt"`
### Disk usage:
```
du [options] [directory]
```
`du [options] [directory]`
Common options:
- -h: Print disk usage in human-readable format
- -s: Summarize disk usage information
- -S: Summarize disk usage by each sub-directory
### File compression and archiving:
```
tar [options] archive_name files
gzip file_name
gunzip file_name.gz
```
`tar [options] files.tar files` #Create a tar archive called "files.tar" with everything in the "files" directory
`gzip -k file_name` #Create a gzipped archive while keeping the original file "-k"
`gunzip -k file_name.gz` #Extract a .gzip file while keeping "-k" the original archive.
### Symbolic links:
```
ln -s target_file link_name
```
### Symbolic links "Shortcuts":
`ln -s target_file link_name`
## 6. Text Editors:
- nano: Simple and user-friendly
- nano: Simple and user-friendly #Included with most distros by default
- vim: Advanced and powerful
- emacs: Extensible and feature-rich
## 7. File System Management:
### Mounting file systems:
```
mount [options] device directory
```
`mount` [options] device directory
### Unmounting file systems:
```
umount [options] directory
```
`umount` [options] directory
### Checking disk space:
```
df [options]
```
- df -h: Human-readable output
`df` [options]
Common Options:
- -h: Human-readable output
## 8. File System Maintenance:
### Checking and repairing file systems:
```
fsck [options] device
```
`fsck [options] device` #Not used with BTRFS filesystem
### Creating file systems:
```
mkfs [options] device
```
`mkfs.[FSTYPE] [options] device` #Will erase device/disk if not entered correctly
## 9. Access Control Lists (ACLs):
### For more fine-grained permission control:
```
getfacl file
setfacl -m u:user:rwx file
```
`getfacl file`
`setfacl -m u:user:rwx file`
## 10. Inode Information:
### View detailed file information:
```
stat file_name
```
`stat file_name`
- [(1) How to Perform File and Directory Management (Part 3) - Tecmint.](https://www.tecmint.com/file-and-directory-management-in-linux/.)
- [(2) How to Manage Files from the Linux Terminal: 11 Commands ... - How-To Geek.](https://www.howtogeek.com/107808/how-to-manage-files-from-the-linux-terminal-11-commands-you-need-to-know/.)
- [(3) Linux File Management Series for Beginners - Linux Shell Tips.](https://www.ubuntumint.com/linux-file-management/.)
- [(4) Linux Commands Cheat Sheet {with Free Downloadable PDF} - phoenixNAP.](https://phoenixnap.com/kb/linux-commands-cheat-sheet.)
## 11. External Sources:
- [(1) Linux File Management Series for Beginners - Linux Shell Tips.](https://www.ubuntumint.com/linux-file-management/.)
- [(2) Linux Commands Cheat Sheet {with Free Downloadable PDF} - phoenixNAP.](https://phoenixnap.com/kb/linux-commands-cheat-sheet.)

View File

@ -1,11 +0,0 @@
#
1. **Print Working Directory (pwd):** Use `pwd` to display your current location in the filesystem. It shows the absolute path from the root directory (e.g., `/home/user`). Absolute paths are crucial for scripts.
2. **Change Directory (cd):**
- To move up one level (e.g., from `/home/user/docs` to `/home/user`), use `cd ..`.
- To go directly to a specific directory (e.g., `/home/user/music`), provide the absolute path: `cd /home/user/music`.
- To return home from any location, use `cd ~`.
- [10 Linux commands for navigating the file system - FOSS Linux.](https://www.fosslinux.com/136854/10-linux-commands-for-navigating-the-file-system.htm.)

View File

@ -32,14 +32,14 @@ Most desktop environments (GNOME, KDE, Xfce, etc.) have a menu option for shutti
## 5. Emergency Immediate Shutdown:
In case of an unresponsive system, you can use the magic SysRq key combinations:
- Hold Alt + SysRq (usually Print Screen), then press these keys in sequence: R E I S U B
- This safely syncs data, unmounts filesystems, and reboots the system
- Hold Alt + SysRq (usually Print Screen), then press these keys in sequence: R E I S U B #This will reboot your system
- Hold Alt + SysRq (usually Print Screen), then press these keys in sequence: R E I S U O #This will power-off your system
## 6. Sending Signals:
You can use the `kill` command to send signals to the init process:
- Shutdown: `sudo kill -s SIGINT 1`
- Restart: `sudo kill -s SIGTERM 1`
- Shutdown: `sudo kill -s SIGINT 1` #kill the init PID - resulting in machine power-off
- Restart: `sudo kill -s SIGTERM 1` #kill the init PID - resulting in machine power-off
## 7. Additional Options and Considerations:
@ -50,7 +50,7 @@ c) Shut down without sudo (if configured): `shutdown -h now`
## 8. Shutting down remote systems:
- SSH into the system and use any of the above commands
- Use `ssh user@host "sudo shutdown -h now"` from another machine
- Use `ssh user@host "sudo shutdown -h now"` from another machine - you will NOT be able to reconnect without physical access to the machine!
## 9. Checking shutdown/restart history:
@ -65,8 +65,3 @@ c) Shut down without sudo (if configured): `shutdown -h now`
- For servers, notify users before scheduling a shutdown or restart
- Use delayed shutdowns to give time for important processes to complete
- Regularly check system logs for any shutdown/restart issues
- [(1) How to Reboot or Shut Down Linux Using the Command Line.)](https://www.howtogeek.com/411925/how-to-reboot-or-shut-down-linux-using-the-command-line/.)
- [(2) How to reboot, shutdown, log off PC from Terminal by command line in](https://www.fosslinux.com/1115/how-to-reboot-shutdown-log-off-pc-from-terminal-by-command-line-in-ubuntu-and-linux-mint.htm.)
- [(3) How do I shut down or reboot from a terminal? - Ask Ubuntu.](https://askubuntu.com/questions/187071/how-do-i-shut-down-or-reboot-from-a-terminal.)
- [(4) 5 Linux Commands to Shutdown and Reboot the System.](https://www.binarytides.com/linux-command-shutdown-reboot-restart-system/.)

View File

@ -1,27 +0,0 @@
#
1. **Opening and Creating Files**:
- To open an existing file or create a new one, type:
```
nano filename
```
- Replace `filename` with the actual name of the file you want to edit. Nano will open the file in a new editor window.
2. **Basic Editing**:
- Nano is modeless, meaning you can start typing and editing immediately.
- To move the cursor to a specific line and character number, use `Ctrl+_`. Enter the line and column numbers when prompted.
- To save your changes and exit, press `Ctrl+x`.
3. **Searching and Replacing**:
- To search for text, press `Ctrl+w`, type your search term, and press `Enter`.
- To move to the next match, press `Alt+w`.
- For search and replace, press `Ctrl+\`. Enter the search term and the replacement text.
- [(1) Editing Files With Nano in Linux [With Cheat Sheet] - It's FOSS.](https://itsfoss.com/nano-editor-guide/.)
- [(2) The Beginner's Guide to Nano, the Linux Command-Line Text Editor.](https://www.howtogeek.com/42980/the-beginners-guide-to-nano-the-linux-command-line-text-editor/.)
- [(3) nano Command Guide | Linux Text Editor Explained.](https://ioflood.com/blog/nano-linux-command/.)
- [(4) Getting Started With Nano Editor - Linux Handbook.](https://linuxhandbook.com/nano/.)
- [(5) First steps with the Nano text editor - PragmaticLinux.](https://www.pragmaticlinux.com/2020/05/first-steps-with-the-nano-text-editor/.)
- [(6) How to Use Nano Text Editor: From Installation to Editing - Hostinger.](https://www.hostinger.com/tutorials/how-to-install-and-use-nano-text-editor.)

View File

@ -23,7 +23,7 @@ Nano is a simple, user-friendly text editor for Unix-like operating systems. It'
- Use arrow keys to move the cursor.
- Page Up/Down: Move one screen at a time.
- Home/End: Move to start/end of a line.
- Alt+/ or Ctrl+_: Move to a specific line number.
- CTRL+/: Move to a specific line number.
## 5. Editing:
- Type to insert text at the cursor position.

View File

@ -1,6 +1,12 @@
# Using the Linux Terminal (BASH Shell)
## 1. Basic Navigation:
## 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:
- pwd: Print working directory
- ls: List files and directories
- cd: Change directory
@ -8,7 +14,7 @@
- rmdir: Remove an empty directory
- touch: Create an empty file
## 2. File Operations:
## 3. File Operations:
- cp: Copy files or directories
- mv: Move or rename files/directories
- rm: Remove files or directories
@ -16,73 +22,73 @@
- less: View file contents page by page
- head/tail: View beginning/end of a file
## 3. Text Editing:
## 4. Text Editing:
- nano: Simple text editor
- vim: Advanced text editor
- emacs: Another advanced text editor
## 4. File Permissions:
## 5. File Permissions:
- chmod: Change file permissions
- chown: Change file owner
- chgrp: Change group ownership
## 5. Process Management:
## 6. 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:
## 7. System Information:
- uname: Display system information
- df: Show disk usage
- du: Display directory space usage
- free: Show memory usage
## 7. Network Commands:
## 8. 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:
## 9. 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:
## 10. File Compression:
- tar: Archive files
- gzip/gunzip: Compress/decompress files
- zip/unzip: Create/extract zip archives
## 10. Text Processing:
## 11. 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
## 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.
- <: Read input from a file
- |: Pipe output of one command to another
- |: Pipe output of one command to another "command chaining"
## 12. User Management:
## 13. User Management:
- useradd: Add a new user
- userdel: Delete a user
- passwd: Change user password
## 13. Advanced Commands:
## 14. 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:
## 15. Shell Scripting:
- Variables: var_name=value
- Conditionals: if, elif, else
- Loops: for, while
- Functions: function_name() { commands; }
## 15. Job Control:
## 16. Job Control:
- jobs: List active jobs
- &: Run a command in the background
- Ctrl+Z: Suspend a running process

View File

@ -1,30 +0,0 @@
#
1. **Opening the Terminal**:
- You can open the terminal in various ways:
- **Shortcut**: Press `Ctrl + Alt + T`.
- **Specific Directory**: Open the terminal in a specific directory.
- **Application Menu**: Search for "Terminal" in your applications.
- **Command**: Use the `gnome-terminal` command.
2. **Basic Commands**:
- Once you're in the terminal, try these commands:
- `pwd`: Print the current working directory.
- `ls`: List files and directories.
- `cd`: Change directory.
- `mkdir`: Create a new directory.
- `cp`: Copy files or directories.
- `mv`: Move files or rename them.
- `rm`: Remove files or directories.
- `clear`: Clear the terminal screen.
3. **Superuser Powers**:
- Some tasks require administrator privileges. Use `sudo` before a command to execute it as the superuser.
- Be cautious with superuser access—it's powerful!
- [(1) Beginner's Guide To The Linux Terminal.](https://www.youtube.com/watch?v=s3ii48qYBxA.)
- [(2) Linux Terminal Introduction.](https://www.youtube.com/watch?v=SkB-eRCzWIU.)
- [(3) Linux Terminal Basics | Navigate the File System on Ubuntu.](https://www.youtube.com/watch?v=jgcXclSXnVo.)
- [(4) The Linux command line for beginners | Ubuntu.](https://ubuntu.com/tutorials/command-line-for-beginners.)
- [(5) What is Terminal in Linux? [The Ultimate Guide] - LinuxSimply.](https://linuxsimply.com/what-is-terminal-in-linux/.)

View File

@ -51,4 +51,7 @@ The process of building the kernel from source code after configuration. Kernel
### 11. Kernel Development Model:
The Linux kernel follows an open-source development model. Linus Torvalds oversees the project, with numerous contributors worldwide.
### 12. External Sources:
[Linux Kernel](https://kernel.org)
Understanding these aspects of the Linux kernel provides a solid foundation for kernel configuration. It helps in making informed decisions about which components to include or exclude based on your system's requirements.

View File

@ -7,48 +7,32 @@ Yum (Yellowdog Updater Modified) is the primary package management tool for Red
### 2. Basic Yum Commands
- Searching for packages:
```
yum search keyword
```
`yum search keyword`
- Getting information about a package:
```
yum info package_name
```
`yum info package_name`
- Installing a package:
```
sudo yum install package_name
```
`sudo yum install package_name`
- Removing a package:
```
sudo yum remove package_name
```
`sudo yum remove package_name`
- Updating all packages:
```
sudo yum update
```
`sudo yum update`
- Updating a specific package:
```
sudo yum update package_name
```
`sudo yum update package_name`
### 3. Working with Repositories
Yum uses repositories to fetch package information and the packages themselves.
- Listing enabled repositories:
```
yum repolist
```
`yum repolist`
- Listing all repositories (including disabled):
```
yum repolist all
```
`yum repolist all`
- Adding a new repository:
Create a .repo file in /etc/yum.repos.d/ with the following structure:
@ -63,99 +47,67 @@ gpgkey=http://repository.url/RPM-GPG-KEY
```
- Enabling/disabling a repository:
```
sudo yum-config-manager --enable repository_id
sudo yum-config-manager --disable repository_id
```
- `sudo yum-config-manager --enable repository_id`
- `sudo yum-config-manager --disable repository_id`
### 4. Managing Package Groups
Yum can install predefined groups of packages.
- Listing available groups:
```
yum group list
```
`yum group list`
- Getting info about a group:
```
yum group info "group_name"
```
`yum group info "group_name"`
- Installing a group:
```
sudo yum group install "group_name"
```
`sudo yum group install "group_name"`
- Removing a group:
```
sudo yum group remove "group_name"
```
`sudo yum group remove "group_name"`
### 5. Yum Cache Management
Yum maintains a cache to speed up operations.
- Cleaning all cached packages and metadata:
```
sudo yum clean all
```
`sudo yum clean all`
- Cleaning only cached packages:
```
sudo yum clean packages
```
`sudo yum clean packages`
- Cleaning only cached metadata:
```
sudo yum clean metadata
```
`sudo yum clean metadata`
### 6. Advanced Yum Features
- Downloading a package without installing:
```
yumdownloader package_name
```
`yumdownloader package_name`
- Installing a local RPM package with Yum (to resolve dependencies):
```
sudo yum localinstall package_name.rpm
```
`sudo yum localinstall package_name.rpm`
- Checking for available updates:
```
yum check-update
```
`yum check-update`
- Listing installed packages:
```
yum list installed
```
`yum list installed`
- Listing available packages:
```
yum list available
```
`yum list available`
### 7. Yum History
Yum keeps a history of transactions, allowing you to undo or redo actions.
- Viewing Yum history:
```
yum history list
```
`yum history list`
- Undoing a transaction:
```
sudo yum history undo transaction_id
```
`sudo yum history undo transaction_id`
- Redoing a transaction:
```
sudo yum history redo transaction_id
```
`sudo yum history redo transaction_id`
### 8. Yum Configuration
@ -176,30 +128,20 @@ Yum's functionality can be extended with plugins. Some useful plugins include:
- yum-plugin-versionlock: Locks specified packages to a particular version
To install a plugin:
```
sudo yum install plugin_name
```
`sudo yum install plugin_name`
### 10. Troubleshooting
If you encounter issues with Yum, try these steps:
- Clear the Yum cache:
```
sudo yum clean all
```
`sudo yum clean all`
- Rebuild the Yum cache:
```
sudo yum makecache
```
`sudo yum makecache`
- Check for conflicting transactions:
```
sudo yum-complete-transaction --cleanup-only
```
`sudo yum-complete-transaction --cleanup-only`
- Verify the package database:
```
sudo yum check
```
`sudo yum check`

View File

@ -8,9 +8,7 @@
Before installing or upgrading packages, it's important to update your local package lists:
```bash
sudo apt-get update
```
`sudo apt-get update`
This command synchronizes your package lists with the repositories.
@ -18,73 +16,53 @@ This command synchronizes your package lists with the repositories.
To upgrade all installed packages to their latest versions:
```bash
sudo apt-get upgrade
```
`sudo apt-get upgrade`
For a more aggressive upgrade that might remove obsolete packages:
```bash
sudo apt-get dist-upgrade
```
`sudo apt-get dist-upgrade`
### 4. Installing Packages
To install a new package:
```bash
sudo apt-get install package_name
```
`sudo apt-get install package_name`
You can install multiple packages at once:
```bash
sudo apt-get install package1 package2 package3
```
`sudo apt-get install package1 package2 package3`
### 5. Removing Packages
To remove a package:
```bash
sudo apt-get remove package_name
```
`sudo apt-get remove package_name`
To remove the package along with its configuration files:
```bash
sudo apt-get purge package_name
```
`sudo apt-get purge package_name`
### 6. Searching for Packages
To search for a package:
```bash
apt-cache search keyword
```
`apt-cache search keyword`
### 7. Displaying Package Information
To show detailed information about a package:
```bash
apt-cache show package_name
```
`apt-cache show package_name`
### 8. Cleaning Up
To remove unnecessary packages:
```bash
sudo apt-get autoremove
```
`sudo apt-get autoremove`
To clear out the local repository of retrieved package files:
```bash
sudo apt-get clean
```
`sudo apt-get clean`
### 9. Handling Dependencies
@ -98,23 +76,17 @@ Package sources are defined in `/etc/apt/sources.list` and in files under `/etc/
To prevent a package from being automatically upgraded:
```bash
sudo apt-mark hold package_name
```
`sudo apt-mark hold package_name`
To remove the hold:
```bash
sudo apt-mark unhold package_name
```
`sudo apt-mark unhold package_name`
### 12. Simulating Operations
You can simulate operations without actually performing them using the `-s` flag:
```bash
sudo apt-get -s install package_name
```
`sudo apt-get -s install package_name`
This is useful for seeing what would happen without making any changes.

View File

@ -1,193 +1,148 @@
# Process Monitoring and Management in Linux
### 1. Viewing Running Processes
## 1. Viewing Running Processes
Let's start with the basic commands to view running processes:
- ps - Process Status
### ps - Process Status
The 'ps' command provides a snapshot of current processes.
Basic usage:
```
ps
```
`ps
Common options:
- `ps aux`: Shows all processes for all users
- `ps -ef`: Similar to aux, but in a different format
- `ps lax`: Provides more detailed information
- `-aux`: Shows all processes for all users
- `-ef`: Similar to aux, but in a different format
- `-lax`: Provides more detailed information
- top - Table of Processes
### top - Table of Processes
'top' provides a real-time, dynamic view of running processes.
Basic usage:
```
top
```
`top`
In top, you can use:
- 'q' to quit
- 'k' to kill a process (you'll be prompted for the PID)
- 'r' to renice (change priority) of a process
- htop - Interactive Process Viewer
### htop - Interactive Process Viewer
'htop' is an improved version of 'top' with a more user-friendly interface.
Install it (if not already installed):
```
sudo apt install htop # For Debian/Ubuntu
sudo yum install htop # For CentOS/RHEL
```
- `sudo apt install htop` # For Debian/Ubuntu
- `sudo yum install htop` # For CentOS/RHEL
Run it:
```
htop
```
`htop`
### 2. Process Management
## 2. Process Management
- kill - Terminate a Process
### kill - Terminate a Process
The 'kill' command sends a signal to a process, by default the TERM signal.
Basic usage:
```
kill PID
```
`kill PID`
Common signals:
- SIGTERM (15): Graceful termination
- SIGKILL (9): Forceful termination
Example:
```
kill -9 1234
```
`kill -9 1234`
- killall - Kill Processes by Name
### killall - Kill Processes by Name
'killall' allows you to kill all processes with a given name.
Example:
```
killall firefox
```
`killall firefox`
- pkill - Kill Processes Based on Name and Other Attributes
### pkill - Kill Processes Based on Name and Other Attributes
'pkill' is more flexible than killall, allowing you to kill processes based on various attributes.
Example:
```
pkill -u username firefox
```
`pkill -u username firefox`
- nice and renice - Adjust Process Priority
### nice and renice - Adjust Process Priority
'nice' starts a process with a specified priority, while 'renice' changes the priority of a running process.
Nice values range from -20 (highest priority) to 19 (lowest priority).
Example:
```
nice -n 10 command # Start 'command' with lower priority
renice -n 5 -p PID # Change priority of running process
```
- `nice -n 10 command` # Start 'command' with lower priority
- `renice -n 5 -p PID` # Change priority of running process
### 3. Background and Foreground Processes
## 3. Background and Foreground Processes
- Start a process in the background:
```
command &
```
### Start a process in the background:
`command &`
- Move a running process to the background:
### Move a running process to the background:
Press Ctrl+Z
- Bring a background process to the foreground:
```
fg %job_number
```
### Bring a background process to the foreground:
`fg %job_number`
- List background jobs:
```
jobs
```
### List background jobs:
`jobs`
### 4. Advanced Monitoring Tools
## 4. Advanced Monitoring Tools
- iotop - I/O Monitoring
### iotop - I/O Monitoring
'iotop' shows I/O usage by processes.
Install:
```
sudo apt install iotop # For Debian/Ubuntu
sudo yum install iotop # For CentOS/RHEL
```
- `sudo apt install iotop # For Debian/Ubuntu`
- `sudo yum install iotop # For CentOS/RHEL`
Run:
```
sudo iotop
```
`sudo iotop`
- nethogs - Network Monitoring
### nethogs - Network Monitoring
'nethogs' shows network usage by process.
Install:
```
sudo apt install nethogs # For Debian/Ubuntu
sudo yum install nethogs # For CentOS/RHEL
```
- `sudo apt install nethogs` # For Debian/Ubuntu
- `sudo yum install nethogs` # For CentOS/RHEL
Run:
```
sudo nethogs
```
`sudo nethogs`
- lsof - List Open Files
### lsof - List Open Files
'lsof' lists open files and the processes using them.
Example (list all network connections):
```
sudo lsof -i
```
`sudo lsof -i`
### 5. System Monitoring
## 5. System Monitoring
- free - Display Amount of Free and Used Memory
```
free -h # -h for human-readable format
```
### free - Display Amount of Free and Used Memory
`free -h` # -h for human-readable format
- vmstat - Report Virtual Memory Statistics
```
vmstat 1 # Report every second
```
### vmstat - Report Virtual Memory Statistics
`vmstat 1` # Report every second
- iostat - Report CPU Statistics and I/O Statistics
```
iostat 1 # Report every second
```
### iostat - Report CPU Statistics and I/O Statistics
`iostat 1` # Report every second
### 6. Process Tracking and Analysis
## 6. Process Tracking and Analysis
- strace - Trace System Calls and Signals
### strace - Trace System Calls and Signals
'strace' is useful for diagnosing problems with processes.
Example:
```
strace command
```
`strace command`
- ltrace - Library Call Tracer
### ltrace - Library Call Tracer
'ltrace' is similar to strace but for library calls.
Example:
```
ltrace command
```
`ltrace command`
### 7. Continuous Monitoring with watch
## 7. Continuous Monitoring with watch
The 'watch' command allows you to run any command periodically, showing output in fullscreen.
Example (update process list every 2 seconds):
```
watch -n 2 'ps aux | sort -nrk 3,3 | head -n 5'
```
Example (update process list every 2 seconds and look at top 5 lines of output):
- `watch -n 2 'ps aux | sort -nrk 3,3 | head -n 5'`

View File

@ -1,10 +1,10 @@
# Understanding and Using SystemD
### 1. Introduction to systemd
## 1. Introduction to systemd
systemd is an init system and system manager that has become the standard for many Linux distributions. It was designed to overcome limitations in the traditional SysV init system, providing faster boot times, dependency-based service control, and a unified interface for managing system services.
### 2. Core Concepts
## 2. Core Concepts
- Units: The basic building blocks of systemd. Units can represent services, devices, mount points, and more.
- Dependencies: systemd manages relationships between units, ensuring they start in the correct order.
@ -12,7 +12,7 @@ systemd is an init system and system manager that has become the standard for ma
- Sockets: Allow for service activation on demand.
- Timers: Provide cron-like functionality for scheduling tasks.
### 3. Unit Files
## 3. Unit Files
Unit files are configuration files that define how systemd should manage a unit. They are typically located in /etc/systemd/system/ or /usr/lib/systemd/system/.
@ -31,23 +31,22 @@ Restart=always
WantedBy=multi-user.target
```
### 4. Basic systemd Commands
## 4. Basic systemd Commands
- systemctl: The main command for interacting with systemd
- journalctl: Used for viewing logs
- systemd-analyze: Analyzes system boot-up performance
Common systemctl commands:
```
systemctl start service-name
systemctl stop service-name
systemctl restart service-name
systemctl status service-name
systemctl enable service-name
systemctl disable service-name
```
- `systemctl start service-name`
- `systemctl stop service-name`
- `systemctl restart service-name`
- `systemctl status service-name`
- `systemctl enable service-name`
- `systemctl disable service-name`
### 5. Managing Services
## 5. Managing Services
To create a new service:
1. Create a unit file in /etc/systemd/system/ (e.g., myservice.service)
@ -55,7 +54,7 @@ To create a new service:
3. Reload the systemd manager: `systemctl daemon-reload`
4. Start and enable the service: `systemctl start myservice && systemctl enable myservice`
### 6. System Boot and Target Units
## 6. System Boot and Target Units
systemd uses target units to manage the boot process. Key targets include:
- poweroff.target
@ -64,11 +63,9 @@ systemd uses target units to manage the boot process. Key targets include:
- graphical.target
To change the default target:
```
systemctl set-default graphical.target
```
`systemctl set-default graphical.target`
### 7. Logging with journald
## 7. Logging with journald
journald is systemd's logging system. Key features:
- Collects messages from the kernel, services, and applications
@ -76,13 +73,12 @@ journald is systemd's logging system. Key features:
- Supports structured logging
Basic journalctl usage:
```
journalctl -u service-name # View logs for a specific service
journalctl -f # Follow new log entries
journalctl --since "1 hour ago" # View recent logs
```
- `journalctl -u service-name` # View logs for a specific service
- `journalctl -f` # Follow new log entries
- `journalctl --since "1 hour ago"` # View recent logs
### 8. Advanced Features
## 8. Advanced Features
- Socket Activation: Services start on-demand when a client connects to their socket.
- Resource Control: Limit CPU, memory, and other resources for services.
@ -96,7 +92,7 @@ CPUQuota=20%
MemoryLimit=100M
```
### 9. Troubleshooting
## 9. Troubleshooting
- Check service status: `systemctl status service-name`
- View recent logs: `journalctl -u service-name -n 50 --no-pager`

View File

@ -10,15 +10,11 @@ Linux uses network interfaces to communicate with networks. Common interfaces in
To list network interfaces:
```
ip link show
```
`ip link show`
or
```
ifconfig -a
```
`ifconfig -a`
## 2. IP Address Configuration
@ -26,15 +22,11 @@ ifconfig -a
- To set an IP address temporarily:
```
sudo ip addr add 192.168.1.100/24 dev eth0
```
`sudo ip addr add 192.168.1.100/24 dev eth0`
- To remove an IP address:
```
sudo ip addr del 192.168.1.100/24 dev eth0
```
`sudo ip addr del 192.168.1.100/24 dev eth0`
### Permanent IP configuration:
@ -71,9 +63,7 @@ Many modern Linux distributions use Network Manager for easier network configura
Set the hostname:
```
sudo hostnamectl set-hostname new-hostname
```
`sudo hostnamectl set-hostname new-hostname`
Update /etc/hosts file to include the new hostname.
@ -92,15 +82,11 @@ Note: This file may be overwritten by DHCP. For permanent changes, configure you
View routing table:
```
ip route show
```
`ip route show`
Add a static route:
```
sudo ip route add 10.0.0.0/24 via 192.168.1.1 dev eth0
```
`sudo ip route add 10.0.0.0/24 via 192.168.1.1 dev eth0`
## 8. Firewall Configuration
@ -108,15 +94,11 @@ Most Linux distributions use iptables or nftables. Ubuntu uses ufw (Uncomplicate
Enable UFW:
```
sudo ufw enable
```
`sudo ufw enable`
Allow incoming SSH:
```
sudo ufw allow ssh
```
`sudo ufw allow ssh`
## 9. Network Diagnostics
@ -129,27 +111,22 @@ sudo ufw allow ssh
Start/stop network service:
```
sudo systemctl start networking
sudo systemctl stop networking
```
`sudo systemctl start networking`
`sudo systemctl stop networking`
Enable/disable network service at boot:
```
sudo systemctl enable networking
sudo systemctl disable networking
```
`sudo systemctl enable networking`
`sudo systemctl disable networking`
## 11. Wireless Network Configuration
Use 'iwconfig' to configure wireless interfaces:
```
sudo iwconfig wlan0 essid "NetworkName" key s:password
```
`sudo iwconfig wlan0 essid "NetworkName" key s:password` #Not advised because it will leave your network password in the bash history!
For WPA networks, use 'wpa_supplicant'.
For WPA networks, use 'wpa_supplicant'.
- `wpa_passphrase [ESSID] > /etc/wpa_supplicant/wpa_supplicanmt-[DEVICENAME].conf`. You will then be prompted to enter the password.
## 12. Network Bonding
@ -167,10 +144,3 @@ iface bond0 inet static
bond-primary eth0
```
- [(1) The Ultimate Guide to Linux Mint Network Configuration.](https://www.fosslinux.com/105545/the-ultimate-guide-to-linux-mint-network-configuration.htm.)
- [(2) How to set up an Internet Connection in Linux Mint?.](https://unix.stackexchange.com/questions/132747/how-to-set-up-an-internet-connection-in-linux-mint.)
- [(3) How to Share Files and Folders on a Linux Mint Network.](https://www.fosslinux.com/103443/how-to-easily-share-files-and-folders-on-a-linux-mint-network.htm.)
- [(4) Linux Mint - Community.](https://community.linuxmint.com/tutorial/view/1966.)
- [(5) Configure Network in Debian / Ubuntu / LinuxMint - ITzGeek.](https://www.itzgeek.com/how-tos/linux/ubuntu-how-tos/configure-network-in-ubuntu-14-04-linux-mint.html.)

View File

@ -23,14 +23,16 @@ Key features:
- IPv6 support
Basic UFW commands:
```
sudo ufw enable # Enable the firewall
sudo ufw disable # Disable the firewall
sudo ufw status # Check firewall status
sudo ufw allow 22 # Allow incoming traffic on port 22 (SSH)
sudo ufw deny 80 # Deny incoming traffic on port 80 (HTTP)
sudo ufw allow from 192.168.1.0/24 # Allow traffic from a specific subnet
```
- `sudo ufw enable` # Enable the firewall
- `sudo ufw disable` # Disable the firewall
- `sudo ufw status` # Check firewall status
`sudo ufw status numbered` # List the current ufw rules and their associated rule number
`sudo ufw delete RULENUM` # Delete the firewall rule by number
- `sudo ufw allow 22` # Allow incoming traffic on port 22 (SSH)
- `sudo ufw deny 80` # Deny incoming traffic on port 80 (HTTP)
- `sudo ufw allow from 192.168.1.0/24` # Allow traffic from a specific subnet
- `sudo ufw allow 32400/tcp` # Open port for Plex Server - ONLY accepting TCP traffic.
Advanced usage:
- Rate limiting: `sudo ufw limit 22/tcp`
@ -46,14 +48,12 @@ Key features:
- Runtime and permanent configuration options
- D-Bus interface for easy integration with other applications
Basic firewalld commands:
```
sudo systemctl start firewalld # Start firewalld
sudo systemctl enable firewalld # Enable firewalld to start on boot
sudo firewall-cmd --state # Check firewalld status
sudo firewall-cmd --zone=public --add-service=http # Allow HTTP traffic in the public zone
sudo firewall-cmd --zone=internal --add-source=192.168.1.0/24 # Add a source to the internal zone
```
- Basic firewalld commands:
- `sudo systemctl start firewalld` # Start firewalld
- `sudo systemctl enable firewalld` # Enable firewalld to start on boot
- `sudo firewall-cmd --state` # Check firewalld status
- `sudo firewall-cmd --zone=public --add-service=http` # Allow HTTP traffic in the public zone
- `sudo firewall-cmd --zone=internal --add-source=192.168.1.0/24` # Add a source to the internal zone
Advanced usage:
- Custom services: `sudo firewall-cmd --new-service=myapp`
@ -66,6 +66,7 @@ Advanced usage:
- Simpler, more straightforward for basic setups
- Ideal for single-host systems or simple network configurations
- Easier to learn for beginners
- Has a GUI (gufw) that can be installed. `sudo apt update && sudo apt install gufw`
### firewalld:
- More flexible and powerful for complex network setups
@ -85,10 +86,8 @@ Advanced usage:
- Test connections with tools like `netcat` or `telnet`
- Temporarily disable the firewall to isolate issues
## 8. Advanced Topics
## 8. Advanced Topics (Coming Soon)
- Stateful vs. stateless firewalls
- Network Address Translation (NAT) configuration
- Setting up DMZ (Demilitarized Zone)
- Integrating with intrusion detection/prevention systems (IDS/IPS)
This guide provides a comprehensive overview of Linux firewalls, focusing on UFW and firewalld. Each tool has its strengths, and the choice between them often depends on the specific requirements of your system and network configuration.

View File

@ -1,37 +0,0 @@
Certainly! Let's explore how to manage firewalls in **Linux Mint** using the terminal. There are a couple of options available:
## 1. **UFW (Uncomplicated Firewall)**:
- UFW is a straightforward and reliable firewall interface with both command-line and graphical tools.
- To install UFW, open the terminal and run:
```
sudo apt install ufw
```
- Verify if UFW is active with:
```
sudo systemctl status ufw
```
- To allow specific ports (e.g., OpenSSH), use:
```
sudo ufw allow 22/tcp
```
- To disable a port, run:
```
sudo ufw deny 22/tcp
```
2. **Gufw (GUI for UFW)**:
- Gufw provides a graphical interface for managing UFW.
- Install it with:
```
sudo apt install gufw
```
- Open it from the menu: "Firewall Configuration."
- For example: In Firewall configuration make sure Port TCP:32400 is open for Plex Server.
Remember, firewalls protect your network by filtering traffic based on predefined rules. Choose the method that suits your preference! 😊🔥
Source: Conversation with Copilot, 7/12/2024
- [(1) How to open a firewall on Linux Mint | FOSS Linux.](https://www.fosslinux.com/50961/open-a-firewall-on-linux-mint.htm.)
- [(2) Linux Mint - Community.](https://community.linuxmint.com/tutorial/view/1899.)
- [(3) LINUX Firewall - GeeksforGeeks.](https://www.geeksforgeeks.org/linux-firewall/.)
- [(4) firewalld-cmd Command in Linux: 24 Examples.](https://linuxhandbook.com/firewalld-cmd/.)

View File

@ -3,220 +3,122 @@
## 1. Basic Network Configuration Check:
- Check IP address and network interface status:
```
ip addr show
```
This command displays all network interfaces, their IP addresses, and status.
- `ip addr show` # This command displays all network interfaces, their IP addresses, and status.
- Verify default gateway:
```
ip route show
```
Ensures your system knows how to route traffic outside the local network.
- `ip route show` # Ensures your system knows how to route traffic outside the local network.
- Check DNS configuration:
```
cat /etc/resolv.conf
```
Displays the DNS servers your system is using.
- `cat /etc/resolv.conf` # Displays the DNS servers your system is using.
## 2. Connectivity Tests:
- Ping test:
```
ping -c 4 8.8.8.8
```
Tests basic connectivity to Google's DNS server (or any other IP).
- `ping -c 4 8.8.8.8` # Tests basic connectivity to Google's DNS server (or any other IP). Only pings 4 times (-c 4)
- Traceroute:
```
traceroute google.com
```
Shows the path packets take to reach a destination.
- `traceroute google.com` # Shows the path packets take to reach a destination.
- DNS resolution test:
```
nslookup google.com
```
or
```
dig google.com
```
These test DNS resolution capabilities.
- `nslookup google.com` # These test DNS resolution capabilities.
- `dig google.com` # These test DNS resolution capabilities.
## 3. Advanced Diagnostic Tools:
- netstat or ss:
```
netstat -tuln
```
or
```
ss -tuln
```
Display active network connections and listening ports.
- `netstat -tulpn` # Display active network connections and listening ports.
- `ss -tulpn` # Display active network connections and listening ports.
- tcpdump:
```
sudo tcpdump -i eth0
```
Captures and displays packet data on a specified interface.
- `sudo tcpdump -i eth0` # eth0 is the Device name. Captures and displays packet data on a specified interface.
- nmap:
```
nmap -p- localhost
```
Scans for open ports on the local machine (or any specified target).
- `nmap -p- localhost` # Scans every port on the local machine (or any specified target).
## 4. Firewall Configuration:
- Check iptables rules:
```
sudo iptables -L -v -n
```
Displays current firewall rules.
- `sudo iptables -L -v -n` # Displays current firewall rules.
- Temporarily disable firewall (for testing):
```
sudo systemctl stop firewalld # for systems using firewalld
```
or
```
sudo ufw disable # for systems using ufw
```
- `sudo systemctl stop firewalld` # Stops firewalld on the current boot - will start at next boot if enabled
- `sudo ufw disable` # Disables firewalld at system boot and stops it immedietely
## 5. Network Service Diagnostics:
- Check service status:
```
systemctl status networking
```
or
```
systemctl status NetworkManager
```
- `systemctl status networking`
- `systemctl status NetworkManager`
- Restart network service:
```
sudo systemctl restart networking
```
or
```
sudo systemctl restart NetworkManager
```
- `sudo systemctl restart networking`
- `sudo systemctl restart NetworkManager`
## 6. Network Interface Configuration:
- Edit network interface configuration:
```
sudo nano /etc/network/interfaces # for Debian-based systems
```
or
```
sudo nano /etc/sysconfig/network-scripts/ifcfg-eth0 # for Red Hat-based systems
```
- `sudo nano /etc/network/interfaces` # for Debian-based systems
- `sudo nano /etc/sysconfig/network-scripts/ifcfg-eth0` # for Red Hat-based systems
- Restart specific network interface:
```
sudo ifdown eth0 && sudo ifup eth0
```
or
```
sudo ip link set eth0 down && sudo ip link set eth0 up
```
- `sudo ifdown eth0 && sudo ifup eth0`
- `sudo ip link set eth0 down && sudo ip link set eth0 up`
## 7. Wireless Network Troubleshooting:
- List available wireless networks:
```
sudo iwlist wlan0 scan
```
- `sudo iwlist wlan0 scan`
- Check wireless interface details:
```
iwconfig
```
- `iwconfig`
- Monitor wireless connection in real-time:
```
watch -n 1 iwconfig
```
- `watch -n 1 iwconfig`
## 8. Advanced Network Analysis:
- Wireshark: GUI-based packet analyzer
Install with:
```
sudo apt-get install wireshark # on Debian-based systems
```
or
```
sudo yum install wireshark # on Red Hat-based systems
```
- `sudo apt-get install wireshark` # on Debian-based systems
- `sudo yum install wireshark` # on Red Hat-based systems
- iftop: Displays bandwidth usage on an interface
```
sudo iftop -i eth0
```
- `sudo iftop -i eth0`
- nethogs: Groups bandwidth by process
```
sudo nethogs eth0
```
- `sudo nethogs eth0`
## 9. Performance Testing:
- iperf: Network performance measurement tool
```
iperf -s # on server
iperf -c server_ip # on client
```
- `iperf -s` # on server
- `iperf -c server_ip` # on client
- speedtest-cli: Command-line interface for testing internet speed
```
speedtest-cli
```
`speedtest-cli`
## 10. Log Analysis:
- System logs:
```
sudo tail -f /var/log/syslog # on Debian-based systems
```
or
```
sudo tail -f /var/log/messages # on Red Hat-based systems
```
or
```
sudo journalctl -b0
```
or
```
sudo dmesg -k
```
- `sudo tail -f /var/log/syslog` # on Debian-based systems
- `sudo tail -f /var/log/messages` # on Red Hat-based systems
- `sudo journalctl -b0`
- `sudo dmesg -k`
- Network-specific logs:
```
sudo tail -f /var/log/daemon.log
```
- `sudo tail -f /var/log/daemon.log`
## 11. Network Configuration Backup and Restore:
- Backup network configuration:
```
sudo tar -czvf network_config_backup.tar.gz /etc/network
```
- Backup network configuration:
- `sudo tar -czvf network_config_backup.tar.gz /etc/network` # Create a file called network_config_backup.tar.gz from the /etc/network directory
- Restore network configuration:
```
sudo tar -xzvf network_config_backup.tar.gz -C /
```
- Restore network configuration:
- `sudo tar -xzvf network_config_backup.tar.gz -C /`
## 12. Troubleshooting Specific Issues:
- High latency: Use ping and traceroute to identify where delays occur.
- Packet loss: Use mtr (My TraceRoute) for a combination of ping and traceroute.
- DNS issues: Check /etc/hosts file and DNS server configurations.
- IP conflicts: Use arping to detect duplicate IP addresses on the network.
- High latency: Use ping and traceroute to identify where delays occur.
- Packet loss: Use mtr (My TraceRoute) for a combination of ping and traceroute.
- DNS issues: Check /etc/hosts file and DNS server configurations.
- IP conflicts: Use arping to detect duplicate IP addresses on the network.

View File

@ -1,27 +0,0 @@
## Certainly! To use SSH in **Linux Mint**, follow these steps:
1. **Install OpenSSH Server**:
- Open a terminal by clicking the terminal icon in the taskbar.
- Install the OpenSSH server package with this command (use root privileges): `sudo apt-get install openssh-server -y`.
2. **Check SSH Status**:
- SSH should be configured to start automatically on boot. Confirm this with:
```
systemctl is-enabled ssh
```
- If it's disabled, enable it using: `sudo systemctl enable ssh`.
3. **Test SSH Access**:
- Find your Linux Mint machine's IP address (e.g., `192.168.1.20`) using `ip a`.
- Use PuTTY or any SSH client to connect: `ssh username@192.168.1.20`.
- Enter your password when prompted¹.
Feel free to ask if you need further assistance! 😊🚀
Source: Conversation with Copilot, 7/12/2024
- [(1) How To Enable SSH in Linux Mint - RootUsers.](https://www.rootusers.com/enable-ssh-linux-mint/.)
- [(2) How-to Guide Linux Networking with SSH - Linux Mint Forums.](https://forums.linuxmint.com/viewtopic.php?t=13695.)
- [(3) Linux Mint - Community.]( https://community.linuxmint.com/tutorial/view/83.)
- [(4) How to Install and Enable SSH on Linux Mint 21 LinuxWays.](https://linuxways.net/mint/install-enable-ssh-linux-mint-21/.)
- [(5) Linux Mint - Community.](https://community.linuxmint.com/tutorial/view/244.)
- [(6) en.wikipedia.org.](https://en.wikipedia.org/wiki/Linux_Mint.)

View File

@ -29,7 +29,7 @@ SSH operates on a client-server model. The process typically involves:
## 5. SSH Key Management
- Generating Keys: Use `ssh-keygen` to create key pairs.
- Generating Keys: Use `ssh-keygen -t ed25519 -a 32` to create key pairs. (stored in ~/.ssh/ by default)
- Key Types: RSA, DSA, ECDSA, Ed25519 (Ed25519 is recommended for new deployments).
- Key Size: Larger keys are more secure but slower (e.g., 4096-bit RSA).
- Passphrase: An extra layer of security for private keys.
@ -37,10 +37,10 @@ SSH operates on a client-server model. The process typically involves:
## 6. Common SSH Commands
- `ssh user@hostname`: Basic connection command.
- `scp`: Secure copy files between hosts.
- `sftp`: Secure file transfer protocol.
- `scp user@hostname:/full/source/path ~/destination`: Secure copy files between hosts.
- `sftp user@hostname`: Secure file transfer protocol.
- `ssh-keygen`: Generate SSH key pairs.
- `ssh-copy-id`: Copy public key to a remote host.
- `ssh-copy-id user@hostname`: Copy your public key to a remote host.
## 7. SSH Configuration
@ -48,16 +48,16 @@ SSH operates on a client-server model. The process typically involves:
- Server Configuration: `/etc/ssh/sshd_config`
- Important settings:
- Port (default 22)
- PermitRootLogin
- PasswordAuthentication
- PubkeyAuthentication
- PermitRootLogin : Usually commented out to disable root from using SSH.
- PasswordAuthentication: Set to no if you want to only use RSA keys
- PubkeyAuthentication: Set to yes if you want to use RSA keys for authentication.
## 8. SSH Security Best Practices
- Use key-based authentication instead of passwords.
- Disable root login.
- Use non-standard ports.
- Implement fail2ban or similar intrusion prevention systems.
- Implement fail2ban or similar intrusion prevention systems. (sudo apt install fail2ban).
- Keep software up-to-date.
- Use SSH protocol version 2.
- Limit user access with AllowUsers or AllowGroups.
@ -65,21 +65,21 @@ SSH operates on a client-server model. The process typically involves:
## 9. Advanced SSH Features
- Port Forwarding: Local, Remote, and Dynamic.
- X11 Forwarding: Run graphical applications remotely.
- X11 Forwarding: Run graphical applications remotely. (Virtual Network Connections among others)
- SSH Agent: Manage multiple SSH keys.
- ProxyJump: Easily connect through a jump host.
## 10. Troubleshooting SSH
- Connection Issues: Check network, firewall, and SSH service status.
- Authentication Problems: Verify credentials, key permissions, and server configuration.
- Authentication Problems: Verify credentials, key permissions (`chmod 600 ~/.ssh/id_rsa*`), and server configuration.
- Performance Issues: Consider compression or alternative ciphers.
## 11. SSH Alternatives and Related Protocols
- Telnet: Older, unencrypted protocol (not recommended).
- RDP: Remote Desktop Protocol (mainly for Windows).
- VNC: Virtual Network Computing (graphical desktop sharing).
- Telnet: Older, unencrypted protocol (not recommended - INSECURE).
- RDP: Remote Desktop Protocol - allows a full desktop (mainly for Windows).
- VNC: Virtual Network Computing - allows a full desktop (graphical desktop sharing).
## 12. SSH in Enterprise Environments
@ -87,4 +87,3 @@ SSH operates on a client-server model. The process typically involves:
- Integration with LDAP or Active Directory.
- Auditing and logging considerations.
- Bastion hosts for added security.

View File

@ -8,22 +8,17 @@ VPNs (Virtual Private Networks) provide secure, encrypted connections over publi
OpenVPN is one of the most popular and secure VPN protocols. To set it up:
- 1. Install OpenVPN:
```
sudo apt install openvpn
```
`sudo apt install openvpn`
- 2. Obtain configuration files from your VPN provider.
Varies on each provider
- 3. Connect to the VPN:
```
sudo openvpn --config /path/to/your/config.ovpn
```
`sudo openvpn --config /path/to/your/config.ovpn`
- 4. For automatic connection, create a systemd service:
```
sudo nano /etc/systemd/system/openvpn.service
```
Add the following content:
`sudo nano /etc/systemd/system/openvpn.service`
- Add the following content:
```
[Unit]
Description=OpenVPN connection to YOUR_VPN
@ -38,34 +33,23 @@ WantedBy=multi-user.target
```
Enable and start the service:
```
sudo systemctl enable openvpn.service
sudo systemctl start openvpn.service
```
- `sudo systemctl enable --now openvpn.service` # Starts OpenVPN right "now" and "enable"s it on next boot as well
- `sudo systemctl start openvpn.service` # Just "start"s OpenVPN for the current boot.
### WireGuard:
WireGuard is a newer, faster VPN protocol. To set it up:
- a. Install WireGuard:
```
sudo apt install wireguard
```
- a. Install WireGuard: `sudo apt install wireguard`
- b. Create a configuration file:
```
sudo nano /etc/wireguard/wg0.conf
```
Add your WireGuard configuration details.
- b. Create a configuration file: `sudo nano /etc/wireguard/wg0.conf`
-Add your WireGuard configuration details specific to your vendor.
- c. Start the WireGuard connection:
```
sudo wg-quick up wg0
```
- sudo wg-quick up wg0`
- d. To enable automatic connection on boot:
```
sudo systemctl enable wg-quick@wg0
```
- d. To "enable" automatic connection on boot and right "now":
- `sudo systemctl enable --now wg-quick@wg0`
### Built-in VPN clients:
Many Linux distributions include built-in VPN clients in their network managers, supporting protocols like OpenVPN, L2TP/IPsec, and PPTP.
@ -76,6 +60,7 @@ Proxies route your traffic through an intermediary server. There are several way
### Environment variables:
Set these variables in your shell configuration file (e.g., ~/.bashrc):
```
export http_proxy="http://proxy_server:port"
export https_proxy="http://proxy_server:port"
@ -102,41 +87,29 @@ Many applications have their own proxy settings. For example:
Use proxychains to route terminal commands through a proxy:
#### 1. Install proxychains:
```
sudo apt install proxychains
```
`sudo apt install proxychains`
#### 2. Configure proxychains:
```
sudo nano /etc/proxychains.conf
```
`sudo nano /etc/proxychains.conf`
Add your proxy server details.
#### 3. Use proxychains:
```
proxychains command_to_run
```
`proxychains command_to_run`
### SOCKS proxy with SSH:
Create a SOCKS proxy using SSH:
```
ssh -D 1080 -f -C -q -N username@remote_host
```
Then configure applications to use SOCKS5 proxy at 127.0.0.1:1080.
- `ssh -D 1080 -f -C -q -N username@remote_host`
- Then configure applications to use SOCKS5 proxy at 127.0.0.1:1080.
## 3. Testing and Verification
To verify your VPN or proxy configuration:
- Check your IP address:
```
curl ifconfig.me
```
`curl ifconfig.me`
- DNS leak test:
```
dig +short myip.opendns.com @resolver1.opendns.com
```
`dig +short myip.opendns.com @resolver1.opendns.com`
- WebRTC leak test (in browsers)
@ -155,8 +128,3 @@ dig +short myip.opendns.com @resolver1.opendns.com
- Verify DNS settings
- Ensure correct permissions on configuration files
- Check for conflicting network settings
- [(1) Setting Up a VPN on Linux Mint: A Step-by-Step Guide - FOSS Linux.](https://www.fosslinux.com/102356/how-to-set-up-a-vpn-on-linux-mint.htm.)
- [(2) How to Configure OpenVPN in Linux Mint? IPVanish.](https://support.ipvanish.com/hc/en-us/articles/360001738513-How-to-Configure-OpenVPN-in-Linux-Mint.)
- [(3) How to configure OpenVPN on Linux Mint - FastVPN - Namecheap.](https://www.namecheap.com/support/knowledgebase/article.aspx/10416/2271/how-to-configure-openvpn-on-linux-mint/.)
- [(4) How to Set up an OpenVPN Connection in Linux Mint - Comparitech.](https://www.comparitech.com/blog/vpn-privacy/openvpn-connection-linux-mint/.)

View File

@ -12,17 +12,16 @@ Sudo operates on the principle of least privilege, allowing users to run specifi
The basic syntax for sudo is:
```
sudo [options] command
```
`sudo [options] command`
### Common Options
- `-u` username: Run the command as a user other than root
- `-i:` Simulate initial login (shell)
- `-s:` Run the specified shell
- `-l:` List the allowed commands for the current user
- `-v:` Validate and update the user's timestamp without running a command
- `-u`: username: Run the command as a user other than root
- `-i`: Simulate initial login (shell)
- `-s`: Run the specified shell
- `-l`: List the allowed commands for the current user
- `-v`: Validate and update the user's timestamp without running a command
- `-E`: Preserve the current "E"nvironment
## Configuration
@ -30,9 +29,7 @@ Sudo's behavior is controlled by the /etc/sudoers file. This file defines who ca
>**To edit the sudoers file:**
```
sudo visudo
```
`sudo visudo`
## Basic sudoers File Structure
@ -44,35 +41,25 @@ root ALL=(ALL:ALL) ALL
%sudo ALL=(ALL:ALL) ALL
# Allow specific user to run specific commands without a password
username ALL=(ALL) NOPASSWD: /path/to/command1, /path/to/command2
#username ALL=(ALL) NOPASSWD: /path/to/command1, /path/to/command2 #remove comment at beginning of line
```
### Usage Examples
- Run a command as root:
```
sudo apt update
```
`sudo apt update`
- Edit a system file:
```
sudo nano /etc/hosts
```
`sudo nano /etc/hosts`
- Switch to root user:
```
sudo -i
```
`sudo -i`
- Run a command as another user:
```
sudo -u username command
```
`sudo -u username command`
- List allowed commands:
```
sudo -l
```
`sudo -l`
### Sudo vs. Su
@ -104,7 +91,3 @@ While both sudo and su can be used to gain root privileges, sudo is generally pr
- Forgotten sudo password: Boot into recovery mode to reset the password
- Syntax errors in sudoers: Use visudo to edit and check for errors
# Conclusion
The sudo command is a powerful tool for managing privileges in Linux systems. By understanding its configuration and usage, system administrators can maintain a secure environment while still allowing users to perform necessary tasks with elevated permissions.

View File

@ -1,4 +1,4 @@
# File Permissions in Linux: A Comprehensive Guide
# Understanding File Permissions in Linux
## 1. Introduction to File Permissions
@ -23,15 +23,13 @@ There are three types of users:
To view file permissions, use the `ls -l` command. The output will look like this:
```
-rwxrw-r-- 1 user group 4096 Jul 22 10:00 example.txt
```
`-rwxrw-r-- 1 user group 4096 Jul 22 10:00 example.txt`
Let's break down this information:
- First character: File type (- for regular file, d for directory)
- Next 9 characters: Permissions for owner, group, and others
- User and group names
- File size
- User name and group names
- File size in bytes
- Last modification date and time
- File name
@ -66,9 +64,7 @@ The sum of these values for each user category represents the permissions:
### Using chmod with Symbolic Notation
The `chmod` command is used to change file permissions. The basic syntax is:
```
chmod [who][operation][permissions] filename
```
`chmod [who][operation][permissions] filename`
- Who: u (user/owner), g (group), o (others), a (all)
- Operation: + (add), - (remove), = (set exactly)
@ -82,9 +78,7 @@ Examples:
### Using chmod with Numeric Notation
You can also use numeric notation with chmod:
```
chmod [numeric_permissions] filename
```
`chmod [numeric_permissions] filename`
Example:
- `chmod 755 file.txt`: Set rwx for owner, rx for group and others
@ -94,16 +88,12 @@ Example:
### chown command
Use `chown` to change the owner of a file:
```
chown new_owner filename
```
`chown new_owner filename`
### chgrp command
Use `chgrp` to change the group of a file:
```
chgrp new_group filename
```
`chgrp new_group filename`
## 7. Special Permissions
@ -145,7 +135,3 @@ Example:
- Regularly audit file permissions
- Be cautious when using recursive permission changes
- Understand the implications of SetUID and SetGID bits
## 11. Conclusion
Understanding Linux file permissions is crucial for maintaining system security and proper access control. By mastering these concepts and commands, you can effectively manage file access and protect sensitive data on your Linux systems.

View File

@ -29,12 +29,12 @@ In Linux, every user and group is assigned a unique numerical identifier. For us
- GID 65534 (nogroup): Often used for unprivileged processes.
## 6. Viewing and modifying UIDs and GIDs:
- View current user and group: id command
- View current user and group: `id $USER`
- View all users: cat /etc/passwd
- View all groups: cat /etc/group
- Change a user's UID: usermod -u NEW_UID USERNAME
- Change a group's GID: groupmod -g NEW_GID GROUPNAME
- Add a user to a group: usermod -aG GROUPNAME USERNAME
- Change a user's UID: `sudo usermod -u NEW_UID USERNAME`
- Change a group's GID: `sudo groupmod -g NEW_GID GROUPNAME`
- Add a user to a group: `sudo usermod -aG GROUPNAME USERNAME`
## 7. UIDs, GIDs, and file permissions:
- Each file and directory in Linux has an owner (UID) and a group (GID).

View File

@ -12,6 +12,20 @@ Linux can be better than Windows or MacOS due to its flexibility, customization
## Key Points
This content should help introduce and familiarize oneself with the linux eco-system.
a) Free and open-source: Linux is a free operating system, and its source code is available for anyone to view, modify, and distribute.
b) Customization: Linux offers extensive customization options, allowing users to tailor their experience to their specific needs.
c) Community-driven: Linux is developed and maintained by a global community of volunteers and companies who contribute to its evolution.
d) Wide adoption: Linux is used across various platforms, including desktops, laptops, servers, mobile devices, routers, and embedded systems.
e) Security: Linux's open-source nature makes it more secure than proprietary operating systems, as vulnerabilities can be quickly identified and addressed by the community.
f) Commercial use: Many commercial operating systems are based on or use components from Linux, such as Android and Chrome OS.
g) Distributions: There are numerous distributions (distros) of Linux, each with its own set of default packages, configurations, and desktop environments.
## Goals
To familiarize common households with the linux philosophy

View File

@ -68,7 +68,7 @@ members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant Home](hhttps://www.contributor-covenant.org/), version 1.4,
This Code of Conduct is adapted from the [Contributor Covenant Home](https://www.contributor-covenant.org/), version 1.4,
available at [Code of Conduct](https://www.contributor-covenant.org/version/2/1/code_of_conduct/)
For answers to common questions about this code of conduct, see