diff --git a/book/src/SUMMARY.md b/book/src/SUMMARY.md index 2f716426c..be0c4ef94 100644 --- a/book/src/SUMMARY.md +++ b/book/src/SUMMARY.md @@ -9,6 +9,13 @@ * [Package Management](distro/popular-applications/package-management.md) * [Desktop Environment](distro/popular-applications/desktop-environment.md) * [Containerization](distro/popular-applications/containerization.md) + * [System Tools](distro/popular-applications/system-tools.md) + * [File Tools](distro/popular-applications/file-tools.md) + * [Network Tools](distro/popular-applications/network-tools.md) + * [Development Tools](distro/popular-applications/development-tools.md) + * [Database Tools](distro/popular-applications/database-tools.md) + * [Media Tools](distro/popular-applications/media-tools.md) + * [Security Tools](distro/popular-applications/security-tools.md) # Asterinas Kernel diff --git a/book/src/distro/popular-applications/database-tools.md b/book/src/distro/popular-applications/database-tools.md new file mode 100644 index 000000000..df247643b --- /dev/null +++ b/book/src/distro/popular-applications/database-tools.md @@ -0,0 +1,146 @@ +# Database Tools + +## SQLite + +[SQLite](https://www.sqlite.org/) is a C-language library that implements a small, fast, self-contained SQL database engine. + +### Installation + +```nix +environment.systemPackages = pkgs.sqlite; +``` + +### Verified Usage + +#### Database operations + +```bash +# Create new SQLite database and open it +sqlite3 database.db + +# Execute SQL command directly +sqlite3 database.db "CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT);" + +# Insert data +sqlite3 database.db "INSERT INTO users (name) VALUES ('Alice');" + +# Query data +sqlite3 database.db "SELECT * FROM users;" +``` + +## Redis + +[Redis](https://redis.io/) is an in-memory data structure store used as a database, cache, and message broker. + +### Installation + +```nix +environment.systemPackages = pkgs.redis; +``` + +### Verified Usage + +#### Key-value operations + +```bash +# Start Redis server with specific configuration +redis-server --bind 10.0.2.15 --port 6379 --protected-mode no + +# Connect to Redis server on specific host and port +redis-cli -h hostname -p 6379 + +# Set key-value pair +redis-cli SET mykey "Hello World" + +# Get value by key +redis-cli GET mykey + +# Delete key +redis-cli DEL mykey +``` + +## InfluxDB + +[InfluxDB](https://influxdata.com/) is a time series database designed for high write and query loads. + +### Installation + +```nix +environment.systemPackages = pkgs.influxdb; +``` + +### Verified Usage + +#### Time series operations + +```bash +# Start with specific configuration file +influxd -config /etc/influxdb/influxdb.conf + +# Connect to remote InfluxDB server +influx -host hostname -port 8086 + +# Create database +influx -execute "CREATE DATABASE mydb" + +# Use database +influx -execute "USE mydb" + +# Write data (InfluxDB line protocol) +influx -execute "INSERT cpu,host=server1 value=0.64" +influx -execute "INSERT memory,host=server1 used=80,total=100" + +# Query data +influx -execute "SELECT * FROM cpu" +influx -execute "SELECT * FROM memory WHERE host='server1'" +``` + +## InfluxDB 3 + +[InfluxDB 3.x](https://github.com/influxdata/influxdb) is the next generation of InfluxDB with improved performance and features. + +### Installation + +```nix +environment.systemPackages = pkgs.influxdb3; +``` + +### Verified Usage + +#### Time series operations + +```bash +# Start InfluxDB 3.x server +influxdb3 serve --object-store file --data-dir ~/.influxdb3 --node-id testdb --http-bind 10.0.2.15:8086 + +# Connect to remote InfluxDB server +influx -host hostname -port 8086 +``` + +## Etcd + +[Etcd](https://etcd.io/) is a distributed key-value store that provides a reliable way to store data that needs to be accessed by a distributed system. + +### Installation + +```nix +environment.systemPackages = pkgs.etcd; +``` + +### Verified Usage + +#### Distributed key-value operations + +```bash +# Start etcd with specific listen addresses +etcd --listen-peer-urls=http://10.0.2.15:8081 --listen-client-urls=http://10.0.2.15:8080 --advertise-client-urls=http://10.0.2.15:8080 + +# Put key-value pair +etcdctl --endpoints=localhost:8080 put key1 value1 + +# Get value by key +etcdctl --endpoints=localhost:8080 get key1 + +# Delete key +etcdctl --endpoints=localhost:8080 del key1 +``` diff --git a/book/src/distro/popular-applications/development-tools.md b/book/src/distro/popular-applications/development-tools.md new file mode 100644 index 000000000..8d0b86385 --- /dev/null +++ b/book/src/distro/popular-applications/development-tools.md @@ -0,0 +1,375 @@ +# Development Tools + +## Git + +[Git](https://git-scm.com/) is a distributed version control system. + +### Installation + +```nix +environment.systemPackages = pkgs.git; +``` + +### Verified Usage + +#### Version control + +```bash +# Clone existing repository +git clone https://github.com/user/repo.git + +# Check repository status +git status + +# View commit history +git log + +# Create and switch to new branch +git checkout -b new-feature + +# View differences +git diff + +# Add files to staging area +git add file.txt + +# Commit changes +git commit -m "Commit message" + +# Push changes to remote +git push origin main +``` + +## Vim + +[Vim](https://www.vim.org/) is a highly configurable text editor. + +### Installation + +```nix +environment.systemPackages = pkgs.vim; +``` + +### Verified Usage + +#### Text editing + +```bash +# Open file in vim +vim filename.txt + +# Basic navigation (in normal mode): +# h,j,k,l - Move left, down, up, right +# w,W - Move to next word +# b,B - Move to previous word +# 0 - Move to beginning of line +# $ - Move to end of line +# gg - Go to first line +# G - Go to last line +# :10 - Go to line 10 + +# Editing modes: +# i - Insert mode before cursor +# a - Insert mode after cursor +# o - Open new line below +# O - Open new line above +# Esc - Return to normal mode + +# Saving and quitting: +# :w - Save file +# :q - Quit +# :wq or :x - Save and quit +# :q! - Quit without saving +# ZZ - Save and quit +``` + +## Nano + +[Nano](https://www.nano-editor.org/) is a simple, user-friendly text editor. + +### Installation + +```nix +environment.systemPackages = pkgs.nano; +``` + +### Verified Usage + +#### Text editing + +```bash +# Open file in nano +nano filename.txt + +# Basic navigation: +# Ctrl+K - Cut line +# Ctrl+U - Paste line +# Ctrl+6 - Mark text (start selection) +# Ctrl+W - Search text +# Ctrl+\ - Search and replace +# Ctrl+G - Show help +# Ctrl+C - Show cursor position +# Ctrl+_ - Go to line + +# File operations: +# Ctrl+O - Write file (save) +# Ctrl+X - Exit nano +# Ctrl+R - Read file (insert file) +# Ctrl+T - Run spell checker +# Ctrl+J - Justify paragraph +``` + +## GCC + +[GCC](https://gcc.gnu.org/) is the GNU Compiler Collection. + +### Installation + +```nix +environment.systemPackages = pkgs.gcc; +``` + +### Verified Usage + +#### C compilation + +```bash +# Create object file only +gcc -c source.c + +# Compile with output name +gcc -o program source.c + +# Compile with debug information +gcc -g source.c -o program + +# Link object files +gcc file1.o file2.o -o program +``` + +## Gnumake + +[Make](https://www.gnu.org/software/make/) automates build processes. + +### Installation + +```nix +environment.systemPackages = pkgs.gnumake; +``` + +### Verified Usage + +#### Build automation + +```bash +# Run make with specific target +make target_name + +# Run make with specific Makefile +make -f Makefile.custom +``` + +## Perl + +[Perl](https://www.perl.org/) is a highly capable, feature-rich programming language. + +### Installation + +```nix +environment.systemPackages = pkgs.perl; +``` + +### Verified Usage + +#### Script execution + +```bash +# Execute Perl script +perl script.pl + +# Run Perl code directly +perl -e 'print "Hello World"' +``` + +## Lua + +[Lua](https://www.lua.org/) is a powerful, efficient, lightweight, embeddable scripting language. + +### Installation + +```nix +environment.systemPackages = pkgs.lua; +``` + +### Verified Usage + +#### Script execution + +```bash +# Execute Lua script +lua script.lua + +# Run Lua code directly +lua -e "print('Hello World')" +``` + +## Ruby + +[Ruby](https://www.ruby-lang.org/) is a dynamic, open source programming language. + +### Installation + +```nix +environment.systemPackages = pkgs.ruby; +``` + +### Verified Usage + +#### Script execution + +```bash +# Execute Ruby script +ruby script.rb + +# Run Ruby code directly +ruby -e "puts 'Hello World'" +``` + +## Octave + +[Octave](https://www.gnu.org/software/octave/) is a scientific computing environment. + +### Installation + +```nix +environment.systemPackages = pkgs.octave; +``` + +### Verified Usage + +#### Scientific computing + +```bash +# Execute Octave script +octave script.m + +# Run Octave code directly +octave --eval "disp('Hello World')" + +# Matrix operations +octave --eval "[1 2; 3 4] * [5; 6]" + +# Statistical calculations +octave --eval "mean([1 2 3 4 5])" +``` + +## Python3 + +[Python](https://www.python.org/) is a high-level programming language. + +### Installation + +```nix +environment.systemPackages = pkgs.python3; +``` + +### Verified Usage + +#### Script execution + +```bash +# Execute Python script +python3 script.py + +# Run Python code directly +python3 -c "print('Hello World')" +``` + +## Zulu + +[Zulu](https://www.azul.com/products/zulu/) is a certified OpenJDK build. + +### Installation + +```nix +environment.systemPackages = pkgs.zulu; +``` + +### Verified Usage + +#### Java development + +```bash +# Compile Java source file +javac HelloWorld.java + +# Run Java program +java HelloWorld +``` + +## Go + +[Go](https://go.dev/) is a programming language by Google. + +### Installation + +```nix +environment.systemPackages = pkgs.go; +``` + +### Verified Usage + +#### Go development + +```bash +# Initialize new Go module +go mod init module-name + +# Build Go program +go build main.go + +# Run Go program +go run main.go + +# Format source +go fmt main.go + +# Clean build artifacts +go clean +``` + +## Rustup + +[Rustup](https://www.rustup.rs/) is a toolchain manager for Rust. + +### Installation + +```nix +environment.systemPackages = pkgs.rustup; +``` + +### Verified Usage + +#### Rust development + +```bash +# Manage toolchains +rustup toolchain list +rustup install stable +rustup default stable + +# Create new Rust project +cargo new my_project + +# Fast compilation check +cargo check + +# Build project +cargo build + +# Run project +cargo run + +# Test project +cargo test +``` diff --git a/book/src/distro/popular-applications/file-tools.md b/book/src/distro/popular-applications/file-tools.md new file mode 100644 index 000000000..1d1d9695b --- /dev/null +++ b/book/src/distro/popular-applications/file-tools.md @@ -0,0 +1,552 @@ +# File Tools + +## Coreutils + +[Coreutils](https://www.gnu.org/software/coreutils/) includes basic file, shell and text manipulation utilities. + +### Installation + +```nix +environment.systemPackages = pkgs.coreutils; +``` + +### Verified Usage + +#### Basic file operations + +```bash +# BLAKE2 checksum +b2sum file.txt +b2sum --check checksums.b2 + +# Base64 encode/decode +base64 file.txt +base64 -d encoded_file.b64 + +# Strip directory and suffix from filenames +basename /path/to/file.txt + +# Concatenate and display files +cat file1.txt file2.txt + +# Change file permissions +chmod 755 script.sh +chmod +x script.sh +chmod -R 755 directory/ + +# Run command or interactive shell with special root directory +chroot /newroot /bin/bash + +# Copy files and directories +cp file1.txt file2.txt +cp -r dir1 dir2 + +# Split a file into sections determined by context lines +csplit file.txt '/pattern/' '{*}' + +# Remove sections from each line of files +cut -d':' -f1 /etc/passwd + +# Convert and copy a file +dd if=input.txt of=output.txt +dd if=/dev/zero of=disk.img bs=1M count=100 + +# Strip last component from file name +dirname /path/to/file.txt + +# Display a line of text +echo "Hello World" + +# Evaluate expressions +expr 2 + 3 +expr 10 \* 5 # Escape * for shell + +# Output the first part of files +head -n 20 file.txt + +# Make links between files +ln -s target_file symlink +ln target_file hardlink + +# Make directories +mkdir -p path/to/nested/dir + +# Move (rename) files +mv old.txt new.txt +mv file.txt /destination/ + +# Dump files in octal and other formats +od file.txt +od -c file.txt # Character format +od -x file.txt # Hexadecimal format + +# Merge lines of files +paste -d ',' file1.txt file2.txt # Use comma as delimiter + +# Print value of a symbolic link or canonical file name +readlink symlink + +# Print the resolved path +realpath file.txt + +# Remove files or directories +rm file.txt +rm -rf directory/ + +# Print a sequence of numbers +seq 0 2 10 # Start, increment, end + +# SHA2 checksums +sha256sum file.txt +sha512sum --check checksums.sha512 + +# Display file or file system status +stat -c "%A %U %G %s" file.txt # Custom format + +# Flush file system buffers +sync + +# Output the last part of files +tail -n 20 file.txt + +# Change file timestamps +touch -t 202401011200 file.txt + +# Print newline, word, and byte counts for each file +wc -l file.txt # Lines only +wc -w file.txt # Words only +wc -c file.txt # Bytes only +``` + +## Findutils + +[Findutils](https://www.gnu.org/software/findutils/) provides the basic directory searching utilities. + +### Installation + +```nix +environment.systemPackages = pkgs.findutils; +``` + +### Verified Usage + +#### File searching + +```bash +# Search for files in a directory hierarchy +find /path -name "*.txt" # Find by name +find /path -iname "*.TXT" # Case insensitive +find /path -type f # Find files only +find /path -type d # Find directories only +find /path -type l # Find symbolic links only + +# Execute commands on found files +find /path -name "*.tmp" -delete +find /path -name "*.log" -exec rm {} \; +find /path -name "*.bak" -exec mv {} {}.old \; + +# Build and execute command lines from standard input +find /path -name "*.txt" | xargs rm +find /path -name "*.log" | xargs -I {} mv {} {}.old +``` + +## Diffutils + +[Diffutils](https://www.gnu.org/software/diffutils/) compares files and produces output showing differences. + +### Installation + +```nix +environment.systemPackages = pkgs.diffutils; +``` + +### Verified Usage + +#### File comparison + +```bash +# Compare files line by line +diff -u file1.txt file2.txt + +# Compare three files line by line +diff3 file1.txt file2.txt file3.txt # Three-way comparison +diff3 -m file1.txt file2.txt file3.txt # Merge conflicts +diff3 -E file1.txt file2.txt file3.txt # Overlapping changes +``` + +## File + +[File](https://darwinsys.com/file/) determines file type by examining content. + +### Installation + +```nix +environment.systemPackages = pkgs.file; +``` + +### Verified Usage + +#### File type detection + +```bash +# Determine file type +file filename.txt # Basic file type detection +file document.pdf # Identify PDF files +file image.jpg # Identify image files + +# Detailed information +file -i filename.txt # Show MIME type +file -b filename.txt # Brief output (no filename) +file -L symlink # Follow symlinks +``` + +## Tree + +[Tree](https://oldmanprogrammer.net/source.php?dir=projects/tree) lists contents of directories in a tree-like format. + +### Installation + +```nix +environment.systemPackages = pkgs.tree; +``` + +### Verified Usage + +#### Directory tree display + +```bash +# List contents of directories in a tree-like format +tree /path/to/directory # Display specific directory tree + +# Basic tree options +tree -a # Show all files (including hidden) +tree -d # Show directories only +tree -f # Show full path prefix for each file +tree -h # Show file sizes in human readable format +``` + +## Less + +[Less](https://www.greenwoodsoftware.com/less/) is a terminal pager program for viewing text files. + +### Installation + +```nix +environment.systemPackages = pkgs.less; +``` + +### Verified Usage + +#### File viewing + +```bash +# Opposite of more (better file viewer) +less filename.txt + +# Navigation commands (while in less): +# Basic movement: +# j or Enter - Move down one line +# k - Move up one line +# f or Space - Forward one window +# b - Backward one window +# d - Forward half window +# u - Backward half window +``` + +## Gawk + +[Gawk](https://www.gnu.org/software/gawk/) is the GNU implementation of Awk programming language. + +### Installation + +```nix +environment.systemPackages = pkgs.gawk; +``` + +### Verified Usage + +#### Text processing + +```bash +# Use custom field separator +awk -F: '{print NR ": " $1}' /etc/passwd + +# Print lines matching pattern +awk '/pattern/ {print}' file.txt + +# Sum numbers in first column +awk '{sum += $1} END {print "Sum:", sum}' numbers.txt +``` + +## Gnused + +[Gnused](https://www.gnu.org/software/sed/) is the GNU implementation of stream editor. + +### Installation + +```nix +environment.systemPackages = pkgs.gnused; +``` + +### Verified Usage + +#### Stream editing + +```bash +# Print specific line numbers +sed -n '1,10p' file.txt + +# Replace all occurrences with case insensitive +sed 's/old/new/gi' file.txt + +# Delete specific line numbers +sed '1,5d' file.txt + +# Insert text before line +sed '2i\New line inserted' file.txt + +# Append text after line +sed '2a\Appended line' file.txt + +# Replace entire line +sed '3c\Completely replaced line' file.txt +``` + +## Gnugrep + +[Gnugrep](https://www.gnu.org/software/grep/) searches text using patterns. + +### Installation + +```nix +environment.systemPackages = pkgs.gnugrep; +``` + +### Verified Usage + +#### Text searching + +```bash +# Search for pattern in file +grep "pattern" file.txt + +# Case insensitive search +grep -i "pattern" file.txt + +# Recursive search in directory +grep -r "pattern" /path/to/directory + +# Show line numbers +grep -n "pattern" file.txt +``` + +## Gnutar + +[Gnutar](https://www.gnu.org/software/tar/) creates and extracts archive files. + +### Installation + +```nix +environment.systemPackages = pkgs.gnutar; +``` + +### Verified Usage + +#### Archive operations + +```bash +# Create tar archive +tar -cf archive.tar file1 file2 directory/ + +# Extract tar archive +tar -xf archive.tar + +# List contents of archive +tar -tf archive.tar + +# Append files to existing archive +tar -rf archive.tar newfile.txt + +# Update files in archive +tar -uf archive.tar updated_file.txt +``` + +## Gzip + +[Gzip](https://www.gnu.org/software/gzip/) is a popular data compression program. + +### Installation + +```nix +environment.systemPackages = pkgs.gzip; +``` + +### Verified Usage + +#### Compression + +```bash +# Compress file with gzip +gzip file.txt # Creates file.txt.gz + +# Decompress file with gunzip +gunzip file.txt.gz # Restores file.txt + +# Decompress to stdout +zcat file.txt.gz + +# View compressed file with pager +zless file.txt.gz +zmore file.txt.gz + +# Search in compressed file +zgrep "pattern" file.txt.gz +``` + +## Bzip2 + +[Bzip2](https://www.sourceware.org/bzip2) uses the Burrows-Wheeler algorithm for compression. + +### Installation + +```nix +environment.systemPackages = pkgs.bzip2; +``` + +### Verified Usage + +#### Compression + +```bash +# Compress file with bzip2 +bzip2 file.txt # Creates file.txt.bz2 + +# Decompress file with bunzip2 +bunzip2 file.txt.bz2 # Restores file.txt + +# Decompress to stdout +bzcat file.txt.bz2 + +# View compressed file with pager +bzless file.txt.bz2 +bzmore file.txt.bz2 + +# Search in compressed file +bzgrep "pattern" file.txt.bz2 +``` + +## Xz + +[Xz](https://tukaani.org/xz/) provides high compression ratio using LZMA2 algorithm. + +### Installation + +```nix +environment.systemPackages = pkgs.xz; +``` + +### Verified Usage + +#### Compression + +```bash +# Compress file with xz +xz file.txt # Creates file.txt.xz + +# Decompress file with unxz +unxz file.txt.xz # Restores file.txt + +# Decompress to stdout +xzcat file.txt.xz + +# View compressed file with pager +xzless file.txt.xz +xzmore file.txt.xz + +# Search in compressed file +xzgrep "pattern" file.txt.xz +``` + +## Zip + +[Zip](https://www.info-zip.org/) is a file compression and archive utility. + +### Installation + +```nix +environment.systemPackages = with pkgs; [ zip unzip ]; +``` + +### Verified Usage + +#### Archive creation + +```bash +# Create zip archive +zip archive.zip file1.txt file2.txt + +# List contents of zip file +unzip -l archive.zip + +# Extract all files +unzip archive.zip + +# View file information in zip +zipinfo archive.zip + +# Search for pattern in zip files +zipgrep "pattern" archive.zip +``` + +## Rsync + +[Rsync](https://rsync.samba.org/) is a fast and versatile file synchronization tool. + +### Installation + +```nix +environment.systemPackages = pkgs.rsync; +``` + +### Verified Usage + +#### File synchronization + +```bash +# Sync local directories +rsync -av source/ destination/ + +# Delete files not in source +rsync -av --delete source/ destination/ + +# Show progress during transfer +rsync -av --progress source/ destination/ + +# Exclude specific files/patterns +rsync -av --exclude '*.tmp' source/ destination/ + +# Include only specific files +rsync -av --include '*.txt' --exclude '*' source/ destination/ +``` + +## Wipe + +[Wipe](https://wipe.sourceforge.net/) securely deletes files by overwriting them. + +### Installation + +```nix +environment.systemPackages = pkgs.wipe; +``` + +### Verified Usage + +#### Secure deletion + +```bash +# Wipe with zero-out pass (single pass of zeros) +wipe -z filename.txt + +# Wipe with specific number of passes +wipe -p 8 filename.txt +``` diff --git a/book/src/distro/popular-applications/media-tools.md b/book/src/distro/popular-applications/media-tools.md new file mode 100644 index 000000000..8e8fef92c --- /dev/null +++ b/book/src/distro/popular-applications/media-tools.md @@ -0,0 +1,122 @@ +# Media Tools + +## FFmpeg + +[FFmpeg](https://www.ffmpeg.org/) is a complete, cross-platform solution to record, convert and stream audio and video. + +### Installation + +```nix +environment.systemPackages = pkgs.ffmpeg; +``` + +### Verified Usage + +#### Video and audio processing + +```bash +# Create a 10-second blue test video +ffmpeg -f lavfi -i color=blue:duration=10:size=1280x720 -c:v libx264 test.mp4 + +# Convert to different format +ffmpeg -i test.mp4 test.avi + +# Resize video to 640x360 +ffmpeg -i test.mp4 -vf scale=640:360 small_test.mp4 + +# Compress video with lower quality +ffmpeg -i test.mp4 -b:v 500k compressed_test.mp4 + +# Extract first 5 seconds +ffmpeg -i test.mp4 -t 5 short_test.mp4 +``` + +## ImageMagick + +[ImageMagick](http://www.imagemagick.org/) is a software suite to create, edit, compose, or convert bitmap images. + +### Installation + +```nix +environment.systemPackages = pkgs.imagemagick; +``` + +### Verified Usage + +#### Image processing + +```bash +# Create colorful test image +magick -size 1000x600 xc:skyblue -fill white -draw "circle 250,150 250,200" -fill yellow -draw "circle 700,200 700,250" test.jpg + +# Convert image format +magick input.jpg output.png + +# Resize image +magick input.jpg -resize 800x600 output.jpg + +# Crop image +magick input.jpg -crop 400x300+100+50 output.jpg + +# Rotate image +magick input.jpg -rotate 90 output.jpg +``` + +## SoX + +[SoX](https://sox.sourceforge.net/) is a sample rate converter for audio files. + +### Installation + +```nix +environment.systemPackages = pkgs.sox; +``` + +### Verified Usage + +#### Audio processing + +```bash +# Create 1 kHz tone (10 seconds) +sox -n test_1k.wav synth 10 sine 1000 + +# Create chord (multiple tones) +sox -n chord.wav synth 3 sine 261.63 synth 3 sine 329.63 synth 3 sine 392.00 + +# Create white noise (5 seconds) +sox -n noise.wav synth 5 whitenoise + +# Convert audio format +sox input.wav output.flac + +# Concatenate audio files +sox file1.wav file2.wav concatenated_output.wav + +# Cut audio (from 10s to 40s) +sox input.wav output.wav trim 10 30 +``` + +## Pandoc + +[Pandoc](https://hackage.haskell.org/package/pandoc-cli) is a universal document converter. + +### Installation + +```nix +environment.systemPackages = pkgs.pandoc; +``` + +### Verified Usage + +#### Document conversion + +```bash +# Convert Markdown to HTML +pandoc test.md -o test.html + +# Convert Markdown to Word DOCX +pandoc test.md -o test.docx + +# Convert HTML to Markdown +pandoc test.html -f html -t markdown -o converted.md +``` diff --git a/book/src/distro/popular-applications/network-tools.md b/book/src/distro/popular-applications/network-tools.md new file mode 100644 index 000000000..f0d1c000a --- /dev/null +++ b/book/src/distro/popular-applications/network-tools.md @@ -0,0 +1,184 @@ +# Network Tools + +## LDNS + +[LDNS](https://www.nlnetlabs.nl/projects/ldns/) is a library for DNS programming with C. + +### Installation + +```nix +environment.systemPackages = pkgs.ldns; +``` + +### Verified Usage + +#### DNS queries + +```bash +# Basic DNS lookup +drill google.com + +# Query specific record type +drill google.com A # IPv4 address +drill google.com AAAA # IPv6 address +drill google.com MX # Mail exchange +drill google.com NS # Name servers +drill google.com TXT # Text records +drill google.com CNAME # Canonical name + +# Reverse DNS lookup +drill -x 8.8.8.8 +``` + +## Whois + +[Whois](https://packages.qa.debian.org/w/whois.html) queries domain registration information. + +### Installation + +```nix +environment.systemPackages = pkgs.whois; +``` + +### Verified Usage + +#### Domain information + +```bash +# Basic whois lookup +whois google.com + +# Query specific whois server +whois -h whois.verisign-grs.com google.com + +# Query IP address +whois 8.8.8.8 +``` + +## Netcat + +[Netcat](https://www.libressl.org/) is a networking utility for reading from and writing to network connections. + +### Installation + +```nix +environment.systemPackages = pkgs.netcat; +``` + +### Verified Usage + +#### Network connections + +```bash +# Basic TCP connection +nc hostname port + +# Listen on specific port +nc -l 10.0.2.15 8080 + +# Send file over network +nc hostname port < file.txt + +# Receive file over network +nc -l port > received_file.txt + +# Zero-I/O mode (scanning) +nc -z hostname port +``` + +## Curl + +[Curl](https://curl.se/) transfers data with URLs. + +### Installation + +```nix +environment.systemPackages = pkgs.curl; +``` + +### Verified Usage + +#### HTTP client + +```bash +# Basic GET request +curl https://api.github.com + +# Download with specific filename +curl -o newname.txt https://example.com/file.txt +``` + +## Wget + +[Wget](https://www.gnu.org/software/wget/) downloads files from the web. + +### Installation + +```nix +environment.systemPackages = pkgs.wget; +``` + +### Verified Usage + +#### File download + +```bash +# Download single file +wget https://example.com/file.zip + +# Download with specific filename +wget -O newname.txt https://example.com/file.txt +``` + +## LFTP + +[LFTP](https://lftp.yar.ru/) is a sophisticated file transfer program. + +### Installation + +```nix +environment.systemPackages = pkgs.lftp; +``` + +### Verified Usage + +#### FTP client + +```bash +# Connect to FTP server +lftp ftp://ftp.sjtu.edu.cn/ubuntu-cd/ + +# Connect to HTTP server +lftp http://ftp.sjtu.edu.cn/ubuntu-cd/ + +# Download single file +lftp -c "open ftp.sjtu.edu.cn; cd /ubuntu-cd; get robots.txt" +``` + +## Socat + +[Socat](http://www.dest-unreach.org/socat/) is a multipurpose relay for bidirectional data transfer. + +### Installation + +```nix +environment.systemPackages = pkgs.socat; +``` + +### Verified Usage + +#### Network relay + +```bash +# Basic TCP connection +socat TCP:hostname:port - + +# Listen on TCP port +socat TCP-LISTEN:8080,bind=10.0.2.15,fork - + +# Echo server +socat TCP-LISTEN:6379,bind=10.0.2.15,reuseaddr,fork EXEC:cat + +# HTTP server (simple) +socat TCP-LISTEN:8080,bind=10.0.2.15,crlf,reuseaddr,fork SYSTEM:"echo 'HTTP/1.0 200 OK'; echo; echo 'Hello World'" +``` diff --git a/book/src/distro/popular-applications/security-tools.md b/book/src/distro/popular-applications/security-tools.md new file mode 100644 index 000000000..1632106a0 --- /dev/null +++ b/book/src/distro/popular-applications/security-tools.md @@ -0,0 +1,95 @@ +# Security Tools + +## GnuPG + +[GnuPG](https://gnupg.org/) is a complete implementation of the OpenPGP standard for encrypting and signing data. + +### Installation + +```nix +environment.systemPackages = pkgs.gnupg; +``` + +### Verified Usage + +#### Encryption and signing + +```bash +# Quick generate without passphrase protection +gpg --batch --passphrase-fd 0 --quick-generate-key "Test User " rsa2048 sign never <<< "" + +# List public keys +gpg --list-keys + +# Export public key +gpg --export --armor test@example.com > public_key.asc + +# Export private key (be careful!) +gpg --export-secret-keys --armor test@example.com > private_key.asc + +# Sign with specific key +gpg --sign --local-user test@example.com file.txt + +# Verify and extract the original file +gpg --verify file.txt.gpg +gpg file.txt.gpg # This will verify and output the original content + +# Encrypt with passphrase from command line +gpg --symmetric --passphrase "mysecretpassword" --batch file.txt + +# Decrypt with passphrase from command line +gpg --decrypt --passphrase "mysecretpassword" --batch file.txt.gpg > file.txt +``` + +## Crunch + +[Crunch](https://sourceforge.net/projects/crunch-wordlist/) is a wordlist generator. + +### Installation + +```nix +environment.systemPackages = pkgs.crunch; +``` + +### Verified Usage + +#### Wordlist generation + +```bash +# Generate wordlist with specific length +crunch 4 4 abcdef + +# Generate wordlist with specific pattern +crunch 6 6 -t a@@b%% + +# Generate wordlist with start and end strings +crunch 4 4 abcdef -s abcd -e ffed +``` + +## John + +[John the Ripper](https://github.com/openwall/john/) is a fast password cracker. + +### Installation + +```nix +environment.systemPackages = pkgs.john; +``` + +### Verified Usage + +#### Password cracking + +```bash +# Create test dictionary file +echo "password" > wordlist.txt +echo "123456" >> wordlist.txt +echo "admin" >> wordlist.txt +echo "password123" >> wordlist.txt + +# Create a MD5 hash for testing +echo "482c811da5d5b4bc6d497ffa98491e38" > md5_hash.txt # Genuine MD5 hash of "password123" + +# Basic password cracking with wordlist +john --wordlist=wordlist.txt --format=raw-md5 md5_hash.txt +``` diff --git a/book/src/distro/popular-applications/system-tools.md b/book/src/distro/popular-applications/system-tools.md new file mode 100644 index 000000000..08d860186 --- /dev/null +++ b/book/src/distro/popular-applications/system-tools.md @@ -0,0 +1,217 @@ +# System Tools + +## Bash + +[Bash](https://www.gnu.org/software/bash/) is the GNU Project's shell and command language. + +### Installation + +Bash is included by default in NixOS. To ensure it's available, you can add it to your `configuration.nix`: + +```nix +environment.systemPackages = pkgs.bash; +``` + +### Verified Usage + +#### Basic commands + +```bash +# Start interactive shell +bash + +# Execute a script +bash script.sh +``` + +## Procps + +[Procps](https://gitlab.com/procps-ng/procps) provides system utilities for process management and system information. + +### Installation + +```nix +environment.systemPackages = pkgs.procps; +``` + +### Verified Usage + +#### Process management + +```bash +# Display memory in human readable format +free -h + +# Kill process by PID +kill 1234 + +# Display processes with custom format +ps -eo pid,ppid,cmd,pcpu,pmem + +# Find processes with full command line +pgrep -f "python script.py" + +# Kill processes by pattern +pkill firefox + +# Display memory map of a process +pmap 1234 + +# Monitor processes in real-time +top + +# Display system uptime +uptime +``` + +## Util-linux + +[Util-linux](https://www.kernel.org/pub/linux/utils/util-linux/) provides a set of system utilities for any Linux system. + +### Installation + +```nix +environment.systemPackages = pkgs.util-linux; +``` + +### Verified Usage + +#### System utilities + +```bash +# Display system information +uname -a + +# Display disk space usage +df -h + +# Mount a file system +mount -t ext2 /dev/vdb /ext2 + +# Unmount a file system +umount /ext2 + +# Find mounted file systems +findmnt + +# Display date in custom format +date +"%Y-%m-%d %H:%M:%S" + +# Display calendar for specific month +cal 01 2026 + +# Display user and group information +id + +# Display login history +last + +# Display file in hexadecimal +hexdump -C file.bin + +# Display where program is located +whereis ls +``` + +## Hostname + +[Hostname](https://tracker.debian.org/pkg/hostname) displays or sets the host name or domain name. + +### Installation + +```nix +environment.systemPackages = pkgs.hostname; +``` + +### Verified Usage + +#### Hostname management + +```bash +# Display current hostname +hostname + +# Set hostname temporarily +hostname new-hostname +``` + +## Which + +[Which](https://www.gnu.org/software/which/) shows the full path of shell commands. + +### Installation + +```nix +environment.systemPackages = pkgs.which; +``` + +### Verified Usage + +#### Command location + +```bash +# Find all locations of a command +which -a python + +# Explicitly search for normal binaries +which --skip-alias command +``` + +## Man-pages + +[Man-pages](https://www.kernel.org/doc/man-pages/) provides manual pages for Linux kernel and C library interfaces. + +### Installation + +```nix +environment.systemPackages = pkgs.man-pages; +``` + +### Verified Usage + +#### Manual page access + +```bash +# Display manual page in specific section +man 1 ls # User commands +man 2 read # System calls +man 3 printf # Library functions +man 4 tty # Special files +man 5 fstab # File formats +man 6 banner # Games +man 7 regex # Miscellaneous +man 8 mount # System administration + +# Display manual page without pager +man -P cat ls +``` + +## Texinfo + +[Texinfo](https://www.gnu.org/software/texinfo/) is the official documentation format of the GNU project. + +### Installation + +```nix +environment.systemPackages = pkgs.texinfoInteractive; +``` + +### Verified Usage + +#### Info documentation + +```bash +# Display info documentation for a topic +info bash + +# Navigate within info viewer: +# Space - Scroll forward +# Backspace - Scroll backward +# n - Next node +# p - Previous node +# u - Up node +# l - Last visited node +# g - Go to specific node +# s - Search forward +# q - Quit +```