Skip to content

Instantly share code, notes, and snippets.

@sanekmihailow
Last active May 12, 2023 21:24
Show Gist options
  • Save sanekmihailow/644925ff1545153230d8d19975062b43 to your computer and use it in GitHub Desktop.
Save sanekmihailow/644925ff1545153230d8d19975062b43 to your computer and use it in GitHub Desktop.
command

cut

rev file | cut -c 1- | rev

curl

  • proxy
curl -s -v --proxy <domain>:<port> -U <user> https://instagram.com
  • letsencrypt
curl -X GET -I -m 10 https://acme-v02.api.letsencrypt.org/directory

crontab

crontab -u www-data -e

dmesg

dmesg |grep radeon #chech support params kernel

docker

зайти в docker container

sudo docker exec -it <container_id> bash

docker-compose

build yml

docker-compose -f docker-compose-build.yml build #выполнять в директории с .yml
#or and remove /var/lib/docker/volumes/"conatainers"
pkill docker
ps aux |grep docker
docker-compose up --build #выполнять в директрии с .yml

find

поиск по названию и показ прав, пользователя и группы

find /etc -name '*vsftpd*' -printf ""%p"\n "%m" "%M" "%u" "%g" "%Y"\n\n" |colorex -b '.*vsftpd.*' |colorex -r 'vsftpd'

def permissions

cd path
find . -type f -exec chmod 0644 {} \;
find . -type d -exec chmod 0755 {} \;

поиск по размеру

find /home/ -type f -size 6579c -exec ls {} \;
#b – for 512-byte blocks, c – for bytes, w – for two-byte words, k – for Kilobytes, M – for Megabytes, G – for Gigabytes

grep, egrep

egrep -v '^#|^$' /etc/smb.conf

ln

создать симлинк без полного пути

cd /etc/nginx/sites-available
ln -s /etc/nginx/sites-available/default.conf ../sites-enable/

lsblk

lsblk -d -o name,rota
#1 - hdd, 0 - ssd

Lspci

lspci
lspci -k |gprep amd

man

man -k amd

mount

cifs samba

  • with password
sudo mount -t cifs //192.168.10.172/new_share /mnt -o user=admin
  • without password
sudo mount -t cifs //192.168.10.172/new_share /mnt -o user=guest

nfs

  • without passwrod
sudo mount -t nfs -o soft,intr,rsize=8192,wsize=8192 192.168.0.25:/nfs/Public /home/administrator/mount_backup
  • with uid
sudo mount -t nfs -O uid=1000,iocharset=utf-8 192.168.1.2:/data /home/administrator/mount_backup

php

поиск процесса

php -d $value - выполнить пхп команду передав значение из пути php/cli/php.ini 

example: /usr/bin/php -d short_open_tag /var/www/bitrix_portal/public_html/bitrix/modules/main/tools/cron_events.php

short_open_tag off , через пример передал значение short_open_tag On

ps

показать тех кто больше всех жрет RAM память

ps -e -o pid,vsz,comm= | sort -n -k 2 |tail
или
ps aux | awk '{print $6/1024 " MB\t\t" $11}' | sort -n |tail

rsync

ssh specific

rsync -avP -e 'ssh -p 7222' ./www/bitrixenv_error/ root@tempserv.cf:/var/www/bitrixenv_error/

info progress bar as in midnight commander

rsync -a --info=progress2 /usr /mnt/usr

SQL

mysql

показать существующих пользователей в базе mysql

select user,host from mysql.user;

покзать права юзера

show grants for <username>@<localhost>;

показать поля внутри таблицы

describe <table>;

ssh

ssh root@iip -o 'IdentitiesOnly=yes'

sudo

sudo su $user -s /bin/sh -c '$command'
sudo -u $user -s /bin/bash

example : sudo su www-data -s /bin/sh -c '/usr/bin/php -f /var/www/bitrix_portal/public_html/bitrix/modules/main/tools/cron_events.php && echo 'user1''

example : sudo -u www-data -s /bin/bash

usermod

usermod -aG <group> <user>

xstow

xstow nginx1.15.8/ -t ../LOCAL/nginx/

zcat

zcat /proc/config.gz |grep amdgpu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment