Add tldr bash section and minor fixes

This commit is contained in:
2025-04-22 13:48:43 +01:00
parent 1fd800abf1
commit 39fc764344
9 changed files with 158 additions and 97 deletions

View File

@@ -4,12 +4,34 @@
"type": "split",
"children": [
{
"id": "900961c3a85bfabb",
"id": "e8837102b8bf49ad",
"type": "tabs",
"dimension": 48.44173441734417,
"children": [
{
"id": "fc8813233e11f75b",
"type": "leaf",
"state": {
"type": "markdown",
"state": {
"file": "drafts/bash.md",
"mode": "source",
"source": false
},
"icon": "lucide-file",
"title": "bash"
}
}
]
},
{
"id": "900961c3a85bfabb",
"type": "tabs",
"dimension": 51.55826558265583,
"children": [
{
"id": "7f9bd58214dfcb4d",
"type": "leaf",
"state": {
"type": "markdown",
"state": {
@@ -22,20 +44,21 @@
}
},
{
"id": "2c7f99d6e12af978",
"id": "b1ce9fc55dcb67b6",
"type": "leaf",
"state": {
"type": "markdown",
"state": {
"file": "notes/compiling.md",
"file": "notes/linux/index.md",
"mode": "source",
"source": false
},
"icon": "lucide-file",
"title": "compiling"
"title": "index"
}
}
]
],
"currentTab": 1
}
],
"direction": "vertical"
@@ -108,7 +131,7 @@
"state": {
"type": "backlink",
"state": {
"file": "TODO.md",
"file": "notes/linux/index.md",
"collapseAll": false,
"extraContext": false,
"sortOrder": "alphabetical",
@@ -118,7 +141,7 @@
"unlinkedCollapsed": true
},
"icon": "links-coming-in",
"title": "Backlinks for TODO"
"title": "Backlinks for index"
}
},
{
@@ -155,7 +178,7 @@
"state": {
"type": "outline",
"state": {
"file": "notes/index/index.md",
"file": "notes/linux/index.md",
"followCursor": false,
"showSearch": false,
"searchQuery": ""
@@ -170,8 +193,8 @@
"state": {
"type": "advanced-tables-toolbar",
"state": {},
"icon": "spreadsheet",
"title": "Advanced Tables"
"icon": "lucide-file",
"title": "Plugin no longer active"
}
}
],
@@ -193,15 +216,33 @@
"table-editor-obsidian:Advanced Tables Toolbar": false
}
},
"active": "fc8813233e11f75b",
"active": "b1ce9fc55dcb67b6",
"lastOpenFiles": [
"notes/compiling.md",
"notes/index/index.md",
"Pasted image 20250422121610.png",
"notes/linux/index.md",
"drafts/rust.md",
"notes/c-language.md",
"Pasted image 20250422122034.png",
"notes/index/index.md",
"Pasted image 20250422123058.png",
"Pasted image 20250422122140.png",
"drafts/bash.md",
"notes/c-language.md",
"drafts/gobject.md",
"drafts/lua.md",
"notes/https-ssl-certs.md",
"notes/http.md",
"notes/html.md",
"notes/git.md",
"notes/gdb.md",
"notes/flask.md",
"notes/encryption.md",
"notes/firewall.md",
"notes/compiling.md",
"notes/c-snippets.md",
"search.md",
"drafts/assembly.md",
"TODO.md",
"drafts/hardware-tools.md",
"drafts/rust.md",
"notes/how_to_computer/index.md",
"posts/linux-starter-guide/index.md",
"drafts/linux/plasma6.jpg",
@@ -210,30 +251,12 @@
"posts/linux-starter-guide/plasma6.jpg",
"notes/linux/debian-software-selection.png",
"notes/linux/Pasted image 20250409112858.png",
"notes/git.md",
"posts/dotfiles.md",
"drafts/linux-encrypt/index.md",
"notes/linux/image7.png",
"notes/linux/image6.png",
"notes/linux/image5.png",
"notes/linux/Pasted image 20250401143509.png",
"drafts/swift.md",
"drafts/nvim.md",
"drafts/macOS.md",
"drafts/lua.md",
"drafts/linux-encrypt",
"notes/linux",
"drafts/hardware-tools.md",
"drafts/assembly.md",
"drafts",
"notes/drafts/bash.md",
"notes/drafts/linux/index.md",
"notes/drafts/rust.md",
"notes/drafts/swift.md",
"notes/drafts/linux-encrypt/index.md",
"notes/gdb.md",
"debian-12.10.0-amd64-netinst.iso",
"notes/encryption.md",
"notes/index",
"notes/cs",
"textgenerator/templates/awesomePrompts",

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

View File

@@ -1,24 +0,0 @@
---
draft: true
---
## Notes
### New Notes
In draft folder? (checkbox)
- [x] Linux Architecture / Linux
- [x] Assembly
- [x] Rust
- [x] Swift
- [x] Lua
- [ ] JS
- [ ] CSS
- [x] macOS
- [ ] FreeBSD
- [x] Neovim, vim bindings, text editor
- [x] Hardware Debug/Repair Tools (maybe integrate JCionx page?)
- [ ] Android and custom ROMs
- [ ] netcat
### Enhancements

View File

@@ -8,6 +8,34 @@ author: TrudeEH
showToc: true
---
## Run a Bash Script
Example `script.sh`:
```bash
#! /bin/bash
echo "Bash Script"
```
Execute the script:
```bash
chmod u+x script.sh # Give the script execution permission (to its owner)
./script.sh # Run the script
```
## Documentation
You will learn more about these commands later
```bash
whatis command # Short description of the command
tldr command # Examples of how to use the command
man command # Full documentation for the command
man bash # Bash documentation; Includes most built-in commands
```
## Strings
- `""` Defines a string which supports substitutions (`$` and `\`, for example).
@@ -37,7 +65,7 @@ If the first word of a command is a reserved word, bash handles the command, oth
|`if`|`then`|`elif`|`else`|`fi`|`time`|
|`for`|`in`|`until`|`while`|`do`|`done`|
|`case`|`esac`|`coproc`|`select`|`function`|
|`{`|`}`|`[[`|`]]`|`!`|
|`{`|`}`|`[`](`)`|`!`|
## List of Commands
@@ -159,7 +187,7 @@ Enter a number:
The arithmetic expression is evaluated according to the rules described below (see [Shell Arithmetic]() TODO link to shell arithmetic).
### `[[...]]`
### `[...](...)`
Return a status of 0 or 1 depending on the evaluation of the conditional expression expression. Expressions are composed of the primaries described below in [Bash Conditional Expressions](https://www.gnu.org/software/bash/manual/bash.html#Bash-Conditional-Expressions).
@@ -474,7 +502,7 @@ To learn more about some command, run `help command`.
- `BASH_EXECUTION_STRING` Command argument passed via the `-c` invocation option.
- `BASH_LINENO` Array of line numbers where functions in `FUNCNAME` were invoked.
- `BASH_LOADABLES_PATH` Search path for dynamically loadable builtins (`enable -f`).
- `BASH_REMATCH` Array holding results from regex matching (`=~`) in `[[...]]`.
- `BASH_REMATCH` Array holding results from regex matching (`=~`) in `[...](...)`.
- `BASH_SOURCE` Array of source filenames where functions in `FUNCNAME` are defined.
- `BASH_SUBSHELL` Incremented for each subshell level; initial value is 0.
- `BASH_VERSINFO` Readonly array detailing the Bash version components.
@@ -610,7 +638,7 @@ esac
## Conditional Expressions
Conditional Expressions are used by the `[[]]`, `[]` and `test` commands.
Conditional Expressions are used by the `[bash](.md)`, `[]` and `test` commands.
- `-a file` True if file exists.
- `-b file` True if file exists and is a block special file.
@@ -673,14 +701,15 @@ Arithmetic is performed using `(())`, `let` and `declare -i`.
## Arrays
### Indexed arrays
### Indexed Arrays
```bash
declare -a name
name[]=value
declare -a array1
array2=(1 2 "four" 8 16) # Multiple types are supported
```
### Associative arrays
### Associative Arrays
```bash
declare -A name
@@ -688,4 +717,4 @@ name=(value1 value2 ...)
```
6.7 Arrays
https://www.gnu.org/software/bash/manual/bash.html#Bash-Features
https://www.gnu.org/software/bash/manual/bash.html#Bash-Features

View File

@@ -0,0 +1,9 @@
---
title: Object-Oriented C [GObject]
description:
summary:
draft: true
tags:
author: TrudeEH
showToc: true
---

View File

@@ -1,19 +0,0 @@
---
title: "hardware-tools"
description:
draft: true
tags:
author: TrudeEH
showToc: true
---
Scrcpy
scrcpy —otg
scrcpy
ADB
adb kill-server

View File

@@ -1,5 +1,5 @@
---
title: Compiling [MAKE / GCC]
title: C Compiling
description:
draft: false
tags:

View File

@@ -19,18 +19,14 @@ weight: "1"
- GUI Apps
- Object-Oriented C `GObject` - `Coming Soon!`
- GUI Toolkit `GTK4` - `Coming Soon!`
- Shell Scripting `BASH` - `Coming Soon!`
- Networking
- [HTTP](../http/) `CURL`
- [HTML](../html/)
- [Encryption](../encryption/) `GPG` `Cryptsetup`
- [HTTPS and SSL Certificates](../https-ssl-certs/) `Certbot`
- [SSH](../ssh/)
- [Firewall](../firewall/) `UFW`
- [Instant Messaging](../irc/) `IRC`
- Web Development
- [HTML](../html/)
- CSS - `Coming Soon!`
- JS - `Coming Soon!`
- [Python](../python/)
- [Flask](../flask/)
- [Databases](../databases/) `SQL`

View File

@@ -161,6 +161,8 @@ syscall
This snippet implements a syscall that prints text to `stdout`, usually a terminal window.
A C program generally uses libraries, which then implement system calls to perform actions.
> To monitor system calls, use the `strace` utility.
### Processes
A process is an instance of a running program: When a program is executed, the kernel assigns a **PID** (Process ID) to it, defines a **state** (wether it is running, stopped, etc), defines which process spawned the program, and assigns it **memory space** (or address space): Virtual memory, preventing the program from accessing the memory assigned to other processes.
@@ -206,6 +208,51 @@ The GPU still has a device file, which is used by the Kernel's DRM and Mesa, but
The kernel by itself isn't intractable, so a shell is needed for the user to be able to execute programs and run commands. Bash is not only a prompt, but also an interpreter for its own programming language, which can be used to write scripts and automate tasks.
### Commands
Bash performs actions through commands. A shell command consists of the command itself, followed by its arguments.
```bash
command "arg1" "arg2"
```
If the first word of a command is a reserved word, bash handles the command, otherwise, it searches for an executable on the system's `$PATH`, a list of directories where a binary could be located.
### Bash Scripts
Example `script.sh`:
```bash
#! /bin/bash
echo "Bash Script"
```
Execute the script:
```bash
chmod u+x script.sh # Give the script execution permission (to its owner)
./script.sh # Run the script
```
### Learning
There are some commands available to search for documentation:
```bash
tldr command # Examples of how to use the command (external tool)
help command # Short documentation for the command
man command # Full documentation for the command
man bash # Bash documentation; Includes most built-in commands
```
> To get started, use `help` by itself, which provides a list of the built-in commands available in bash.
For example, suppose you want to learn how to write an `if` statement in `bash`:
![Pasted image 20250422123058](../../Pasted%20image%2020250422123058.png)
As suggested by `tldr`, to see all possible conditions, use the `man test` command.
### Compiling
Dependencies:
@@ -239,8 +286,6 @@ sudo apt install ../bash*.deb
Bash includes a set of *builtins*: Command-line utilities that come within bash itself. However, these are very limited, and to actually make the computer useful, more programs are needed.
> To learn more about a specific program, use: `man program_name`.
### Coreutils
*Coreutils* are a collection of small command-line utilities, which are essential for text, file and shell manipulation.
@@ -684,6 +729,8 @@ Root directories might vary slightly between distributions (and other UNIX syste
└── spool (Spool directories)
```
> Run `man hier` for more details.
## Package Manager (`apt`)
Without a package manager, the only way to install new programs would be to manually compile them from source. Although it is possible to install software this way, having a central software repository facilitates installing new software, managing updates, and configuring each package for the distribution it is running on.
@@ -831,11 +878,11 @@ man section utility # Read the manual page for utility in section.
Both the following commands search for man pages containing `search_term` in their short description.
```bash
man -k search_term
apropos search_term
apropos search_term # Search for a manual page
apropos --and s1 s2 # Search using multiple search terms
```
Use `man -k .` to list all known pages.
Use `apropos .` to list all known pages.
### TL;DR
@@ -903,7 +950,7 @@ The default applications provided by the desktop can use one of two toolkits: GT
#### Install a Desktop Environment
Debian's installer offers the possibility to install a desktop environment, which comes with a collection of programs and tooling selected by the Debian team. Although these are good options, the default selection is meant to be ready "out of the box", for any use-case. These *metapackages* include an office suite, games, language support, and many other programs, some of which you might not need. To set up a more minimal installation, one can skip installing a desktop environment and only select the `standard system utilities`:
Debian's installer offers the possibility to install a desktop environment, which comes with a collection of programs and tooling selected by the Debian team. Although these are good options, the default selection is meant to be ready "out of the box", for any use-case. These *metapackages* include an office suite, games, language support, and many other programs, some of which you might not need. To set up a more minimal installation, skip installing a desktop environment and only select the `standard system utilities`:
![debian-software-selection](debian-software-selection.png)
Then, after the installation finishes, install your preferred desktop environment. For GNOME, as an example, run: