This commit is contained in:
NatePick 2024-09-06 22:54:03 -05:00
commit 82c0dcbbc1
31 changed files with 527 additions and 1013 deletions

View File

@ -38,6 +38,11 @@ These are designed for personal computers and laptops, focusing on user-friendli
- Offers multiple desktop environments - Offers multiple desktop environments
- Hardware detection and driver installation out of the box - Hardware detection and driver installation out of the box
### f) Pop-OS
- Based off Ubuntu
- User-friendly gamer oriented Distrobution
- Works well with NVIDIA cards OOTB "Out Of The Box"
## 2. Server-Oriented Distributions: ## 2. Server-Oriented Distributions:
These focus on stability, security, and performance for server environments. These focus on stability, security, and performance for server environments.
@ -46,16 +51,12 @@ These focus on stability, security, and performance for server environments.
- Known for stability and long-term support - Known for stability and long-term support
- Widely used in corporate environments - Widely used in corporate environments
### b) CentOS: ### b) Debian:
- Free, community-supported version of RHEL
- Recently shifted to CentOS Stream, which is upstream of RHEL
### c) Debian:
- Known for its stability and large software repositories - Known for its stability and large software repositories
- Forms the base for many other distributions - Forms the base for many other distributions
- Strict adherence to free software principles - Strict adherence to free software principles
### d) Ubuntu Server: ### c) Ubuntu Server:
- Server version of Ubuntu - Server version of Ubuntu
- Popular for cloud deployments and container hosts - Popular for cloud deployments and container hosts
- Regular releases and long-term support options - Regular releases and long-term support options
@ -106,6 +107,7 @@ Designed for specific use cases or hardware.
- Comes with audio, video, and graphics software pre-installed - Comes with audio, video, and graphics software pre-installed
## c) SteamOS: ## c) SteamOS:
- ONLY AVAILABE on SteamDeck
- Developed by Valve for gaming - Developed by Valve for gaming
- Based on Debian, optimized for Steam and gaming performance - Based on Debian, optimized for Steam and gaming performance

View File

@ -1,15 +1,9 @@
# Linux has a fascinating history that dates back to the early 1990s. # Linux has a fascinating history that dates back to the early 1990s.
1. **Origins**: Linux began as a personal project by Linus Torvalds, a Finnish student, in 1991. He aimed to create a free operating system kernel¹². 1. **Origins**: Linux began as a personal project by Linus Torvalds, a Finnish student, in 1991. He aimed to create a free operating system kernel¹.
2. **Unix Influence**: The development of Linux was heavily influenced by Unix, an operating system created by Ken Thompson and Dennis Ritchie at AT&T Bell Labs in 1969¹². 2. **Unix Influence**: The development of Linux was heavily influenced by Unix, an operating system created by Ken Thompson and Dennis Ritchie at AT&T Bell Labs in 1969¹.
3. **GNU Project**: In 1983, Richard Stallman started the GNU Project to create a free Unix-like operating system. Although the GNU kernel (Hurd) was incomplete, the project provided many essential tools for Linux¹². 3. **GNU Project**: In 1983, Richard Stallman started the GNU Project to create a free Unix-like operating system. Although the GNU kernel (Hurd) was incomplete, the project provided many essential tools for Linux¹.
4. **Release of Linux**: Linus Torvalds released the first version of the Linux kernel on September 17, 1991. It quickly gained popularity among developers and the open-source community¹². 4. **Release of Linux**: Linus Torvalds released the first version of the Linux kernel on September 17, 1991. It quickly gained popularity among developers and the open-source community¹.
5. **Growth and Development**: Over the years, Linux has grown significantly, with contributions from developers worldwide. It has become the foundation for many operating systems, including popular distributions like Ubuntu, Fedora, and Debian¹². 5. **Growth and Development**: Over the years, Linux has grown significantly, with contributions from developers worldwide. It has become the foundation for many operating systems, including popular distributions like Ubuntu, Fedora, and Debian¹.
- [Wikipedia: History of Linux](https://en.wikipedia.org/wiki/History_of_Linux - [(1) History of Linux - Wikipedia.](https://en.wikipedia.org/wiki/History_of_Linux.)
- [LinuxSimply: History of Linux](https://linuxsimply.com/linux-basics/introduction/history-of-linux/
- [(1) History of Linux - Wikipedia.](https://en.wikipedia.org/wiki/History_of_Linux.)
- [(2) History of Linux [A Complete Overview] - LinuxSimply.](https://linuxsimply.com/linux-basics/introduction/history-of-linux/.)
= [(3) History of Linux - GeeksforGeeks.](https://www.geeksforgeeks.org/linux-history/.)
- [(4) The Complete History of Linux: Everything You Need to Know.](https://www.historytools.org/companies/the-complete-history-of-linux-everything-you-need-to-know.)

View File

@ -1,7 +1,9 @@
# Installing Linux Mint # Installing Linux Mint
## **Step 1: Download Linux Mint** ## **Step 1: Download Linux Mint**
- Go to the official Linux Mint website (https://www.linuxmint.com/) and download the latest version of Linux Mint for your system (e.g., 64-bit or 32-bit). - Go to the official Linux [Mint website](https://www.linuxmint.com/download.php) and download the latest version of Linux Mint for your system.
- If you bought your PC in the past decade - use 64-bit!
- Cinnamon is recommended for new users.
- The download will be an ISO file, which is an image of the Linux Mint operating system. - The download will be an ISO file, which is an image of the Linux Mint operating system.
## **Step 2: Create a Bootable USB or DVD** ## **Step 2: Create a Bootable USB or DVD**

View File

@ -56,32 +56,27 @@
- find (search for files and directories) - find (search for files and directories)
## 10. Piping and Redirection ## 10. Piping and Redirection
- | (pipe operator) - | (pipe operator)
- > and >> (output redirection) - \> and >> (output redirection)
- < (input redirection) - < (input redirection)
## 11. Shell Scripting Basics ## 11. Shell Scripting Basics
- Creating and running shell scripts - Creating and running shell scripts
- Variables and environment variables - Variables and environment variables
- Conditional statements (if, else, elif) - Conditional statements (if, else, elif)
- Loops (for, while) - Loops (for, while)
## 12. Advanced CLI Features ## 12. Advanced CLI Features
- Command history and shortcuts - Command history and shortcuts
- Tab completion - Tab completion
- Aliases - Aliases
- Regular expressions - Regular expressions
## 13. System Logs and Troubleshooting ## 13. System Logs and Troubleshooting
- journalctl (view system logs) - journalctl (view system logs)
- dmesg (display kernel messages) - dmesg (display kernel messages)
- lsof (list open files) - lsof (list open files)
4. **Superuser Powers**: # **Superuser Powers**:
- Some tasks require administrator privileges. To execute commands as the superuser (root), prefix them with `sudo`. - Some tasks require administrator privileges. To execute commands as the superuser (root), prefix them with `sudo`.
- Be cautious with superuser access—it's powerful! - Be cautious with superuser access—it's powerful and WILL break your machine if used improperly!!!
- [(1) The Linux command line for beginners | Ubuntu.](https://ubuntu.com/tutorials/command-line-for-beginners.)
- [(2) What is Terminal in Linux? The Ultimate Guide LinuxSimply.](https://linuxsimply.com/what-is-terminal-in-linux/.)
- [(3) Ubuntu Terminal Beginner's Guide to Command Line Interface - FOSS Linux.](https://www.fosslinux.com/101137/the-ubuntu-terminal-getting-started-with-the-command-line-interface.htm.)

View File

@ -1,3 +1,79 @@
# Linux Filesystem Hierarchy Standard (LFHS) # Linux Filesystem Hierarchy Standard (LFHS)
The Linux Filesystem Hierarchy Standard (FHS) defines the directory structure and directory contents in Linux and other Unix-like operating systems. It is maintained by the Linux Foundation and provides consistency across distributions. Let's explore the main directories and their purposes:
## 1. / (Root Directory)
The root directory is the top-level directory of the filesystem. All other directories are subdirectories of the root.
## 2. /bin (Essential User Binaries)
Contains essential command binaries that need to be available in single-user mode. Examples include ls, cp, and pwd.
## 3. /boot (Boot Loader Files)
Contains files needed for the boot process, including the kernel, initrd, and boot loader configuration.
## 4. /dev (Device Files)
Contains device files, which are interfaces for device drivers. Examples include /dev/sda for the first SATA drive and /dev/tty for terminals.
## 5. /etc (Configuration Files)
Stores system-wide configuration files and scripts. Examples include /etc/passwd for user information and /etc/fstab for filesystem information.
## 6. /home (User Home Directories)
Contains home directories for regular users. Each user typically has a subdirectory here, like /home/username.
## 7. /lib (Essential Shared Libraries)
Holds library files needed by the binaries in /bin and /sbin.
## 8. /media (Removable Media)
Mount point for removable media such as USB drives and CD-ROMs.
## 9. /mnt (Temporary Mount Points)
Used for temporarily mounted filesystems.
## 10. /opt (Optional Software)
Reserved for the installation of add-on application software packages.
## 11. /proc (Process Information)
A virtual filesystem providing process and kernel information as files.
## 12. /root (Root User Home Directory)
Home directory for the root user.
## 13. /run (Run-time Variable Data)
Contains variable data files describing the system since the last boot.
## 14. /sbin (System Binaries)
Similar to /bin, but contains binaries essential for system administration, usually to be run by root.
## 15. /srv (Service Data)
Contains data for services provided by the system.
## 16. /sys (System Information)
A virtual filesystem providing a standardized interface to kernel objects.
## 17. /tmp (Temporary Files)
Directory for temporary files. Often cleared on reboot.
## 18. /usr (User Programs)
Contains the majority of user utilities and applications. It has several subdirectories:
- /usr/bin: Non-essential command binaries
- /usr/lib: Libraries for /usr/bin and /usr/sbin
- /usr/local: Local hierarchy for system administrators
- /usr/sbin: Non-essential system binaries
- /usr/share: Architecture-independent data
## 19. /var (Variable Files)
Contains variable data files, including logs (/var/log), temporary email files (/var/mail), and spooled files (/var/spool).
## 20. Key Principles of FHS:
- 1. Separation of core system files from user files
- 2. Consistency across distributions
- 3. Backward compatibility
- 4. Flexibility for system administrators
## 21. Benefits of FHS:
- 1. Easier system administration
- 2. Improved security through proper file organization
- 3. Compatibility across different Linux distributions
- 4. Easier software development and deployment
[LFHS](https://refspecs.linuxfoundation.org/FHS_3.0/fhs/index.html) [LFHS](https://refspecs.linuxfoundation.org/FHS_3.0/fhs/index.html)

View File

@ -49,36 +49,4 @@
- The network stack is the set of protocols and services that enable network communication in the Linux operating system. - The network stack is the set of protocols and services that enable network communication in the Linux operating system.
- The network stack includes protocols like TCP/IP, UDP, and ICMP, as well as higher-level protocols like HTTP, FTP, and SSH. - The network stack includes protocols like TCP/IP, UDP, and ICMP, as well as higher-level protocols like HTTP, FTP, and SSH.
- The network stack is responsible for sending and receiving network packets, as well as managing network interfaces and routing. - The network stack is responsible for sending and receiving network packets, as well as managing network interfaces and routing.
- The network stack also includes features like firewalling, network address translation (NAT), and virtual private networks (VPNs). - The network stack also includes features like firewalling, network address translation (NAT), and virtual private networks (VPNs).
This covers the major components and subsystems of the Linux operating system structure. Each of these components plays a crucial role in the overall functioning of the system, providing the foundation for the applications and services that run on top of the Linux platform.
=======
#
1. **Root Directory (`/`)**:
- The root directory is the starting point for all files and directories in Linux. It's analogous to a plant's root system. Everything else is organized under this root.
- Absolute paths of files are traced back from the root. For instance, if you have a file at `/home/user/documents`, the directory structure goes: root → home → user → documents.
- Fun fact: There's a famous (but dangerous) joke about running `rm -rf /`—it would theoretically delete everything in your Linux system! 😅
2. **/bin (Binaries)**:
- `/bin` contains essential executable files for basic shell commands like `ls`, `cp`, and `cd`.
- These programs are typically in binary format and are accessible to all users on the system.
3. **/dev (Device Files)**:
- `/dev` houses special files related to devices. These files are virtual and don't physically exist on the disk.
- Examples:
- `/dev/null`: Used to discard data
- `/dev/zero`: Contains an infinite sequence of zeros
- `/dev/random`: Provides random values
4. **/etc (Configuration Files)**:
- `/etc` holds core configuration files used by the system administrator and services.
- Examples include password files and networking configurations.
- When you need to tweak system settings (like changing the hostname), you'll find the relevant files here¹.
- [(1) Linux Directory Structure Explained for Beginners.](https://linuxhandbook.com/linux-directory-structure/.)
- [(2) What is Linux? {Understanding Linux Operating System} - phoenixNAP.](https://phoenixnap.com/kb/what-is-linux.)
- [(3) Architecture of Linux Operating System - LinuxSimply.](https://linuxsimply.com/linux-basics/introduction/architecture-of-linux-operating-system/.)
- [(4) What is Linux? - Red Hat.](https://www.redhat.com/en/topics/linux/what-is-linux.)
- [(5) en.wikipedia.org.](https://en.wikipedia.org/wiki/Linux.)

View File

@ -5,49 +5,47 @@
### a) pwd (Print Working Directory) ### a) pwd (Print Working Directory)
- Shows the current directory path - Shows the current directory path
- Usage: pwd - Usage: `pwd`
### b) ls (List) ### b) ls (List)
- Lists files and directories in the current directory - Lists files and directories in the current directory
- Common options: - Usage: `ls` [options] [directory]
-l: Long format with details #### Common options:
-a: Show hidden files - l: Long format with details
-h: Human-readable file sizes - a: Show hidden files
- Usage: ls [options] [directory] - h: Human-readable file sizes
### c) cd (Change Directory) ### c) cd (Change Directory)
- Changes the current directory - Changes the current directory
- Usage: - Usage:
cd [directory] - `cd [directory]`
cd .. (move up one directory)
cd ~ (go to home directory)
### d) mkdir (Make Directory) ### d) mkdir (Make Directory)
- Creates a new directory - Creates a new directory
- Usage: mkdir [directory_name] - Usage: `mkdir [directory_name]`
### e) rmdir (Remove Directory) ### e) rmdir (Remove Directory)
- Removes an empty directory - Removes an empty directory
- Usage: rmdir [directory_name] - Usage: `rmdir [directory_name]`
### f) touch ### f) touch
- Creates an empty file or updates timestamps - Creates an empty file or updates timestamps
- Usage: touch [filename] - Usage: `touch [filename]`
### g) cp (Copy) ### g) cp (Copy)
- Copies files or directories - Copies files or directories
- Usage: cp [source] [destination] - Usage: `cp [source] [destination]`
- Options: #### Common Options:
-r: Recursive (for directories) -r: Recursive (for directories)
### h) mv (Move) ### h) mv (Move)
- Moves or renames files and directories - Moves or renames files and directories
- Usage: mv [source] [destination] - Usage: `mv [source] [destination]`
### i) rm (Remove) ### i) rm (Remove)
- Deletes files or directories - Deletes files or directories
- Usage: rm [options] [file/directory] - Usage: `rm [options] [file/directory]`
- Options: #### Options:
-r: Recursive (for directories) -r: Recursive (for directories)
-f: Force deletion without prompting -f: Force deletion without prompting
@ -55,58 +53,57 @@
### a) cat (Concatenate) ### a) cat (Concatenate)
- Displays file contents - Displays file contents
- Usage: cat [filename] - Usage: `cat [filename]`
### b) less ### b) less
- Views file contents page by page - Views file contents page by page
- Usage: less [filename] - Usage: `less [filename]`
### c) head ### c) head
- Displays the first few lines of a file - Displays the first few lines of a file
- Usage: head [options] [filename] - Usage: `head [options] [filename]`
- Options: #### Common Options:
-n [number]: Specify number of lines -n [number]: Specify number of lines
### d) tail ### d) tail
- Displays the last few lines of a file - Displays the last few lines of a file
- Usage: tail [options] [filename] - Usage: `tail [options] [filename]`
- Options: #### Common Options:
-n [number]: Specify number of lines -n [number]: Specify number of lines
-f: Follow file updates in real-time -f: Follow file updates in real-time
### e) nano ### e) nano
- Simple text editor - Simple text editor
- Usage: nano [filename] - Usage: `nano [filename]`
## 3. File Permissions and Ownership: ## 3. File Permissions and Ownership:
### a) chmod (Change Mode) ### a) chmod (Change Mode)
- Modifies file permissions - Modifies file permissions
- Usage: chmod [options] [mode] [file/directory] - Usage: `chmod [options] [mode] [file/directory]`
- Example: chmod 755 file.txt
### b) chown (Change Owner) ### b) chown (Change Owner)
- Changes file ownership - Changes file ownership
- Usage: chown [user]:[group] [file/directory] - Usage: `chown [user]:[group] [file/directory]`
## 4. System Information: ## 4. System Information:
### a) uname ### a) uname
- Displays system information - Displays system information
- Usage: uname [options] - Usage: `uname [options]`
- Options: #### Common Options:
-a: All information -a: All information
### b) df (Disk Free) ### b) df (Disk Free)
- Shows disk space usage - Shows disk space usage
- Usage: df [options] - Usage: df [options]
- Options: #### Common Options:
-h: Human-readable sizes -h: Human-readable sizes
### c) du (Disk Usage) ### c) du (Disk Usage)
- Estimates file and directory space usage - Estimates file and directory space usage
- Usage: du [options] [directory] - Usage: `du [options] [directory]`
- Options: #### Common Options:
-h: Human-readable sizes -h: Human-readable sizes
-s: Summary for directory -s: Summary for directory
@ -114,69 +111,70 @@
### a) ps (Process Status) ### a) ps (Process Status)
- Lists running processes - Lists running processes
- Usage: ps [options] - Usage: `ps [options]`
- Common options: #### Common options:
aux: Detailed information for all processes -aux: Detailed information for all processes
### b) top ### b) top
- Displays real-time system process information - Displays real-time system process information
- Usage: top - Usage: `top -u [user]`
#### Common Options:
-u: active apps for specified user
### c) kill ### c) kill
- Terminates processes - Terminates processes
- Usage: kill [options] [PID] - Usage: `kill [options] [PID]`
- Options: #### Common Options:
-9: Force kill -9: Force kill
## 6. Network Commands: ## 6. Network Commands:
### a) ping ### a) ping
- Tests network connectivity - Tests network connectivity
- Usage: ping [options] [destination] - Usage: `ping [options] [destination]`
### b) ifconfig ### b) ifconfig
- Displays network interface information - Displays network interface information
- Usage: ifconfig - Usage: `ifconfig`
### c) ssh (Secure Shell) ### c) ssh (Secure Shell)
- Connects to remote systems securely - Connects to remote systems securely
- Usage: ssh [user]@[host] - Usage: `ssh [user]@[host]`
#### Common Options:
-p: Specify a port
## 7. Package Management (for Debian-based systems): ## 7. Package Management (for Debian-based systems):
### a) apt-get update ### a) apt-get update
- Updates package lists - Updates package lists
- Usage: sudo apt-get update - Usage: `sudo apt-get update`
### b) apt-get upgrade ### b) apt-get upgrade
- Upgrades installed packages - Upgrades installed packages
- Usage: sudo apt-get upgrade - Usage: `sudo apt-get upgrade`
### c) apt-get install ### c) apt-get install
- Installs new packages - Installs new packages
- Usage: sudo apt-get install [package_name] - Usage: `sudo apt-get install [package_name]`
## 8. File Compression: ## 8. File Compression:
### a) tar ### a) tar
- Archives files - Archives files
- Usage: tar [options] [archive_name] [files/directories] - Usage: `tar [options] [archive_name] [files/directories]`
- Common options: - Usage: `tar -cvf archive.tar files/` "compress files from 'files' directory into archive.tar"
#### Common options:
-c: Create archive -c: Create archive
-x: Extract archive -x: Extract archive
-v: Verbose -v: Verbose
-f: Specify archive file -f: Specify archive file
- Example: tar -cvf archive.tar files/ -t: List the contents inside the tar file
-z: Gzip the file after tar'ing it. "Double compressed"
### b) gzip ### b) gzip
- Compresses files - Compresses files
- Usage: gzip [filename] - Usage: `gzip [filename]`
### c) gunzip ### c) gunzip
- Decompresses gzip files - Decompresses gzip files
- Usage: gunzip [filename.gz] - Usage: `gunzip [filename.gz]`
- [(1) The beginners guide to using terminal on Linux Mint - FOSS Linux.](https://www.fosslinux.com/103546/the-beginners-guide-to-using-terminal-on-linux-mint.htm.)
- [(2) Official User Guide - Linux Mint.](https://www.linuxmint.com/documentation/user-guide/Cinnamon/english_18.0.pdf.)
- [(3) BEGINNER'S GUIDE FOR LINUX - Start Learning Linux in Minutes - Tecmint.](https://www.tecmint.com/free-online-linux-learning-guide-for-beginners/.)
- [(4) Useful Basic Terminal Commands On Linux Mint 11 - HowtoForge.](https://www.howtoforge.com/useful-basic-terminal-commands-on-linux-mint-11.)

View File

@ -14,184 +14,141 @@ Linux follows a hierarchical file system structure, starting with the root direc
## 2. Basic Commands: ## 2. Basic Commands:
### - Listing files and directories: ### - Listing files and directories:
``` `ls [options] [directory]`
ls [options] [directory]
```
Common options: Common options:
- -l: Long format - -l: Long format
- -a: Show hidden files - -a: Show hidden files
- -h: Human-readable file sizes - -h: Human-readable file sizes
### - Changing directories: ### - Changing directories:
``` `cd [directory]`
cd [directory] - `cd ..`: Move up one directory
``` - `cd`: Go to home directory
- cd ..: Move up one directory - `cd /`: Go to root directory
- cd ~: Go to home directory
- cd /: Go to root directory
### - Creating directories: ### - Creating directories:
``` `mkdir [options] directory_name`
mkdir [options] directory_name
```
Common options: Common options:
- mkdir -p: Create parent directories if they don't exist - -p: Create parent directories if they don't exist
### - Removing directories: ### - Removing directories:
``` `rmdir [options] directory_name`
rmdir [options] directory_name
```
Common options:
- rm -r directory_name: Remove non-empty directories
### - Creating files: ### - Creating empty files:
``` `touch file_name`
touch file_name
```
### - Copying files and directories: ### - Copying files and directories:
``` `cp [options] source destination`
cp [options] source destination
```
Common options: Common options:
- cp -r: Copy directories recursively - -r: Copy directories recursively
### - Moving/renaming files and directories: ### - Moving/renaming files and directories:
``` `mv source destination`
mv source destination
```
### - Removing files: ### - Removing files:
``` `rm [options] file_name`
rm [options] file_name
```
Common options: Common options:
- rm -f: Force removal without prompting - -f: Force removal without prompting
## 3. File Permissions: ## 3. File Permissions:
Linux uses a permission system with read (r), write (w), and execute (x) permissions for owner, group, and others. Linux uses a permission system with read (r), write (w), and execute (x) permissions for owner, group, and others.
### Viewing permissions: ### Viewing permissions:
``` `ls -l`
ls -l
```
### Changing permissions: ### Changing permissions:
``` `chmod [options] mode file`
chmod [options] mode file Example: chmod 755 file_name "to make a file permissions RWX-Owner, RX-Group, RX-Others
```
Example: chmod 755 file_name
### Changing ownership: ### Changing ownership:
``` `chown [options] user:group file`
chown [options] user:group file
```
## 4. File Manipulation: ## 4. File Manipulation:
### Viewing file contents: ### Viewing file contents:
``` - `cat file_name` #Print entire file at once
cat file_name #Print entire file at once - `less file_name` #View file in a pager format
less file_name #View file in a pager format - `more 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
head file_name #View top 10 lines (default) of a file - `tail file_name` #View last 10 lines (default) of a file
tail file_name #View last 10 lines (default) of a file
```
### Searching file contents: ### Searching file contents:
``` `grep [options] pattern file`
grep [options] pattern file
```
Common options: Common options:
- -i: Insensitive Case Search - -i: Insensitive Case Search
- -R: search recursively in parent Directory, as well as all child directories. - -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: ### Comparing files:
``` `diff file1 file2`
diff file1 file2
```
## 5. Advanced File Management: ## 5. Advanced File Management:
### Finding files: ### Finding files:
``` `find [path] [expression]`
find [path] [expression] Common Options:
``` - -iname: Insensitive case search
Example: find /home -name "*.txt" - -name: Case Sensitive search
Example: `find /home -name "*.txt"`
### Disk usage: ### Disk usage:
``` `du [options] [directory]`
du [options] [directory]
```
Common options: Common options:
- -h: Print disk usage in human-readable format - -h: Print disk usage in human-readable format
- -s: Summarize disk usage information - -s: Summarize disk usage information
- -S: Summarize disk usage by each sub-directory
### File compression and archiving: ### File compression and archiving:
``` `tar [options] files.tar files` #Create a tar archive called "files.tar" with everything in the "files" directory
tar [options] archive_name files `gzip -k file_name` #Create a gzipped archive while keeping the original file "-k"
gzip file_name `gunzip -k file_name.gz` #Extract a .gzip file while keeping "-k" the original archive.
gunzip file_name.gz
```
### Symbolic links:
``` ### Symbolic links "Shortcuts":
ln -s target_file link_name `ln -s target_file link_name`
```
## 6. Text Editors: ## 6. Text Editors:
- nano: Simple and user-friendly - nano: Simple and user-friendly #Included with most distros by default
- vim: Advanced and powerful - vim: Advanced and powerful
- emacs: Extensible and feature-rich - emacs: Extensible and feature-rich
## 7. File System Management: ## 7. File System Management:
### Mounting file systems: ### Mounting file systems:
``` `mount` [options] device directory
mount [options] device directory
```
### Unmounting file systems: ### Unmounting file systems:
``` `umount` [options] directory
umount [options] directory
```
### Checking disk space: ### Checking disk space:
``` `df` [options]
df [options] Common Options:
``` - -h: Human-readable output
- df -h: Human-readable output
## 8. File System Maintenance: ## 8. File System Maintenance:
### Checking and repairing file systems: ### Checking and repairing file systems:
``` `fsck [options] device` #Not used with BTRFS filesystem
fsck [options] device
```
### Creating file systems: ### Creating file systems:
``` `mkfs.[FSTYPE] [options] device` #Will erase device/disk if not entered correctly
mkfs [options] device
```
## 9. Access Control Lists (ACLs): ## 9. Access Control Lists (ACLs):
### For more fine-grained permission control: ### For more fine-grained permission control:
``` `getfacl file`
getfacl file `setfacl -m u:user:rwx file`
setfacl -m u:user:rwx file
```
## 10. Inode Information: ## 10. Inode Information:
### View detailed file 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/.) ## 11. External Sources:
- [(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/.) - [(1) 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.) - [(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: ## 5. Emergency Immediate Shutdown:
In case of an unresponsive system, you can use the magic SysRq key combinations: 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 - Hold Alt + SysRq (usually Print Screen), then press these keys in sequence: R E I S U B #This will reboot your system
- 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 O #This will power-off your system
## 6. Sending Signals: ## 6. Sending Signals:
You can use the `kill` command to send signals to the init process: You can use the `kill` command to send signals to the init process:
- Shutdown: `sudo kill -s SIGINT 1` - Shutdown: `sudo kill -s SIGINT 1` #kill the init PID - resulting in machine power-off
- Restart: `sudo kill -s SIGTERM 1` - Restart: `sudo kill -s SIGTERM 1` #kill the init PID - resulting in machine power-off
## 7. Additional Options and Considerations: ## 7. Additional Options and Considerations:
@ -50,7 +50,7 @@ c) Shut down without sudo (if configured): `shutdown -h now`
## 8. Shutting down remote systems: ## 8. Shutting down remote systems:
- SSH into the system and use any of the above commands - 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: ## 9. Checking shutdown/restart history:
@ -64,9 +64,4 @@ c) Shut down without sudo (if configured): `shutdown -h now`
- Close all running applications to prevent data loss - Close all running applications to prevent data loss
- For servers, notify users before scheduling a shutdown or restart - For servers, notify users before scheduling a shutdown or restart
- Use delayed shutdowns to give time for important processes to complete - Use delayed shutdowns to give time for important processes to complete
- Regularly check system logs for any shutdown/restart issues - 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. - Use arrow keys to move the cursor.
- Page Up/Down: Move one screen at a time. - Page Up/Down: Move one screen at a time.
- Home/End: Move to start/end of a line. - 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: ## 5. Editing:
- Type to insert text at the cursor position. - Type to insert text at the cursor position.
@ -94,4 +94,4 @@ Nano is a simple, user-friendly text editor for Unix-like operating systems. It'
## 15. Colored Text: ## 15. Colored Text:
- Use `set titlecolor`, `set statuscolor`, etc. in `.nanorc` to customize colors. - Use `set titlecolor`, `set statuscolor`, etc. in `.nanorc` to customize colors.
Nano is an excellent choice for quick edits and for users who prefer a straightforward, non-modal text editor. While it may not have all the features of more complex editors like Vim or Emacs, its simplicity and ease of use make it a popular choice for many users. Nano is an excellent choice for quick edits and for users who prefer a straightforward, non-modal text editor. While it may not have all the features of more complex editors like Vim or Emacs, its simplicity and ease of use make it a popular choice for many users.

View File

@ -1,6 +1,12 @@
# Using the Linux Terminal (BASH Shell) # 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 - pwd: Print working directory
- ls: List files and directories - ls: List files and directories
- cd: Change directory - cd: Change directory
@ -8,7 +14,7 @@
- rmdir: Remove an empty directory - rmdir: Remove an empty directory
- touch: Create an empty file - touch: Create an empty file
## 2. File Operations: ## 3. File Operations:
- cp: Copy files or directories - cp: Copy files or directories
- mv: Move or rename files/directories - mv: Move or rename files/directories
- rm: Remove files or directories - rm: Remove files or directories
@ -16,73 +22,73 @@
- less: View file contents page by page - less: View file contents page by page
- head/tail: View beginning/end of a file - head/tail: View beginning/end of a file
## 3. Text Editing: ## 4. Text Editing:
- nano: Simple text editor - nano: Simple text editor
- vim: Advanced text editor - vim: Advanced text editor
- emacs: Another advanced text editor - emacs: Another advanced text editor
## 4. File Permissions: ## 5. File Permissions:
- chmod: Change file permissions - chmod: Change file permissions
- chown: Change file owner - chown: Change file owner
- chgrp: Change group ownership - chgrp: Change group ownership
## 5. Process Management: ## 6. Process Management:
- ps: List running processes - ps: List running processes
- top: Dynamic view of system processes - top: Dynamic view of system processes
- kill: Terminate a process - kill: Terminate a process
- fg/bg: Bring process to foreground/background - fg/bg: Bring process to foreground/background
## 6. System Information: ## 7. System Information:
- uname: Display system information - uname: Display system information
- df: Show disk usage - df: Show disk usage
- du: Display directory space usage - du: Display directory space usage
- free: Show memory usage - free: Show memory usage
## 7. Network Commands: ## 8. Network Commands:
- ifconfig: Configure network interfaces - ifconfig: Configure network interfaces
- ping: Test network connectivity - ping: Test network connectivity
- ssh: Secure shell for remote access - ssh: Secure shell for remote access
- scp: Securely copy files between hosts - scp: Securely copy files between hosts
## 8. Package Management: ## 9. Package Management:
- apt-get (Debian/Ubuntu): Install, update, remove packages - apt-get (Debian/Ubuntu): Install, update, remove packages
- yum (CentOS/Fedora): Similar to apt-get - yum (CentOS/Fedora): Similar to apt-get
- dnf (Fedora): Next-generation package manager - dnf (Fedora): Next-generation package manager
## 9. File Compression: ## 10. File Compression:
- tar: Archive files - tar: Archive files
- gzip/gunzip: Compress/decompress files - gzip/gunzip: Compress/decompress files
- zip/unzip: Create/extract zip archives - zip/unzip: Create/extract zip archives
## 10. Text Processing: ## 11. Text Processing:
- grep: Search for patterns in files - grep: Search for patterns in files
- sed: Stream editor for text manipulation - sed: Stream editor for text manipulation
- awk: Pattern scanning and text processing - awk: Pattern scanning and text processing
## 11. Redirection and Pipes: ## 12. Redirection and Pipes:
- >: Redirect output to a file - >: Redirect output to a file OVERWRITING original file if it exists
- >>: Append output to a file - >>: Append output to a file or create a new file.
- <: Read input from a 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 - useradd: Add a new user
- userdel: Delete a user - userdel: Delete a user
- passwd: Change user password - passwd: Change user password
## 13. Advanced Commands: ## 14. Advanced Commands:
- find: Search for files in a directory hierarchy - find: Search for files in a directory hierarchy
- xargs: Build and execute command lines from standard input - xargs: Build and execute command lines from standard input
- sort: Sort lines of text - sort: Sort lines of text
- uniq: Report or omit repeated lines - uniq: Report or omit repeated lines
## 14. Shell Scripting: ## 15. Shell Scripting:
- Variables: var_name=value - Variables: var_name=value
- Conditionals: if, elif, else - Conditionals: if, elif, else
- Loops: for, while - Loops: for, while
- Functions: function_name() { commands; } - Functions: function_name() { commands; }
## 15. Job Control: ## 16. Job Control:
- jobs: List active jobs - jobs: List active jobs
- &: Run a command in the background - &: Run a command in the background
- Ctrl+Z: Suspend a running process - 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: ### 11. Kernel Development Model:
The Linux kernel follows an open-source development model. Linus Torvalds oversees the project, with numerous contributors worldwide. 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. 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 ### 2. Basic Yum Commands
- Searching for packages: - Searching for packages:
``` `yum search keyword`
yum search keyword
```
- Getting information about a package: - Getting information about a package:
``` `yum info package_name`
yum info package_name
```
- Installing a package: - Installing a package:
``` `sudo yum install package_name`
sudo yum install package_name
```
- Removing a package: - Removing a package:
``` `sudo yum remove package_name`
sudo yum remove package_name
```
- Updating all packages: - Updating all packages:
``` `sudo yum update`
sudo yum update
```
- Updating a specific package: - Updating a specific package:
``` `sudo yum update package_name`
sudo yum update package_name
```
### 3. Working with Repositories ### 3. Working with Repositories
Yum uses repositories to fetch package information and the packages themselves. Yum uses repositories to fetch package information and the packages themselves.
- Listing enabled repositories: - Listing enabled repositories:
``` `yum repolist`
yum repolist
```
- Listing all repositories (including disabled): - Listing all repositories (including disabled):
``` `yum repolist all`
yum repolist all
```
- Adding a new repository: - Adding a new repository:
Create a .repo file in /etc/yum.repos.d/ with the following structure: Create a .repo file in /etc/yum.repos.d/ with the following structure:
@ -62,100 +46,68 @@ gpgcheck=1
gpgkey=http://repository.url/RPM-GPG-KEY gpgkey=http://repository.url/RPM-GPG-KEY
``` ```
- Enabling/disabling a repository: - Enabling/disabling a repository:
``` - `sudo yum-config-manager --enable repository_id`
sudo yum-config-manager --enable repository_id - `sudo yum-config-manager --disable repository_id`
sudo yum-config-manager --disable repository_id
```
### 4. Managing Package Groups ### 4. Managing Package Groups
Yum can install predefined groups of packages. Yum can install predefined groups of packages.
- Listing available groups: - Listing available groups:
``` `yum group list`
yum group list
```
- Getting info about a group: - Getting info about a group:
``` `yum group info "group_name"`
yum group info "group_name"
```
- Installing a group: - Installing a group:
``` `sudo yum group install "group_name"`
sudo yum group install "group_name"
```
- Removing a group: - Removing a group:
``` `sudo yum group remove "group_name"`
sudo yum group remove "group_name"
```
### 5. Yum Cache Management ### 5. Yum Cache Management
Yum maintains a cache to speed up operations. Yum maintains a cache to speed up operations.
- Cleaning all cached packages and metadata: - Cleaning all cached packages and metadata:
``` `sudo yum clean all`
sudo yum clean all
```
- Cleaning only cached packages: - Cleaning only cached packages:
``` `sudo yum clean packages`
sudo yum clean packages
```
- Cleaning only cached metadata: - Cleaning only cached metadata:
``` `sudo yum clean metadata`
sudo yum clean metadata
```
### 6. Advanced Yum Features ### 6. Advanced Yum Features
- Downloading a package without installing: - Downloading a package without installing:
``` `yumdownloader package_name`
yumdownloader package_name
```
- Installing a local RPM package with Yum (to resolve dependencies): - 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: - Checking for available updates:
``` `yum check-update`
yum check-update
```
- Listing installed packages: - Listing installed packages:
``` `yum list installed`
yum list installed
```
- Listing available packages: - Listing available packages:
``` `yum list available`
yum list available
```
### 7. Yum History ### 7. Yum History
Yum keeps a history of transactions, allowing you to undo or redo actions. Yum keeps a history of transactions, allowing you to undo or redo actions.
- Viewing Yum history: - Viewing Yum history:
``` `yum history list`
yum history list
```
- Undoing a transaction: - Undoing a transaction:
``` `sudo yum history undo transaction_id`
sudo yum history undo transaction_id
```
- Redoing a transaction: - Redoing a transaction:
``` `sudo yum history redo transaction_id`
sudo yum history redo transaction_id
```
### 8. Yum Configuration ### 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 - yum-plugin-versionlock: Locks specified packages to a particular version
To install a plugin: To install a plugin:
``` `sudo yum install plugin_name`
sudo yum install plugin_name
```
### 10. Troubleshooting ### 10. Troubleshooting
If you encounter issues with Yum, try these steps: If you encounter issues with Yum, try these steps:
- Clear the Yum cache: - Clear the Yum cache:
``` `sudo yum clean all`
sudo yum clean all
```
- Rebuild the Yum cache: - Rebuild the Yum cache:
``` `sudo yum makecache`
sudo yum makecache
```
- Check for conflicting transactions: - Check for conflicting transactions:
``` `sudo yum-complete-transaction --cleanup-only`
sudo yum-complete-transaction --cleanup-only
```
- Verify the package database: - 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: 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. 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: 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: For a more aggressive upgrade that might remove obsolete packages:
```bash `sudo apt-get dist-upgrade`
sudo apt-get dist-upgrade
```
### 4. Installing Packages ### 4. Installing Packages
To install a new package: 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: 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 ### 5. Removing Packages
To remove a package: 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: 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 ### 6. Searching for Packages
To search for a package: To search for a package:
```bash `apt-cache search keyword`
apt-cache search keyword
```
### 7. Displaying Package Information ### 7. Displaying Package Information
To show detailed information about a package: To show detailed information about a package:
```bash `apt-cache show package_name`
apt-cache show package_name
```
### 8. Cleaning Up ### 8. Cleaning Up
To remove unnecessary packages: To remove unnecessary packages:
```bash `sudo apt-get autoremove`
sudo apt-get autoremove
```
To clear out the local repository of retrieved package files: To clear out the local repository of retrieved package files:
```bash `sudo apt-get clean`
sudo apt-get clean
```
### 9. Handling Dependencies ### 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: 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: To remove the hold:
```bash `sudo apt-mark unhold package_name`
sudo apt-mark unhold package_name
```
### 12. Simulating Operations ### 12. Simulating Operations
You can simulate operations without actually performing them using the `-s` flag: 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. This is useful for seeing what would happen without making any changes.

View File

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

View File

@ -1,10 +1,10 @@
# Understanding and Using SystemD # 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. 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. - 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. - 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. - Sockets: Allow for service activation on demand.
- Timers: Provide cron-like functionality for scheduling tasks. - 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/. 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 WantedBy=multi-user.target
``` ```
### 4. Basic systemd Commands ## 4. Basic systemd Commands
- systemctl: The main command for interacting with systemd - systemctl: The main command for interacting with systemd
- journalctl: Used for viewing logs - journalctl: Used for viewing logs
- systemd-analyze: Analyzes system boot-up performance - systemd-analyze: Analyzes system boot-up performance
Common systemctl commands: Common systemctl commands:
``` - `systemctl start service-name`
systemctl start service-name - `systemctl stop service-name`
systemctl stop service-name - `systemctl restart service-name`
systemctl restart service-name - `systemctl status service-name`
systemctl status service-name - `systemctl enable service-name`
systemctl enable service-name - `systemctl disable service-name`
systemctl disable service-name
```
### 5. Managing Services
## 5. Managing Services
To create a new service: To create a new service:
1. Create a unit file in /etc/systemd/system/ (e.g., myservice.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` 3. Reload the systemd manager: `systemctl daemon-reload`
4. Start and enable the service: `systemctl start myservice && systemctl enable myservice` 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: systemd uses target units to manage the boot process. Key targets include:
- poweroff.target - poweroff.target
@ -64,11 +63,9 @@ systemd uses target units to manage the boot process. Key targets include:
- graphical.target - graphical.target
To change the default 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: journald is systemd's logging system. Key features:
- Collects messages from the kernel, services, and applications - Collects messages from the kernel, services, and applications
@ -76,13 +73,12 @@ journald is systemd's logging system. Key features:
- Supports structured logging - Supports structured logging
Basic journalctl usage: Basic journalctl usage:
``` - `journalctl -u service-name` # View logs for a specific service
journalctl -u service-name # View logs for a specific service - `journalctl -f` # Follow new log entries
journalctl -f # Follow new log entries - `journalctl --since "1 hour ago"` # View recent logs
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. - Socket Activation: Services start on-demand when a client connects to their socket.
- Resource Control: Limit CPU, memory, and other resources for services. - Resource Control: Limit CPU, memory, and other resources for services.
@ -96,7 +92,7 @@ CPUQuota=20%
MemoryLimit=100M MemoryLimit=100M
``` ```
### 9. Troubleshooting ## 9. Troubleshooting
- Check service status: `systemctl status service-name` - Check service status: `systemctl status service-name`
- View recent logs: `journalctl -u service-name -n 50 --no-pager` - 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: To list network interfaces:
``` `ip link show`
ip link show
```
or or
``` `ifconfig -a`
ifconfig -a
```
## 2. IP Address Configuration ## 2. IP Address Configuration
@ -26,15 +22,11 @@ ifconfig -a
- To set an IP address temporarily: - 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: - 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: ### Permanent IP configuration:
@ -71,9 +63,7 @@ Many modern Linux distributions use Network Manager for easier network configura
Set the hostname: Set the hostname:
``` `sudo hostnamectl set-hostname new-hostname`
sudo hostnamectl set-hostname new-hostname
```
Update /etc/hosts file to include the 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: View routing table:
``` `ip route show`
ip route show
```
Add a static route: 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 ## 8. Firewall Configuration
@ -108,15 +94,11 @@ Most Linux distributions use iptables or nftables. Ubuntu uses ufw (Uncomplicate
Enable UFW: Enable UFW:
``` `sudo ufw enable`
sudo ufw enable
```
Allow incoming SSH: Allow incoming SSH:
``` `sudo ufw allow ssh`
sudo ufw allow ssh
```
## 9. Network Diagnostics ## 9. Network Diagnostics
@ -129,27 +111,22 @@ sudo ufw allow ssh
Start/stop network service: Start/stop network service:
``` `sudo systemctl start networking`
sudo systemctl start networking `sudo systemctl stop networking`
sudo systemctl stop networking
```
Enable/disable network service at boot: Enable/disable network service at boot:
``` `sudo systemctl enable networking`
sudo systemctl enable networking `sudo systemctl disable networking`
sudo systemctl disable networking
```
## 11. Wireless Network Configuration ## 11. Wireless Network Configuration
Use 'iwconfig' to configure wireless interfaces: Use 'iwconfig' to configure wireless interfaces:
``` `sudo iwconfig wlan0 essid "NetworkName" key s:password` #Not advised because it will leave your network password in the bash history!
sudo iwconfig wlan0 essid "NetworkName" key s:password
```
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 ## 12. Network Bonding
@ -167,10 +144,3 @@ iface bond0 inet static
bond-primary eth0 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 - IPv6 support
Basic UFW commands: Basic UFW commands:
``` - `sudo ufw enable` # Enable the firewall
sudo ufw enable # Enable the firewall - `sudo ufw disable` # Disable the firewall
sudo ufw disable # Disable the firewall - `sudo ufw status` # Check firewall status
sudo ufw status # Check firewall status `sudo ufw status numbered` # List the current ufw rules and their associated rule number
sudo ufw allow 22 # Allow incoming traffic on port 22 (SSH) `sudo ufw delete RULENUM` # Delete the firewall rule by number
sudo ufw deny 80 # Deny incoming traffic on port 80 (HTTP) - `sudo ufw allow 22` # Allow incoming traffic on port 22 (SSH)
sudo ufw allow from 192.168.1.0/24 # Allow traffic from a specific subnet - `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: Advanced usage:
- Rate limiting: `sudo ufw limit 22/tcp` - Rate limiting: `sudo ufw limit 22/tcp`
@ -46,14 +48,12 @@ Key features:
- Runtime and permanent configuration options - Runtime and permanent configuration options
- D-Bus interface for easy integration with other applications - D-Bus interface for easy integration with other applications
Basic firewalld commands: - Basic firewalld commands:
``` - `sudo systemctl start firewalld` # Start firewalld
sudo systemctl start firewalld # Start firewalld - `sudo systemctl enable firewalld` # Enable firewalld to start on boot
sudo systemctl enable firewalld # Enable firewalld to start on boot - `sudo firewall-cmd --state` # Check firewalld status
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=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
sudo firewall-cmd --zone=internal --add-source=192.168.1.0/24 # Add a source to the internal zone
```
Advanced usage: Advanced usage:
- Custom services: `sudo firewall-cmd --new-service=myapp` - Custom services: `sudo firewall-cmd --new-service=myapp`
@ -66,6 +66,7 @@ Advanced usage:
- Simpler, more straightforward for basic setups - Simpler, more straightforward for basic setups
- Ideal for single-host systems or simple network configurations - Ideal for single-host systems or simple network configurations
- Easier to learn for beginners - Easier to learn for beginners
- Has a GUI (gufw) that can be installed. `sudo apt update && sudo apt install gufw`
### firewalld: ### firewalld:
- More flexible and powerful for complex network setups - More flexible and powerful for complex network setups
@ -85,10 +86,8 @@ Advanced usage:
- Test connections with tools like `netcat` or `telnet` - Test connections with tools like `netcat` or `telnet`
- Temporarily disable the firewall to isolate issues - Temporarily disable the firewall to isolate issues
## 8. Advanced Topics ## 8. Advanced Topics (Coming Soon)
- Stateful vs. stateless firewalls - Stateful vs. stateless firewalls
- Network Address Translation (NAT) configuration - Network Address Translation (NAT) configuration
- Setting up DMZ (Demilitarized Zone) - Setting up DMZ (Demilitarized Zone)
- Integrating with intrusion detection/prevention systems (IDS/IPS) - 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: ## 1. Basic Network Configuration Check:
- Check IP address and network interface status: - 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: - 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: - 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: ## 2. Connectivity Tests:
- Ping test: - Ping test:
``` - `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)
ping -c 4 8.8.8.8
```
Tests basic connectivity to Google's DNS server (or any other IP).
- Traceroute: - 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: - DNS resolution test:
``` - `nslookup google.com` # These test DNS resolution capabilities.
nslookup google.com - `dig google.com` # These test DNS resolution capabilities.
```
or
```
dig google.com
```
These test DNS resolution capabilities.
## 3. Advanced Diagnostic Tools: ## 3. Advanced Diagnostic Tools:
- netstat or ss: - netstat or ss:
``` - `netstat -tulpn` # Display active network connections and listening ports.
netstat -tuln - `ss -tulpn` # Display active network connections and listening ports.
```
or
```
ss -tuln
```
Display active network connections and listening ports.
- tcpdump: - tcpdump:
``` - `sudo tcpdump -i eth0` # eth0 is the Device name. Captures and displays packet data on a specified interface.
sudo tcpdump -i eth0
```
Captures and displays packet data on a specified interface.
- nmap: - nmap:
``` - `nmap -p- localhost` # Scans every port on the local machine (or any specified target).
nmap -p- localhost
```
Scans for open ports on the local machine (or any specified target).
## 4. Firewall Configuration: ## 4. Firewall Configuration:
- Check iptables rules: - 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): - Temporarily disable firewall (for testing):
``` - `sudo systemctl stop firewalld` # Stops firewalld on the current boot - will start at next boot if enabled
sudo systemctl stop firewalld # for systems using firewalld - `sudo ufw disable` # Disables firewalld at system boot and stops it immedietely
```
or
```
sudo ufw disable # for systems using ufw
```
## 5. Network Service Diagnostics: ## 5. Network Service Diagnostics:
- Check service status: - Check service status:
``` - `systemctl status networking`
systemctl status networking - `systemctl status NetworkManager`
```
or
```
systemctl status NetworkManager
```
- Restart network service: - Restart network service:
``` - `sudo systemctl restart networking`
sudo systemctl restart networking - `sudo systemctl restart NetworkManager`
```
or
```
sudo systemctl restart NetworkManager
```
## 6. Network Interface Configuration: ## 6. Network Interface Configuration:
- Edit network interface configuration: - Edit network interface configuration:
``` - `sudo nano /etc/network/interfaces` # for Debian-based systems
sudo nano /etc/network/interfaces # for Debian-based systems - `sudo nano /etc/sysconfig/network-scripts/ifcfg-eth0` # for Red Hat-based systems
```
or
```
sudo nano /etc/sysconfig/network-scripts/ifcfg-eth0 # for Red Hat-based systems
```
- Restart specific network interface: - Restart specific network interface:
``` - `sudo ifdown eth0 && sudo ifup eth0`
sudo ifdown eth0 && sudo ifup eth0 - `sudo ip link set eth0 down && sudo ip link set eth0 up`
```
or
```
sudo ip link set eth0 down && sudo ip link set eth0 up
```
## 7. Wireless Network Troubleshooting: ## 7. Wireless Network Troubleshooting:
- List available wireless networks: - List available wireless networks:
``` - `sudo iwlist wlan0 scan`
sudo iwlist wlan0 scan
```
- Check wireless interface details: - Check wireless interface details:
``` - `iwconfig`
iwconfig
```
- Monitor wireless connection in real-time: - Monitor wireless connection in real-time:
``` - `watch -n 1 iwconfig`
watch -n 1 iwconfig
```
## 8. Advanced Network Analysis: ## 8. Advanced Network Analysis:
- Wireshark: GUI-based packet analyzer - Wireshark: GUI-based packet analyzer
Install with: Install with:
``` - `sudo apt-get install wireshark` # on Debian-based systems
sudo apt-get install wireshark # on Debian-based systems - `sudo yum install wireshark` # on Red Hat-based systems
```
or
```
sudo yum install wireshark # on Red Hat-based systems
```
- iftop: Displays bandwidth usage on an interface - iftop: Displays bandwidth usage on an interface
``` - `sudo iftop -i eth0`
sudo iftop -i eth0
```
- nethogs: Groups bandwidth by process - nethogs: Groups bandwidth by process
``` - `sudo nethogs eth0`
sudo nethogs eth0
```
## 9. Performance Testing: ## 9. Performance Testing:
- iperf: Network performance measurement tool - iperf: Network performance measurement tool
``` - `iperf -s` # on server
iperf -s # on server - `iperf -c server_ip` # on client
iperf -c server_ip # on client
```
- speedtest-cli: Command-line interface for testing internet speed - speedtest-cli: Command-line interface for testing internet speed
``` `speedtest-cli`
speedtest-cli
```
## 10. Log Analysis: ## 10. Log Analysis:
- `sudo tail -f /var/log/syslog` # on Debian-based systems
- System logs: - `sudo tail -f /var/log/messages` # on Red Hat-based systems
``` - `sudo journalctl -b0`
sudo tail -f /var/log/syslog # on Debian-based systems - `sudo dmesg -k`
```
or
```
sudo tail -f /var/log/messages # on Red Hat-based systems
```
or
```
sudo journalctl -b0
```
or
```
sudo dmesg -k
```
- Network-specific logs: - Network-specific logs:
``` - `sudo tail -f /var/log/daemon.log`
sudo tail -f /var/log/daemon.log
```
## 11. Network Configuration Backup and Restore: ## 11. Network Configuration Backup and Restore:
- Backup network configuration: - 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
sudo tar -czvf network_config_backup.tar.gz /etc/network
```
- Restore network configuration: - Restore network configuration:
``` - `sudo tar -xzvf network_config_backup.tar.gz -C /`
sudo tar -xzvf network_config_backup.tar.gz -C /
```
## 12. Troubleshooting Specific Issues: ## 12. Troubleshooting Specific Issues:
- High latency: Use ping and traceroute to identify where delays occur. - High latency: Use ping and traceroute to identify where delays occur.
- Packet loss: Use mtr (My TraceRoute) for a combination of ping and traceroute. - Packet loss: Use mtr (My TraceRoute) for a combination of ping and traceroute.
- DNS issues: Check /etc/hosts file and DNS server configurations. - DNS issues: Check /etc/hosts file and DNS server configurations.
- IP conflicts: Use arping to detect duplicate IP addresses on the network. - 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 ## 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 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). - Key Size: Larger keys are more secure but slower (e.g., 4096-bit RSA).
- Passphrase: An extra layer of security for private keys. - 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 ## 6. Common SSH Commands
- `ssh user@hostname`: Basic connection command. - `ssh user@hostname`: Basic connection command.
- `scp`: Secure copy files between hosts. - `scp user@hostname:/full/source/path ~/destination`: Secure copy files between hosts.
- `sftp`: Secure file transfer protocol. - `sftp user@hostname`: Secure file transfer protocol.
- `ssh-keygen`: Generate SSH key pairs. - `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 ## 7. SSH Configuration
@ -48,16 +48,16 @@ SSH operates on a client-server model. The process typically involves:
- Server Configuration: `/etc/ssh/sshd_config` - Server Configuration: `/etc/ssh/sshd_config`
- Important settings: - Important settings:
- Port (default 22) - Port (default 22)
- PermitRootLogin - PermitRootLogin : Usually commented out to disable root from using SSH.
- PasswordAuthentication - PasswordAuthentication: Set to no if you want to only use RSA keys
- PubkeyAuthentication - PubkeyAuthentication: Set to yes if you want to use RSA keys for authentication.
## 8. SSH Security Best Practices ## 8. SSH Security Best Practices
- Use key-based authentication instead of passwords. - Use key-based authentication instead of passwords.
- Disable root login. - Disable root login.
- Use non-standard ports. - 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. - Keep software up-to-date.
- Use SSH protocol version 2. - Use SSH protocol version 2.
- Limit user access with AllowUsers or AllowGroups. - Limit user access with AllowUsers or AllowGroups.
@ -65,26 +65,25 @@ SSH operates on a client-server model. The process typically involves:
## 9. Advanced SSH Features ## 9. Advanced SSH Features
- Port Forwarding: Local, Remote, and Dynamic. - 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. - SSH Agent: Manage multiple SSH keys.
- ProxyJump: Easily connect through a jump host. - ProxyJump: Easily connect through a jump host.
## 10. Troubleshooting SSH ## 10. Troubleshooting SSH
- Connection Issues: Check network, firewall, and SSH service status. - 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. - Performance Issues: Consider compression or alternative ciphers.
## 11. SSH Alternatives and Related Protocols ## 11. SSH Alternatives and Related Protocols
- Telnet: Older, unencrypted protocol (not recommended). - Telnet: Older, unencrypted protocol (not recommended - INSECURE).
- RDP: Remote Desktop Protocol (mainly for Windows). - RDP: Remote Desktop Protocol - allows a full desktop (mainly for Windows).
- VNC: Virtual Network Computing (graphical desktop sharing). - VNC: Virtual Network Computing - allows a full desktop (graphical desktop sharing).
## 12. SSH in Enterprise Environments ## 12. SSH in Enterprise Environments
- Centralized key management solutions. - Centralized key management solutions.
- Integration with LDAP or Active Directory. - Integration with LDAP or Active Directory.
- Auditing and logging considerations. - Auditing and logging considerations.
- Bastion hosts for added security. - 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: OpenVPN is one of the most popular and secure VPN protocols. To set it up:
- 1. Install OpenVPN: - 1. Install OpenVPN:
``` `sudo apt install openvpn`
sudo apt install openvpn
```
- 2. Obtain configuration files from your VPN provider. - 2. Obtain configuration files from your VPN provider.
Varies on each provider
- 3. Connect to the VPN: - 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: - 4. For automatic connection, create a systemd service:
``` `sudo nano /etc/systemd/system/openvpn.service`
sudo nano /etc/systemd/system/openvpn.service - Add the following content:
```
Add the following content:
``` ```
[Unit] [Unit]
Description=OpenVPN connection to YOUR_VPN Description=OpenVPN connection to YOUR_VPN
@ -38,34 +33,23 @@ WantedBy=multi-user.target
``` ```
Enable and start the service: Enable and start the service:
``` - `sudo systemctl enable --now openvpn.service` # Starts OpenVPN right "now" and "enable"s it on next boot as well
sudo systemctl enable openvpn.service - `sudo systemctl start openvpn.service` # Just "start"s OpenVPN for the current boot.
sudo systemctl start openvpn.service
```
### WireGuard: ### WireGuard:
WireGuard is a newer, faster VPN protocol. To set it up: WireGuard is a newer, faster VPN protocol. To set it up:
- a. Install WireGuard: - a. Install WireGuard: `sudo apt install wireguard`
```
sudo apt install wireguard
```
- b. Create a configuration file: - b. Create a configuration file: `sudo nano /etc/wireguard/wg0.conf`
``` -Add your WireGuard configuration details specific to your vendor.
sudo nano /etc/wireguard/wg0.conf
```
Add your WireGuard configuration details.
- c. Start the WireGuard connection: - c. Start the WireGuard connection:
``` - sudo wg-quick up wg0`
sudo wg-quick up wg0
```
- d. To enable automatic connection on boot: - d. To "enable" automatic connection on boot and right "now":
``` - `sudo systemctl enable --now wg-quick@wg0`
sudo systemctl enable wg-quick@wg0
```
### Built-in VPN clients: ### Built-in VPN clients:
Many Linux distributions include built-in VPN clients in their network managers, supporting protocols like OpenVPN, L2TP/IPsec, and PPTP. 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: ### Environment variables:
Set these variables in your shell configuration file (e.g., ~/.bashrc): Set these variables in your shell configuration file (e.g., ~/.bashrc):
``` ```
export http_proxy="http://proxy_server:port" export http_proxy="http://proxy_server:port"
export https_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: Use proxychains to route terminal commands through a proxy:
#### 1. Install proxychains: #### 1. Install proxychains:
``` `sudo apt install proxychains`
sudo apt install proxychains
```
#### 2. Configure proxychains: #### 2. Configure proxychains:
``` `sudo nano /etc/proxychains.conf`
sudo nano /etc/proxychains.conf
```
Add your proxy server details. Add your proxy server details.
#### 3. Use proxychains: #### 3. Use proxychains:
``` `proxychains command_to_run`
proxychains command_to_run
```
### SOCKS proxy with SSH: ### SOCKS proxy with SSH:
Create a SOCKS proxy using SSH: Create a SOCKS proxy using SSH:
``` - `ssh -D 1080 -f -C -q -N username@remote_host`
ssh -D 1080 -f -C -q -N username@remote_host - Then configure applications to use SOCKS5 proxy at 127.0.0.1:1080.
```
Then configure applications to use SOCKS5 proxy at 127.0.0.1:1080.
## 3. Testing and Verification ## 3. Testing and Verification
To verify your VPN or proxy configuration: To verify your VPN or proxy configuration:
- Check your IP address: - Check your IP address:
``` `curl ifconfig.me`
curl ifconfig.me
```
- DNS leak test: - DNS leak test:
``` `dig +short myip.opendns.com @resolver1.opendns.com`
dig +short myip.opendns.com @resolver1.opendns.com
```
- WebRTC leak test (in browsers) - WebRTC leak test (in browsers)
@ -154,9 +127,4 @@ dig +short myip.opendns.com @resolver1.opendns.com
- Check logs: `journalctl -u openvpn` or `journalctl -u wg-quick@wg0` - Check logs: `journalctl -u openvpn` or `journalctl -u wg-quick@wg0`
- Verify DNS settings - Verify DNS settings
- Ensure correct permissions on configuration files - Ensure correct permissions on configuration files
- Check for conflicting network settings - 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: The basic syntax for sudo is:
``` `sudo [options] command`
sudo [options] command
```
### Common Options ### Common Options
- `-u` username: Run the command as a user other than root - `-u`: username: Run the command as a user other than root
- `-i:` Simulate initial login (shell) - `-i`: Simulate initial login (shell)
- `-s:` Run the specified shell - `-s`: Run the specified shell
- `-l:` List the allowed commands for the current user - `-l`: List the allowed commands for the current user
- `-v:` Validate and update the user's timestamp without running a command - `-v`: Validate and update the user's timestamp without running a command
- `-E`: Preserve the current "E"nvironment
## Configuration ## 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:** >**To edit the sudoers file:**
``` `sudo visudo`
sudo visudo
```
## Basic sudoers File Structure ## Basic sudoers File Structure
@ -44,35 +41,25 @@ root ALL=(ALL:ALL) ALL
%sudo ALL=(ALL:ALL) ALL %sudo ALL=(ALL:ALL) ALL
# Allow specific user to run specific commands without a password # 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 ### Usage Examples
- Run a command as root: - Run a command as root:
``` `sudo apt update`
sudo apt update
```
- Edit a system file: - Edit a system file:
``` `sudo nano /etc/hosts`
sudo nano /etc/hosts
```
- Switch to root user: - Switch to root user:
``` `sudo -i`
sudo -i
```
- Run a command as another user: - Run a command as another user:
``` `sudo -u username command`
sudo -u username command
```
- List allowed commands: - List allowed commands:
``` `sudo -l`
sudo -l
```
### Sudo vs. Su ### Sudo vs. Su
@ -103,8 +90,4 @@ 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 - Forgotten sudo password: Boot into recovery mode to reset the password
- Syntax errors in sudoers: Use visudo to edit and check for errors - 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 ## 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: 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: Let's break down this information:
- First character: File type (- for regular file, d for directory) - First character: File type (- for regular file, d for directory)
- Next 9 characters: Permissions for owner, group, and others - Next 9 characters: Permissions for owner, group, and others
- User and group names - User name and group names
- File size - File size in bytes
- Last modification date and time - Last modification date and time
- File name - File name
@ -66,9 +64,7 @@ The sum of these values for each user category represents the permissions:
### Using chmod with Symbolic Notation ### Using chmod with Symbolic Notation
The `chmod` command is used to change file permissions. The basic syntax is: 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) - Who: u (user/owner), g (group), o (others), a (all)
- Operation: + (add), - (remove), = (set exactly) - Operation: + (add), - (remove), = (set exactly)
@ -82,9 +78,7 @@ Examples:
### Using chmod with Numeric Notation ### Using chmod with Numeric Notation
You can also use numeric notation with chmod: You can also use numeric notation with chmod:
``` `chmod [numeric_permissions] filename`
chmod [numeric_permissions] filename
```
Example: Example:
- `chmod 755 file.txt`: Set rwx for owner, rx for group and others - `chmod 755 file.txt`: Set rwx for owner, rx for group and others
@ -94,16 +88,12 @@ Example:
### chown command ### chown command
Use `chown` to change the owner of a file: Use `chown` to change the owner of a file:
``` `chown new_owner filename`
chown new_owner filename
```
### chgrp command ### chgrp command
Use `chgrp` to change the group of a file: Use `chgrp` to change the group of a file:
``` `chgrp new_group filename`
chgrp new_group filename
```
## 7. Special Permissions ## 7. Special Permissions
@ -144,8 +134,4 @@ Example:
- Always use the principle of least privilege - Always use the principle of least privilege
- Regularly audit file permissions - Regularly audit file permissions
- Be cautious when using recursive permission changes - Be cautious when using recursive permission changes
- Understand the implications of SetUID and SetGID bits - 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. - GID 65534 (nogroup): Often used for unprivileged processes.
## 6. Viewing and modifying UIDs and GIDs: ## 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 users: cat /etc/passwd
- View all groups: cat /etc/group - View all groups: cat /etc/group
- Change a user's UID: usermod -u NEW_UID USERNAME - Change a user's UID: `sudo usermod -u NEW_UID USERNAME`
- Change a group's GID: groupmod -g NEW_GID GROUPNAME - Change a group's GID: `sudo groupmod -g NEW_GID GROUPNAME`
- Add a user to a group: usermod -aG GROUPNAME USERNAME - Add a user to a group: `sudo usermod -aG GROUPNAME USERNAME`
## 7. UIDs, GIDs, and file permissions: ## 7. UIDs, GIDs, and file permissions:
- Each file and directory in Linux has an owner (UID) and a group (GID). - Each file and directory in Linux has an owner (UID) and a group (GID).

View File

@ -1,22 +0,0 @@
MIT License
Copyright (c) 2024 BitHarbor
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.