Sanitize Chapter 2 of Hyperlinks and removed some duplicate info (some still remains)

This commit is contained in:
ganome 2024-09-04 11:18:26 -06:00
parent 5e7ed1fdc8
commit 90c8450f76
Signed by untrusted user who does not match committer: Ganome
GPG Key ID: 944DE53336D81B83
8 changed files with 89 additions and 199 deletions

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:
@ -65,8 +65,3 @@ c) Shut down without sudo (if configured): `shutdown -h now`
- 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.

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/.)