/
noxit
/
DevOps_practices
Обзор
Документация
Войти
/
noxit
/
DevOps_practices
Код
Запросы
1
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
test
SystemAdmin_snippets
107 строк
3 KB
noxit
update SystemAdmin_snippets
25 ноя 2025, 09:38
25 ноя 2025, 09:38
abce26c
Код
Авторство
О чём код?
----------- Displays the last 10 user login last -n 10 ----------- Display disk usage in a human-readable format df -h | grep -E '^/dev/' ----------- Update package lists and upgrade installed packages on the system sudo apt-get update && sudo apt-get upgrade ----------- Monitors the auth.log file in real-time for authentication failures tail -f /var/log/auth.log | grep 'authentication failure' ----------- Finds all configuration files in /etc with server_name directive find /etc -name '*.conf' -exec grep -H -i 'server_name' {} \; ----------- Calculates the total CPU usage percentage of all running processes ps aux | awk '{sum+=$3}; END{print "Total CPU usage:"; print sum}' ----------- самые прожорливые процесс ps aux --sort=-%cpu | head ----------- Shows the size of each directory in the current directory in human-readable format, sorted by size du -hs * | sort -h ----------- Check if the proccess web server is running ps aux | grep $PROCESS_NAME ----------- Show all listening ports on the system netstat -tuln | grep 'LISTEN' ----------- Show size of directories in a specified path in a human-readable format du -h --max-depth=1 /path/to/directory ----------- Show top 10 processes sorted by memory usage ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem | head ----------- Backup logs older then 7 days find / -type f -iname '*.log' -mtime +7 -exec cp {} /backup/logs \; Reverse DNS lookup dig -x 77.88.8.8 +short Show routing table route -n Trace route and save output traceroute -I dns.yandex.ru > traceroute_output.txt Display network connections and their processes ss -tulnpe (or netstat) Test access to multiple DNS servers for server in 8.8.8.8 8.8.4.4 77.88.8.8; do echo "Testing DNS server: $server"; dig +short dns.yandex.ru @$server; done Scan a range of IP addresses for open ports for ip in $(seq 1 254); do nmap -p 80,443 192.168.1.$ip -oG - | grep open; done Continuous monitoring of network latency while true; do date; ping -c 5 yandex.ru | grep icmp_seq; sleep 5; done Ping multiple hosts simultaneously for host in 192.168.1.1 192.168.1.2 yandex.ru; do ping -c 2 $host & done; wait Analyze network packets and their contents with tcpdump tcpdump -i eth0 -w capture.pcap nmap -sn -p- 192.168.1.0/24 Perform a network speed test using a TCP connection to a remote server iperf -c IP_Address -p Port_Number -t Time_Duration Queries DNS information for google.com dig yandex.ru ANY +noall +answer Assigns the IPv4 address 192.168.1.2 with a subnet mask of 255.255.255.0 to the network interface eth0 ip addr add 192.168.1.2/24 dev eth0 Configure a network interface with a specific IP address and netmask ifconfig eth0 192.168.1.10 netmask 255.255.255.0 Display all active network interfaces with detailed information ip a | grep 'inet ' Check if a specific port is open on a remote host using netcat nc -zv remote_host.com 80 проверка срзу всех основных параметров сервера echo "=== $(date) ===" && echo "🔍 Swap usage:" && free -h && echo -e "\n📊 Memory usage per process (sorted by RAM):" && ps aux --sort=-%mem | head -11 && echo -e "\n🔄 Swap usage per process:" && (sudo smem -t -k || (echo "smem not found, install with: sudo apt install smem")) && echo -e "\n🧩 Swap devices:" && swapon --show && echo -e "\n⚙️ System load & uptime:" && uptime Вывод размера find через du find . -type f -name "*.log" -exec du -h {} + | sort -h