This commit is contained in:
root
2024-01-27 07:49:05 +12:00
commit d45048e439
17 changed files with 435 additions and 0 deletions

54
docs/linux/common.md Normal file
View File

@@ -0,0 +1,54 @@
[File systems](filesystems.md)
[Fedora / CentOS](fedora.md)
[SELinux](selinux.md)
# Common
## find
```
find /var -maxdepth 2 -type d -printf "%TY-%Tm-%Td %TH:%TM:%TS %Tz %p\n"
```
## bash
```
# cat > /etc/profile.d/cmp.sh
export EDITOR=mcedit
export HISTFILESIZE=10485760
export HISTSIZE=500000
export HISTCONTROL=ignoreboth:erasedups
export HISTIGNORE="history:reboot:poweroff:cd:ls:pwd:mc:ps:m:e:l"
export SSH_ASKPASS=
alias ffi='ffmpeg -hide_banner -i'
alias m='cd /mnt'
alias e='cd /etc'
alias l='cd /var/log'
tabs -4
```
## reboot
```bash
echo 1 > /proc/sys/kernel/sysrq
echo b > /proc/sysrq-trigger
```
## Motherboard name
```bash
cat /sys/devices/virtual/dmi/id/board_name
```
## grab video from screen
```bash
ffmpeg -s 1920x1080 -framerate 10 -f x11grab -i :0 -qscale 6 out.mkv
```
```bash
ps --ppid 2 -p 2 --deselect
```

13
docs/linux/fedora.md Normal file
View File

@@ -0,0 +1,13 @@
# Fedora / CentOS / Etc
## Relabel
```bash
touch /.autorelabel
```
## Install PHP 8
```
dnf install https://rpms.remirepo.net/fedora/remi-release-38.rpm
dnf module reset php
dnf module install php:remi-8.2
```

41
docs/linux/filesystems.md Normal file
View File

@@ -0,0 +1,41 @@
# LVM
#### Extend
```bash
lvextend -L+1G /dev/vg4/homevol
```
# Btrfs
#### Resize
```bash
btrfs filesystem resize max /mnt/dmp/
```
#### Defragment / compress
```bash
btrfs filesystem defragment -v -clzo /boot/*
```
#### Set RO / RW
```bash
btrfs property set -f . ro false
btrfs property set -f . ro true
```
#### Create shapshot
```bash
btrfs subvolume snapshot xyz xyz-snapshot-path-name
```
#### Delete shapshot
```bash
btrfs subvolume delete xyz-snapshot-path-name
```
# Ext4
#### Resize
```bash
resize2fs /dev/device [size]
```
#### if superblock fail
```bash
dumpe2fs /dev/sda5 | grep -i backup
fsck -b 32768 /dev/sda5
```

64
docs/linux/rsyslog.md Normal file
View File

@@ -0,0 +1,64 @@
```
$ModLoad imudp
$UDPServerRun 514
template(name="cmpDate" type="list") {
property(name="timereported" dateformat="year")
constant(value="-")
property(name="timereported" dateformat="month")
constant(value="-")
property(name="timereported" dateformat="day")
}
set $.cmpDate = exec_template("cmpDate");
set $.cmpSuff = "default";
template(name="cmpOutFile" type="list") {
constant(value="/mnt/netlog/zzz/")
property(name="$.cmpDate")
constant(value="/")
# property(name="hostname")
property(name="fromhost-ip")
constant(value="-")
property(name="$.cmpSuff")
constant(value=".log")
}
template(name="cmpOutFmt" type="list") {
property(name="$.cmpDate")
constant(value=" ")
property(name="timereported" dateformat="hour")
constant(value=":")
property(name="timereported" dateformat="minute")
constant(value=":")
property(name="timereported" dateformat="second")
constant(value=" ")
property(name="hostname")
constant(value=" ")
property(name="syslogtag")
property(name="msg" spifno1stsp="on" )
property(name="msg" droplastlf="on" )
constant(value="\n")
}
if( $fromhost-ip == "127.0.0.1" ) then {
stop
}
if ( $fromhost-ip == "172.16.1.1" ) then {
if ( $syslogtag contains "teg3" ) then {
set $.cmpSuff = "teg3";
}
}
action(type="omfile" dynafile="cmpOutFile" template="cmpOutFmt")
stop
```

9
docs/linux/selinux.md Normal file
View File

@@ -0,0 +1,9 @@
# Nginx
```
# Allow open local port
semanage port -a -t http_port_t -p tcp 28081
# Allow open remote port
setsebool -P httpd_can_network_connect 1
```