projects @GitHub
Чит-лист шпаргалка Линукс & Винда
sudo diskutil list
sudo diskutil eraseDisk FAT32 USB /dev/disk3
sudo diskutil umountDisk /dev/disk3
cd Downloads
ls -l
sudo dd if=./debian-12...iso of=/dev/disk3 bs=5M status=progress
bs=2048
user: user
passwd: live
sudo nano /etc/apt/sources.list
sudo apt update
uname -a
cat /etc/debian_version
lsb_release -a
lsb_release -d
whoami
su - root
usermod -aG sudo username
reboot
su - username
ls -a
ls -lh
split -b 4000M /source-dest/big_file_name ~/archive/big-file-name-split_
cat ~/archive/big-file-name-split_* > ~/target-dest/big-file-name
tar -czvf archive.tar.gz /home/disk`
# or
tar -zcvf - file_large.zip | split -b 4000M - files.tar.gz
# then
cat files.tar.gz* | tar -zxv
# to extract use terminal or mc (midnight commander)
tar -xvf files.tar.gz
unzip files.zip
cat /etc/passwd
sudo apt autoremove
sudo apt autoclean
sudo apt install ncdu
ncdu /
d
(to delete). Be carefull!/var/log/journal/
/var/tmp/
/var/spool/
/tmp/
sudo apt-get install ghostscript libtiff-tools
ghostscript -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf
gs -o out.pdf -sDEVICE=pdfwrite -sPageList=1,5,7,12 -f input.pdf output.pdf
sudo apt install pdftk
pdftk A=input.pdf cat A1-2 A5 A7-8 A11-12 output output.pdf
A1-2 A5 pages no.
pdftk file1.pdf file2.pdf cat output mergedfile.pdf
tiff2pdf -o output.pdf input.tif
lsblk
sudo umount /dev/sd<?><?>
sudo dd bs=4M if=path/to/input.iso of=/dev/sd<?> conv=fdatasync status=progress
apt install grub-pc
grub-install /dev/sda
update-grub
root@dlinux:/boot/efi/EFI/Debian# cat /boot/efi/EFI/Debian/grub.cfg
search.fs_uuid disk-0000-111c-b222-9a...b root hd0,msdos4
set prefix=($root)'/boot/grub'
configfile $prefix/grub.cfg
apt search refind
or downloadbash /home/../../refind-bin-0.14.0.2/refind-install
# download from https://www.rodsbooks.com/refind
# Run from the terminal to find the EFI partition:
diskutil list
# copy unziped refind-bin-0.14.2 to (exFAT) usb-stick refind-bin-0.14.2
# reboot MacBook and hold Cmd+R
# when the OS has booted, selected Utilities -> Terminal
cd /Volumes/Your-usb-stick/refind-bin-0.14.2
# Run the rEFInd install script:
./refind-install
... Installation has completed successfully.
reboot
# To Fix rEFInd by problems
# https://gist.github.com/rowanphipps/e4c0e6037b71e9ea96dd8fe403461ee3
# Whenever you install a new OS or somtimes when you install updates, one of the operating systems may decide that you EFI boot selection is all broken and that it needs to be fixed. When this happens then when you reboot it will boot straight into that OS and skip rEFInd. Instructions for how to fix this are below and there is a script in the attached file.
# Restart and hold down the option key or Cmd+R
# This tells the hardware to skip straight to the mac bootloader, allowing you to bypass your broken EFI settings.
# Select your macOS partition to boot from.
# Open terminal
# Mount the ESP volume:
mkdir /Volumes/ESP
mount -t msdos /dev/disk0s1 /Volumes/ESP
#Bless the reFind program
bless --mount /Volumes/ESP --setBoot --file /Volumes/ESP/EFI/REFIND/refind_x64.efi --shortform
lspci -nn | grep Network
sudo apt install wireless-tools
sudo apt install wpasupplicant
sudo apt install linux-image-$(uname -r|sed 's,[^-]*-[^-]*-,,') linux-headers-$(uname -r|sed 's,[^-]*-[^-]*-,,') broadcom-sta-dkms
sudo modprobe -r b44 b43 b43legacy ssb brcmsmac bcma
aptitude install network-manager-vpnc vpnc
dmesg | grep -i bluetooth
lsusb | grep Bluetooth
modprobe btusb
sudo systemctl status bluetooth
sudo systemctl enable bluetooth
sudo systemctl start bluetooth
lspci -v
sudo apt install git
cd /etc/local/src/
sudo git clone https://github.com/patjak/bcwc_pcie.git
ls
cd bcwc_pcie/firmware
ls
sudo git clone https://github.com/patjak/facetimehd-firmware.git
cd facetimehd-firmware
sudo make install
cd ../..
sudo make install
sudo depmod
sudo modprobe -r bdc-pci
sudo modprobe facetimehd
(---
sudo apt install kmod
cd ~/bcwc_pcie
sudo make install
sudo depmod
---)
sudo apt install xz-utils curl cpio make
sudo apt install linux-headers-generic git kmod libssl-dev checkinstall
git clone https://github.com/patjak/facetimehd.git
$ cd facetimehd
$ make
sudo checkinstall
sudo make install
sudo depmod
#sudo modprobe facetimehd
$ mplayer tv://
su -s
ip addr
ip a
ping ip-address
netstat -tl (прослушать TCP-порты)
dig geekbrains.ru (службы DNS)
nmap geekbrains.ru
nmcli c show
more /etc/network/interfaces
# Ctrl + c
cat /etc/network/interfaces
apt install ifupdown
nano /etc/network/interfaces
service networking restart
ip addr
cat /etc/resolv.conf
ip link set enp0s3 up
ip addr add 192.IP.../255.255.255.0 broadcast 192.IP... dev enp0s3
ip route add default via 192.IP...
ip a s
dig geekbrains.ru
ping -c 4 geekbrains.ru
nano /etc/resolv.conf
cat /etc/network/interfaces
auto enp0s3 … dhcp
service networking restart
dig geekbrains.ru
ping -c 4 geekbrains.ru
nano /etc/resolv.conf
nano /etc/network/interfaces
service networking restart
dig geekbrains.ru
ping -c 4 geekbrains.ru
sudo apt install apache2
$ nano /etc/apache2/apache2.conf (Debian/Ubuntu)
ServerSignature Off
ServerTokens Prod
$ service apache2 restart (Debian/Ubuntu)
# Indexes off - apache2.conf
<Directory /var/www/html>
Options -Indexes
</Directory>
$ httpd -v
# update
apt-get install apache2
# Deactivate with comments # : mod_imap, mod_include, mod_info, mod_userdir, mod_autoindex, ...
# grep LoadModule /etc/httpd/conf/httpd.conf
# have to place corresponding `LoadModule' lines at this location so the
# LoadModule foo_module modules/mod_foo.so
LoadModule auth_basic_module modules/mod_auth_basic.so
...
# separate group / user for Apache2
# /etc/httpd/conf/httpd.conf
# groupadd http_web
# useradd -d /var/www/ -g http-web -s /bin/nologin http_web
User http_web
Group http_web
# httpd.conf.
<Directory />
Options None
Order deny,allow
Deny from all
</Directory>
$ sudo apt-get install libapache2-modsecurity
$ sudo a2enmod mod-security
$ sudo /etc/init.d/apache2 force-reload
# Deactivate links .htaccess
Options -FollowSymLinks
# Enable symbolic links
Options +FollowSymLinks
# mod_include
Options -Includes
Options -ExecCGI
/var/www/html/web».
<Directory "/var/www/html/web">
Options -Includes -ExecCGI
</Directory>
# LimitRequestBody 0 (unlimited) / 500К / 2G
<Directory "/var/www/myweb/user_uploads">
LimitRequestBody 512000
</Directory>
# DDOS
TimeOut
MaxClients
KeepAliveTimeout
LimitRequestFields 100 (10 ?)
LimitRequestFieldSize
# log mod_log_config
<VirtualHost *:80>
DocumentRoot /var/www/html/example.com/
ServerName www.example.com
DirectoryIndex index.htm index.html index.php
ServerAlias example.com
ErrorDocument 404 /story.php
ErrorLog /var/log/httpd/example.com_error_log
CustomLog /var/log/httpd/example.com_access_log combined
</VirtualHost>
# SSL mod_ssl
# openssl genrsa -des3 -out example.com.key 1024
# openssl req -new -key example.com.key -out exmaple.csr
# openssl x509 -req -days 365 -in example.com.com.csr -signkey example.com.com.key -out example.com.com.crt
# add cert to conf Appache
<VirtualHost 172.16.25.125:443>
SSLEngine on
SSLCertificateFile /etc/pki/tls/certs/example.com.crt
SSLCertificateKeyFile /etc/pki/tls/certs/example.com.key
SSLCertificateChainFile /etc/pki/tls/certs/sf_bundle.crt
ServerAdmin ravi.saive@example.com
ServerName example.com
DocumentRoot /var/www/html/example/
ErrorLog /var/log/httpd/example.com-error_log
CustomLog /var/log/httpd/example.com-access_log common
</VirtualHost>
sudo apt install iptables
modprobe iptable_nat
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o enp3s0 -j MASQUERADE
iptables -A FORWARD -i enp1s0 -j ACCEPT
nano /etc/modules
iptable_nat
nano /etc/sysctl.conf
net.ipv4.ip_forward=1
apt install iptables-persistent
iptables-save > /etc/iptables/rules.v4
ping 8.8.8.8
ping 1.1.1.1
iptables -t nat -L
sudo apt install nmap
nmap -O ip-address/homepage
nmap -sV ip-address/homepage
nmap -A -T4 ip-address/homepage
dpkg -l
cd ~
find . -maxdepth 1 -type f -name ".*"
sudo netstat -tulpn # open ports
sudo apt install ufw
sudo ufw enable
sudo ufw enable status
sudo ufw app list
sudo ufw default deny incoming # sudo ufw default allow incoming
sudo ufw default allow outgoing
sudo ufw status verbose
sudo ufw disable #disable Firewall
sudo ufw status numbered
sudo ufw allow OpenSSH
sudo ufw reset # reset Firewall
wget -O - http://repo.drweb.com/drweb/drweb.key | apt-key add -
sudo nano /etc/apt/sources.list
deb https://repo.drweb.com/drweb/debian 11.1 non-free
Istall demo per. 30 d
sudo apt update
sudo apt install drweb-workstations
sudo apt-get install mysql-server mysql-client mysql-common php7.0-mysql
mysql_secure_installation
mysql -u root -p
1234
sudo apt-get -y install php7.0 libapache2-mod-php7.0 php7.0-mysql php7.0-curl php7.0-json
sudo apt install phpmyadmin -y
apt install firmware-linux
apt install gparted
apt install openssh-server
apt install mc
apt install putty
apt install build-essential libssl-dev libffi-dev python3-dev python3 pandas
pip install pandas
sudo apt search network-manager-vpnc
sudo apt install vpnc
sudo apt install network-manager-openconnect
sudo apt search network-manager
sudo apt install sane-utils
sudo apt install alien
sudo dpkg -i PACKAGE.deb
sudo dpkg -i PACKAGE.deb
dpkg -l | grep ProgName
sudo dpkg -P ProgName1
sudo dpkg -i --force-all PACKAGE.deb
sudo dpkg --configure -a
sudo apt-get install -f
sudo autoremove PACKAGE
sudo purge PACKAGE
gunzip GZTARFILE.tar.gz
tar -xvjf TARFILE.tar.gz
sudo ./install.sh
sudo tasksel
systemd --version
# systemd 252
cat /etc/timezone
cat /etc/localtime
sudo apt-get autoremove ntp chrony openntpd
sudo apt-get install systemd-timesyncd
systemctl status systemd-timesyncd.service
timedatectl status
sudo lsof -i
# no ntp service (OK)
sudo dpkg-reconfigure locales
sudo dpkg-reconfigure keyboard-configuration`
sudo service keyboard-setup restart`
sudo nano /etc/default/keyboard`
sudo setxkbmap de`
sudo setxkbmap ru
sudo apt update
sudo nano /etc/apt/sources.list
sudo apt update
history 1000
cat ~/.bash_history
clear
history -c
cp ~/.bash_history ~/bash_history-bak_2025-4
cat /dev/null > ~/.bash_history
sudo apt install samba cifs-utils
sudo apt install virtualbox
sudo apt install virtualbox-ext-pack
#https://www.virtualbox.org/wiki/Downloads
#Resize the VDI image to MB-SIZE
cd /home/.../VirtualBox/Your_disk.vdi
VBoxManage modifyhd Your_disk.vdi –resize size_in_Mb
#Clone the VMDK image to VDI format
VBoxManage clonehd source.vmdk cloned.vdi --format vdi
#Clone back to VMDK format
VBoxManage clonehd cloned.vdi resized.vmdk --format vmdk
#Virtualbox Linux
vboxmanage list -l hdds
GParted
resize
# Windows
cd C:\Program files\Oracle\VirtualBox
VBoxManage modifyhd «C:\Users\NameUser\VirtualBox VMs\Staffcop\Staffcop.vdi» --resize X
...
#Virtualbox Win:
Win+R + diskmgmt.msc
Расширить том
lsblk #list disks /sdX
sudo apt install dosfstools
sudo umount /dev/sdX1 #my sd-card on disk /dev/sdX
sudo fdisk /dev/sdX
# o (Enter) - d (delete partition & Enter) - n (Enter) - p (Enter) - ...
... - t (Enter) - c (W95 FAT32 (LBA) & Enter) - w (write & Enter)
# -c set to W95 FAT32 (LBA)
sudo umount /dev/sdX1
sudo mkfs.vfat -F 32 -s 2 -S 4096 -v /dev/sdX1 # Format to fat32 with a logical sector size is 4096 # -n nameSD
sudo fdisk -l #W95 FAT32 (LBA)
/media/USER/DISK/Windows/System32/config/
BCD-Template [1]
WS\System32\config\BCD-Template
sfc /scanow /OFFBOOTDIR=C:\ /OFFWINDIR=D:\WINDOWS
CHKDSK M: /F
attrib -s -h \EFI\Microsoft\Boot\BCD
del \EFI\Microsoft\Boot\BCD
bcdboot
ошибка BFSVC ErrorПерезагрузите компьютер, отключите загрузочный диск. Если вы все сделали правильно, в выборе устройств загрузки должен появиться пункт Windows Boot Manager в котором можно выбрать загрузку нужной операционной системы. Ваш EFI загрузчик и конфигурация BCD успешно восстановлены! В некоторых случаях после восстановления BCD загрузчика, при загрузке Windows появляется ошибка BAD SYSTEM CONFIG INFO . Чтобы исправить ошибку:
bcdedit /deletevalue {default} numproc
bcdedit /deletevalue {default} truncatememory
Благодарность автору 1. winitpro 2. remontka.pro
vers. 1.0