diff --git a/README.md b/README.md index 485da5b..dcc78a3 100644 --- a/README.md +++ b/README.md @@ -1,77 +1,60 @@ # Linux -## Table of contents - -- [Linux](#linux) - - [Table of contents](#table-of-contents) - - [Update](#update) - - [Debian / Ubuntu](#debian--ubuntu) - - [Fedora](#fedora) - - [ls](#ls) - - [Users](#users) - - [hostname / hostnamectl](#hostname--hostnamectl) - - [static ip](#static-ip) - - [Disks](#disks) - - [mount](#mount) - - [gio](#gio) - - [mount samba share](#mount-samba-share) - - [unmount](#unmount) - - [File System](#file-system) - - [ext4](#ext4) - - [ext3](#ext3) - - [exFat](#exfat) - - [ntfs](#ntfs) - - [space usage](#space-usage) - - [Manutenção de discos](#manutenção-de-discos) - - [tar](#tar) - - [SSH](#ssh) - - [Create key](#create-key) - - [Copy public key](#copy-public-key) - - [Add existing Key](#add-existing-key) - - [Alias](#alias) - - [Port Binding](#port-binding) - - [Documentation](#documentation) - - [Benchmarking](#benchmarking) - - [themes](#themes) - - [shell](#shell) - - [terminal](#terminal) - - [Backups](#backups) - - [bash](#bash) - - [disable touch screen](#disable-touch-screen) - - [disable suspend black screen](#disable-suspend-black-screen) - - [lightdm auto login](#lightdm-auto-login) - - [btop](#btop) - - [Setup](#setup) - - [Debian \& Ubuntu](#debian--ubuntu-1) - - [lspci](#lspci) - - [gnome files / nautilus](#gnome-files--nautilus) - +- [Distros](#distros) +- [Graphical Environment](#graphical-environment) + - [Display Managers](#display-managers) + - [Graphical Applications](#graphical-applications) + - [Gnome Files/Nautilus](#gnome-filesnautilus) +- [Commands and Utilities](#commands-and-utilities) + - [Navigation and File Management](#navigation-and-file-management) + - [Archiving and Compression](#archiving-and-compression) + - [tar](#tar) + - [Users, Groups, and File permissions](#users-groups-and-file-permissions) + - [Network Configuration](#network-configuration) + - [hostname / hostnamectl](#hostname--hostnamectl) + - [static ip](#static-ip) + - [System Monitoring Utilities](#system-monitoring-utilities) + - [btop](#btop) + - [Storage](#storage) + - [hdparm](#hdparm) + - [Network Storage](#network-storage) + - [smb](#smb) + - [CLI Diagnostics and System Topology](#cli-diagnostics-and-system-topology) + - [lspci](#lspci) -## Update +## Distros -### Debian / Ubuntu +- [Debian](./docs/distros/debian.md) +- [Fedora](./docs/distros/fedora.md) +- [Proxmox pve](https://git.limbosolutions.com/kb/proxmox) -```bash -apt update -y -apt upgrade -y -apt autoremove -y -``` +## Graphical Environment -References: -[https://linuxsimply.com/linux-basics/package-management/update-packages/sudo-apt-update/](https://linuxsimply.com/linux-basics/package-management/update-packages/sudo-apt-update/) +### Display Managers -### Fedora +🎛️ A display manager is the graphical login screen you see when you boot your system. -```bash -dnf -``` +Main job: It handles user sessions — letting you log in, choose a user, select a desktop environment, and start the graphical session. -References: -[https://docs.fedoraproject.org/en-US/quick-docs/dnf-vs-apt/](https://docs.fedoraproject.org/en-US/quick-docs/dnf-vs-apt/) +Examples: -## ls +- LightDM (lightweight and flexible) +- GDM (GNOME Display Manager) +- SDDM (used by KDE) +- LXDM (used by LXDE) -List information about the FILEs (the current directory by default). +### Graphical Applications + +#### Gnome Files/Nautilus + + + +## Commands and Utilities + +### Navigation and File Management + + +📁 List information about the FILEs (the current directory by default). ```bash #order by date @@ -80,11 +63,78 @@ ls -t #order by date reverse ls -r +# list all +ls -lah ``` -source: man +### Archiving and Compression -## Users +#### tar + +**📦 tar** is a command-line utility in Unix/Linux used to archive multiple files into a single file, often for backup, compression, or distribution. The name stands for “tape archive”, originally designed for writing data to magnetic tape. + +**Flags:** + +- -c Create a new archive +- -v Verbose — show progress while archiving +- -p Preserve permissions — keeps original file permissions +- -z Compress using gzip +- -f File name — expects a filename right after this flag +- -I compressor +- -p preserve file permissions + +```bash +tar -cvf --exclude='.cache' --exclude='Cache' --exclude='.cache' --exclude='.tmp' --exclude='tmp' /tmp/filename.tar.gz \ +$source_path_to_tar + + +#(Parallel Implementation of Gzip) to to create a fast, compressed archive +tar -I pigz -cvf - /fileserver/media/music/* + +# splits the output into 8 GB chunks, +tar -I pigz -cvf - /sourcefolder/* | split --bytes=8GB - /tmp/file.tar.gz +```## Visual Linux + +🖥️ + +### Display Manager (DM) + +🎛️ + +What it is: A display manager is the graphical login screen you see when you boot your system. + +Main job: It handles user sessions — letting you log in, choose a user, select a desktop environment, and start the graphical session. + +Examples: + +- LightDM (lightweight and flexible) +- GDM (GNOME Display Manager) +- SDDM (used by KDE) +- LXDM (used by LXDE) + +### Graphical Apps + +🧰 + +## Gnome Files/Nautilus + + + + +```bash +tar -cvpzf "/vault/.backups/devices/homeserver/tar/backup_$(date +"%Y%m%d%H%M%S").tar.gz \ +--exclude=/proc \ +--exclude=/tmp \ +--exclude=/mnt \ +--exclude=/dev \ +--exclude=/sys \ +--exclude=/run \ +--exclude=/media \ +--one-file-system \ +/ +``` + +### Users, Groups, and File permissions ```bash #create @@ -102,14 +152,11 @@ groupadd GROUPNAME groups USERNAME usermod -a -G GROUPNAME USERNAME -chown [-c|--changes] [-v|--verbose] [-f|--silent|--quiet] [--dereference] - [-h|--no-dereference] [--preserve-root] - [--from=currentowner:currentgroup] [--no-preserve-root] - [-R|--recursive] [--preserve-root] [-H] [-L] [-P] - {new-owner|--reference=ref-file} file ... ``` -## hostname / hostnamectl +### Network Configuration + +#### hostname / hostnamectl ``` bash @@ -117,7 +164,33 @@ chown [-c|--changes] [-v|--verbose] [-f|--silent|--quiet] [--dereference] hostname #set hostname -hostnamectl +hostnamectl## Visual Linux + +🖥️ + +### Display Manager (DM) + +🎛️ + +What it is: A display manager is the graphical login screen you see when you boot your system. + +Main job: It handles user sessions — letting you log in, choose a user, select a desktop environment, and start the graphical session. + +Examples: + +- LightDM (lightweight and flexible) +- GDM (GNOME Display Manager) +- SDDM (used by KDE) +- LXDM (used by LXDE) + +### Graphical Apps + +🧰 + +## Gnome Files/Nautilus + + + sudo nano /etc/hostname #alterar o nome @@ -127,7 +200,7 @@ Static IP A configuração para um ip estático poderá ser um pouco diferente de distribuição para distribuição mas a lógica é similar ``` -## static ip +#### static ip Debian sudo nano /etc/network/interfaces @@ -157,69 +230,41 @@ Reiniciar configuração sem reboot de computador ``` ``` bash -Reiniciar configuração sem reboot de computador -#sudo /etc/init.d/networking restart +# restart configuration servicce +sudo /etc/init.d/networking restart ``` -## Disks +### System Monitoring Utilities -File System & Space Usage +#### btop + +**Install Debian & Ubuntu:** + +```bash +apt update && apt install btop -y +``` + +### Storage + +#### hdparm + +hdparm is a powerful command-line utility in Linux used to view and configure low-level parameters of SATA, IDE, and some USB hard drives. It’s commonly used for performance tuning, diagnostics, and power management. ``` bash +sudo apt install hdparm +sudo hdparm -Tt /dev/sdc +``` + +``` bash +df df -h +du -h --max-depth=1 + ``` -List physical disks and partition size +### Network Storage -``` bash -lsblk -``` - -List partition ids - -``` bash -blkid /dev/sdc1 -``` - -Partition Manager - -``` bash -fdisk /dev/ -#Example: -fdisk /dev/sdc - -#Partições como mais de 2 TB -sudo parted /dev/sdc -#(parted) mklabel gpt -#alterar para a unidade de medida que desejar -#(parted) unit TB -#ver espaço livre -(parted) print free -#criar partição com espaço livre (exemplo:4 Teras) -mkpart primary ext4 0 4 -#Formatar uma partição -``` - -## mount - -Mount partition on boot fstab - -``` bash -nano /etc/fstabexemplo de alias -``` - -ext4 example - -``` bash -#add line -PARTUUID= ext4 defaults,nofail 0 02 -``` - -Mount fstab partions without reboot - -``` bash -mount -a -``` +#### smb smb share @@ -245,321 +290,9 @@ Add line //nas.lan/homes /mnt/smb-share:mf@nas.lan,share=homes cifs credentials=/home/mf/.credentials/smb:mf@nas.lan,uid=1000,gid=1000,nofail 0 0 ``` -## gio +### CLI Diagnostics and System Topology -### mount samba share - -```bash -#/home/username/.credentials -#username -#SAMBA -#password -gio mount smb://server/share < /home/username/.credentials -``` - -### unmount - -```bash -gio mount -u smb://server/share -``` - -## File System - -### ext4 - -mkfs.ext4 _filesys_ - -Example - -``` -mkfs.ext4 /dev/sdb1 -``` - -### ext3 - -mkfs.ext3 _filesys_ - -Example - -``` bash -mkfs.ext3 /dev/sdb1 -#exFat -mkfs.exfat /dev/sdc1 - -``` - -### exFat - -mkfs.exfat _filesys_ - -``` bash -mkfs.exfat /dev/sdc1 -``` - -### ntfs - -``` bash -apt-get install ntfs-3g -mkntfs --fast --label Backups /dev/sdc1 -``` - -## space usage - -df - -df -h - -du -h --max-depth=1 - -## Manutenção de discos - -Bad Sectors -sudo e2fsck -cfpv /dev/sda1 -O Exemplo foi com o disco sda1 mas deverá ser substituído pelo disco desejado - -Os parâmetros têm os seguintes significados: - -“c” procura por blocos defeituosos e os adiciona à lista - -“f” força uma verificação no sistema de arquivos - -“p” repara qualquer coisa que possa ser reparada com segurança - -“v” está no modo detalhado. você pode ver o progresso do comando - -Esse comando pode levar muito tempo para ser executado, até várias horas em uma unidade particularmente grande. - -## tar - -A utilização o comando tar é uma das formas de comprimir no linux - -``` -tar -cvf --exclude='.cache' --exclude='Cache' --exclude='.cache' --exclude='.tmp' --exclude='tmp' /tmp/nomedoficheiro.tar.gz /PATHPARAFICEHIROOUDIRECTORIO - -#Caso seja necessário paralelismo -tar -I pigz -cvf - /fileserver/media/music/* - -#Se for necessário limitar o tamanho do ficheiro compresso (dividindo em multiplos ficheiros) -tar -I pigz -cvf - /sourcefolder/* | split --bytes=8GB - /tmp/file.tar.gz -``` - -## SSH - -### Create key - -```bash -ssh-keygen -t ecdsa -b 521 -#or -ssh-keygen -t ecdsa -b 521 -f ~/.ssh/key-ecdsa - -``` - -### Copy public key - -```bash -ssh-add ~/.ssh/id_ed25519 -ssh-copy-id -i ~/.ssh//ey-ecdsa.pub example_user@192.0.2.4 -``` - -### Add existing Key - -```bash -ssh-add ~/.ssh/key-ecdsa -``` - -### Alias - -```bash -Host srv01 - HostName srv01.lan - User john - RemoteCommand cd ~/; exec bash --login - RequestTTY yes -``` - -### Port Binding - -Bind local port 8001 to target-server port 80 using jump-machine.local. -_(local machine without direct access to target-server)_ - -```bash -ssh -f -N -L localhost:8001:target-server:80 usr@jump-machine.local -``` - -#### Documentation - -``` bash -# man --f Requests ssh to go to background just before command - execution. This is useful if ssh is going to ask for - passwords or passphrases, but the user wants it in the - background. This implies -n. The recommended way to - start X11 programs at a remote site is with something - like ssh -f host xterm. - --N Do not execute a remote command. This is useful for just - forwarding ports. Refer to the description of - SessionType in ssh_config(5) for details. - --L [bind_address:]port:host:hostport --L [bind_address:]port:remote_socket --L local_socket:host:hostport --L local_socket:remote_socket - - Specifies that connections to the given TCP port or Unix socket on the - local (client) host are to be forwarded to the given host and port, or - Unix socket, on the remote side. This works by allocating a socket to - listen to either a TCP port on the local side, optionally bound to the - specified bind_address, or to a Unix socket. Whenever a connection is - made to the local port or socket, the connection is forwarded over the - secure channel, and a connection is made to either host port hostport, - or the Unix socket remote_socket, from the remote machine. - - Port forwardings can also be specified in the configuration file. Only - the superuser can forward privileged ports. IPv6 addresses can be - specified by enclosing the address in square brackets. - - By default, the local port is bound in accordance with the GatewayPorts - setting. However, an explicit bind_address may be used to bind the - connection to a specific address. The bind_address of “localhost” - indicates that the listening port be bound for local use only, while an - empty address or ‘*’ indicates that the port should be available from - all interfaces. - -``` - -## Benchmarking - -Discos -sudo apt install hdparm -sudo hdparm -Tt /dev/sdc - -## themes - -- - -### shell - -- zsh - -```bash -sudo apt install zsh -chsh -s /bin/zsh $whoami -sudo apt-get install fonts-powerline - -#source https://ohmyz.sh/#install -ssh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" - -#~/home/.zshrc -#ZSH_THEME="agnoster" - -``` - -### terminal - -- guake - -```bash -apt install guake -``` -```bash -# ~/.config/autostart/guake.desktop -[Desktop Entry] -Name=guake -GenericName=guake auto start -Comment= -Exec=guake --hide -Terminal=false -Type=Application -X-GNOME-Autostart-enabled=true -``` - -- terminator - -```bash -apt install terminator -``` - -## Backups - -### bash - -```bash -tar -cvpzf "/vault/.backups/devices/homeserver/tar/backup_$(date +"%Y%m%d%H%M%S").tar.gz \ ---exclude=/proc \ ---exclude=/tmp \ ---exclude=/mnt \ ---exclude=/dev \ ---exclude=/sys \ ---exclude=/run \ ---exclude=/media \ ---one-file-system \ -/ -``` - -```bash - -#!/bin/bash -gio mount ftp://ftp.backups@backupsrv01.dev.lan < ~/.credentials/ftp.backups@backupsrv01.dev.lan - -DATE=$(date +%d-%m-%Y) -BACKUP_DIR="/run/user/1000/gvfs/ftp:host=backupsrv01.dev.lan,user=ftp.backups/mf.brutus.dev.lan" - -#To backup 2daygeek's home directory -tar -zcvpf $BACKUP_DIR/home-mf_$DATE.tar.gz --exclude="**/.tmp/*" --exclude="**/Downloads/*" --exclude="**/.cache/*" --exclude="**/Trash/*" --exclude="**/cache/*" /home/mf - -#To delete files older than 10 days -find $BACKUP_DIR/* -mtime +10 -exec rm {} \; - -gio mount -u ftp://ftp.backups@backupsrv01.dev.lan -``` - -## disable touch screen - -``` bash -sudo apt-get -y install xinput -xinput -``` - -Run xinput to list out the input devices. Your touchscreen should show as one of the "pointers". - -xinput disable "NTRG0001:01 1B96:1B05" (your device ID may differ than mine) - -Add this to your ~/.profile or such to do automatically upon login -xinput disable "NTRG0001:01 1B96:1B05" - -Source: https://askubuntu.com/questions/759335/how-to-disable-a-touchscreen-on-surface-pro-3 - -## disable suspend black screen - -```bash -# /etc/lightdm/lightdm.conf -[Seat:*] -xserver-command=X -s 0 dpms -``` - -## lightdm auto login - -```bash -# /etc/lightdm/lightdm.conf -[SeatDefaults] -autologin-user=public -autologin-user-timeout=5 -# Uncomment the following, if running Unity -#greeter-session=unity-greeter -``` - -## btop - -### Setup - -#### Debian & Ubuntu - -```bash -apt update && apt install btop -y -``` - -## lspci +#### lspci Displays information about each PCI bus on your system. This includes information about the devices connected to the PCI subsystem. @@ -573,6 +306,3 @@ lspci [options] lspci -v ``` -## gnome files / nautilus - - diff --git a/docs/desktop-environments/free-desktop.md b/docs/desktop-environments/free-desktop.md new file mode 100644 index 0000000..9d508ed --- /dev/null +++ b/docs/desktop-environments/free-desktop.md @@ -0,0 +1,17 @@ +# Free desktop + + + +**🛠️ Create a .desktop file so the UI recognizes it as an application:** + +*Example:* + +```bash +[Desktop Entry] +Type=Application +Name=gĩt.limbosolutions.com +Comment=git.limbosolutions.com +Exec=flatpak run com.microsoft.Edge --app=https://git.limbosolutions.com # Yes !!! using edge as an example :) +Terminal=false +X-Desktop-File-Install-Version=0.27 +``` diff --git a/docs/desktop-environments/gnome.md b/docs/desktop-environments/gnome.md new file mode 100644 index 0000000..f66281b --- /dev/null +++ b/docs/desktop-environments/gnome.md @@ -0,0 +1,8 @@ + +# Gnome + +- [desktop shortcuts](#desktop-shortcuts) + +## desktop shortcuts + +GNOME and KDE both support .desktop files via the FreeDesktop.org standards. [Check for more information](./free-desktop.md). diff --git a/docs/desktop-environments/kde.md b/docs/desktop-environments/kde.md new file mode 100644 index 0000000..df1e7bb --- /dev/null +++ b/docs/desktop-environments/kde.md @@ -0,0 +1,7 @@ +# KDE + +- [desktop shortcuts](#desktop-shortcuts) + +## desktop shortcuts + +GNOME and KDE both support .desktop files via the FreeDesktop.org standards. [Check for more information](./free-desktop.md). diff --git a/docs/display-managers/lightdm.md b/docs/display-managers/lightdm.md new file mode 100644 index 0000000..b81be4a --- /dev/null +++ b/docs/display-managers/lightdm.md @@ -0,0 +1,33 @@ +# lightdm + +LightDM is a lightweight, cross-desktop display manager used to handle graphical logins on Linux systems. It provides the login screen (called a greeter) and manages user sessions, including authentication and session launching. + +**🧭 Key Features of LightDM:** + +- Lightweight and fast: Designed to use minimal system resources compared to heavier alternatives like GDM (GNOME Display Manager). +- Cross-desktop compatibility: Works with GNOME, KDE, Xfce, LXDE, and other desktop environments. +- Greeter flexibility: Supports multiple greeter front-ends, such as: + - LightDM GTK Greeter (default for many distros) + - Slick Greeter (used by Linux Mint) + - Webkit Greeter (HTML/CSS-based) +- Remote login support: Includes protocols like XDMCP and VNC for remote graphical sessions. +- Guest sessions and autologin: Can be configured for temporary guest accounts or automatic login. + +**Disable suspend black screen:** + +```bash +# /etc/lightdm/lightdm.conf +[Seat:*] +xserver-command=X -s 0 dpms +``` + +**Lightdm auto login:** + +```bash +# /etc/lightdm/lightdm.conf +[SeatDefaults] +autologin-user=public +autologin-user-timeout=5 +# Uncomment the following, if running Unity +#greeter-session=unity-greeter +``` \ No newline at end of file diff --git a/docs/distros/debian.md b/docs/distros/debian.md new file mode 100644 index 0000000..4aad7cd --- /dev/null +++ b/docs/distros/debian.md @@ -0,0 +1,18 @@ +# Debian + +Debian is a free, open-source Linux distribution known for its stability, security, and foundational role in the Linux ecosystem. It’s developed by a global community and serves as the base for many other popular distros, including Ubuntu and proxmox pve. + +**🧱 Core Features:** + +- Package management: Uses APT and dpkg for installing and updating software. +- Supported architectures: Includes x86 (amd64), ARM, PowerPC, RISC-V, and more. +- Kernel: Primarily uses the Linux kernel, but also supports alternatives like Hurd and kFreeBSD in experimental branches. +- User interface: Default is GNOME, but supports KDE, Xfce, LXDE, Cinnamon, MATE, and others. + +## Package Manager + +```bash +apt update -y +apt upgrade -y +apt autoremove -y +``` diff --git a/docs/distros/fedora.md b/docs/distros/fedora.md new file mode 100644 index 0000000..10984da --- /dev/null +++ b/docs/distros/fedora.md @@ -0,0 +1,15 @@ +# Fedora + +Fedora is a cutting-edge, community-driven Linux distribution sponsored by Red Hat, known for its rapid release cycle, modern technologies, and strong developer focus. It’s often used as a testbed for innovations that later appear in Red Hat Enterprise Linux (RHEL). + +**🧱 Core Features:** + +- Package management: Uses RPM packages with dnf as the default package manager. +- Desktop environments: + - Fedora Workstation: GNOME by default. + - Fedora KDE Plasma Desktop: For KDE users. + - Fedora Silverblue: Immutable desktop OS with OSTree. +- Editions: + - Fedora Server: For datacenter and enterprise use. + - Fedora IoT: Tailored for embedded and edge devices. + - Fedora CoreOS: Minimal, container-focused OS. diff --git a/docs/file-systems.md b/docs/file-systems.md new file mode 100644 index 0000000..c47e8f6 --- /dev/null +++ b/docs/file-systems.md @@ -0,0 +1,140 @@ +# File Systems + +## ext4 + +Ext4 (Fourth Extended File System) is a modern journaling file system used by most Linux distributions. It offers high performance, reliability, and support for large volumes and files. + +mkfs.ext4 _filesys_ + +Example + +```bash +mkfs.ext4 /dev/sdb1 +``` + +## ext3 + +mkfs.ext3 _filesys_ + +Example + +``` bash +mkfs.ext3 /dev/sdb1 +#exFat +mkfs.exfat /dev/sdc1 + +``` + +## exFat + +mkfs.exfat _filesys_ + +``` bash +mkfs.exfat /dev/sdc1 +``` + +## ntfs + +``` bash +apt-get install ntfs-3g +mkntfs --fast --label Backups /dev/sdc1 +``` + +## Manutenção de discos + +Bad Sectors +sudo e2fsck -cfpv /dev/sda1 +O Exemplo foi com o disco sda1 mas deverá ser substituído pelo disco desejado + +Os parâmetros têm os seguintes significados: + +“c” procura por blocos defeituosos e os adiciona à lista + +“f” força uma verificação no sistema de arquivos + +“p” repara qualquer coisa que possa ser reparada com segurança + +“v” está no modo detalhado. você pode ver o progresso do comando + +Esse comando pode levar muito tempo para ser executado, até várias horas em uma unidade particularmente grande. + +## Disks + +File System & Space Usage + +``` bash +df -h +``` + +List physical disks and partition size + +``` bash +lsblk +``` + +List partition ids + +``` bash +blkid /dev/sdc1 +``` + +Partition Manager + +``` bash +fdisk /dev/ +#Example: +fdisk /dev/sdc + +#Partições como mais de 2 TB +sudo parted /dev/sdc +#(parted) mklabel gpt +#alterar para a unidade de medida que desejar +#(parted) unit TB +#ver espaço livre +(parted) print free +#criar partição com espaço livre (exemplo:4 Teras) +mkpart primary ext4 0 4 +#Formatar uma partição +``` + +## mount + +Mount partition on boot fstab + +``` bash +nano /etc/fstabexemplo de alias +``` + +ext4 example + +``` bash +#add line +PARTUUID= ext4 defaults,nofail 0 02 +``` + +Mount fstab partions without reboot + +``` bash +mount -a +``` + +gvfs-mount 'ftp://user@www.your-server.com/folder' +[source](https://9to5answer.com/how-to-automount-a-gvfs-file-system-on-logon) + +## gio + +### mount samba share + +```bash +#/home/username/.credentials +#username +#SAMBA +#password +gio mount smb://server/share < /home/username/.credentials +``` + +### unmount + +```bash +gio mount -u smb://server/share +``` \ No newline at end of file diff --git a/bash.md b/docs/shells/bash.md similarity index 99% rename from bash.md rename to docs/shells/bash.md index 1431428..c8a0718 100644 --- a/bash.md +++ b/docs/shells/bash.md @@ -1,4 +1,4 @@ -Bash +# Bash ```bash #!/bin/bash diff --git a/zssh.md b/docs/shells/zsh.md similarity index 55% rename from zssh.md rename to docs/shells/zsh.md index fccfee7..a1e8d2f 100644 --- a/zssh.md +++ b/docs/shells/zsh.md @@ -37,3 +37,25 @@ Currenty testing * git * web-search * timer + + +## themes + +- + +### shell + +- zsh + +```bash +sudo apt install zsh +chsh -s /bin/zsh $whoami +sudo apt-get install fonts-powerline + +#source https://ohmyz.sh/#install +ssh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" + +#~/home/.zshrc +#ZSH_THEME="agnoster" + +``` diff --git a/docs/ssh.md b/docs/ssh.md new file mode 100644 index 0000000..671fdea --- /dev/null +++ b/docs/ssh.md @@ -0,0 +1,43 @@ +# SSH + +## Create key + +```bash +ssh-keygen -t ecdsa -b 521 +#or +ssh-keygen -t ecdsa -b 521 -f ~/.ssh/key-ecdsa + +``` + +## Copy public key + +```bash +ssh-add ~/.ssh/id_ed25519 +ssh-copy-id -i ~/.ssh//ey-ecdsa.pub example_user@192.0.2.4 +``` + +## Add existing Key + +```bash +ssh-add ~/.ssh/key-ecdsa +``` + +## Alias + +```bash +Host srv01 + HostName srv01.lan + User john + RemoteCommand cd ~/; exec bash --login + RequestTTY yes +``` + +## Port Binding + +Bind local port 8001 to target-server port 80 using jump-machine.local. +_(local machine without direct access to target-server)_ + +```bash +ssh -f -N -L localhost:8001:target-server:80 usr@jump-machine.local +``` + diff --git a/debian/README.md b/docs/systemd.md similarity index 57% rename from debian/README.md rename to docs/systemd.md index 59ead5e..f00ee60 100644 --- a/debian/README.md +++ b/docs/systemd.md @@ -1,41 +1,28 @@ -Utilitários -Serviços / auto Arranque -path onde guardar os ficheiros de configuração - -etc/systemd/system - -extensão o ficheiro .service - -Sampleservice.service -[Unit] - -Description=My Service - -After=network.target - -[Service] - -Type=simple - -Restart=always - -ExecStart=/usr/local/bin/myservice - -Exemplo de service Site .Net Core -[Service] - -WorkingDirectory=/var/www/netcore/hellomvc - -ExecStart=/usr/local/bin/dotnet /var/www/netcore/hellomvc/hellomvc2.dll --urls="http://*:5049" - -Restart=always - -RestartSec=10 - -SyslogIdentifier=dotnet-example - -User=www-data - -[Install] - -WantedBy=multi-user.target \ No newline at end of file +# systemd + +## Services + +**Creating an sevice:** + +``` bash +#/etc/systemd/system/myservice.service +[Unit] +Description=My Service +After=network.target + +[Service] +Type=simple +Restart=always +ExecStart=/usr/local/bin/myservice + +[Service] +WorkingDirectory=/var/www/netcore/hellomvc +ExecStart=/usr/local/bin/dotnet /var/www/netcore/hellomvc/hellomvc2.dll --urls="http://*:5049" +Restart=always +RestartSec=10 +SyslogIdentifier=dotnet-example +User=www-data + +[Install] +WantedBy=multi-user.target +``` diff --git a/docs/terminals/guake.md b/docs/terminals/guake.md new file mode 100644 index 0000000..b96b76e --- /dev/null +++ b/docs/terminals/guake.md @@ -0,0 +1,17 @@ +# guake + +```bash +apt install guake +``` + +```bash +# ~/.config/autostart/guake.desktop +[Desktop Entry] +Name=guake +GenericName=guake auto start +Comment= +Exec=guake --hide +Terminal=false +Type=Application +X-GNOME-Autostart-enabled=true +``` diff --git a/docs/terminals/terminator.md b/docs/terminals/terminator.md new file mode 100644 index 0000000..9e1ffe2 --- /dev/null +++ b/docs/terminals/terminator.md @@ -0,0 +1,5 @@ +# Terminator + +```bash +apt install terminator +``` diff --git a/gnome/README.md b/gnome/README.md deleted file mode 100644 index 582276b..0000000 --- a/gnome/README.md +++ /dev/null @@ -1,32 +0,0 @@ - -# Gnome - -## Table of contents - - -- [Gnome](#gnome) - - [Table of contents](#table-of-contents) - - [gvfs](#gvfs) - - [desktop shortcut](#desktop-shortcut) - - - -## gvfs - -gvfs-mount 'ftp://user@www.your-server.com/folder' -[source](https://9to5answer.com/how-to-automount-a-gvfs-file-system-on-logon) - -## desktop shortcut - -Using edge flatpack :) - -``` bash -#/home/mf/.local/share/applications/git@desktop -[Desktop Entry] -Type=Application -Name=gĩt.limbosolutions.com -Comment=git.limbosolutions.com -Exec=flatpak run com.microsoft.Edge --app=https://git.limbosolutions.com -Terminal=false -X-Desktop-File-Install-Version=0.27 -``` diff --git a/raspbian/README.md b/raspbian/README.md deleted file mode 100644 index 7332fb5..0000000 --- a/raspbian/README.md +++ /dev/null @@ -1,62 +0,0 @@ -Configuração headless -Rede Wireless -criar ficheiro wpa_supplicant.conf na partição boot - -country=PT -update_config=1 -ctrl_interface=/var/run/wpa_supplicant - -network={ - scan_ssid=1 - ssid="RouterName" - psk="Security" -} -SSH -Criar um ficheiro na partição boot com o nome ssh (vazio e sem extenção) - -IP Estático -sudo nano /etc/dhcpcd.conf -Temperatura -sudo vcgencmd measure_temp - - -interface wlan0 - -static ip_address=192.168.1.100/24 - -static routers=192.168.1.1 - -static domain_name_servers=192.168.1.1 - -sudo reboot - -Transferir root para um disco externo (exemplo SSD) -Primeiro montar o novo disco (exemplo destino /mnt/newroot/) - -Copiar todo o conteudo do root excepto boot (e outros mapeamentos que sejam mounts, caso existam outros discos ligados) - -sudo rsync -zahP --exclude='/boot' --exclude='/mnt' / /mnt/newroot/ - -Nota:subsituir 4d365c0f-02 pelo valor que o comando blkid der para o novo disco/partição Exemplo: blkid /dev/sda1 - -Alterar o mepamento do root -sudo nano /boot/cmdline.txt - -root=PARTUUID=4d365c0f-02 - -sudo nano /mnt/newroot/etc/fstab - -Comentar a linha associada ao root (/) - -adicionar: - -PARTUUID=4d365c0f-02 / ext4 defaults 0 2 - -Reboot e está feito!! - -confirmar com o comando lsblk que o root arrancou no dico certo! - -Caso o disco esteja muito lento -exemplo:Nem consegue fazer boot - -[ler artigo (depois tenho que passar as instruções para aqui:)) https://www.raspberrypi.org/forums/viewtopic.php?t=245931] \ No newline at end of file