---
# System prepended metadata

title: Занятие 2. Администрирование Linux

---

# Занятие 2. Администрирование Linux
## 1. Команда df в linux
df --help
![](https://i.imgur.com/f8vn3a4.png)

df
![](https://i.imgur.com/0fZ5IDR.png)

df -h
![](https://i.imgur.com/7uTbjqy.png)

df -a
![](https://i.imgur.com/jGVAyKc.png)

df -x tmpfs
![](https://i.imgur.com/tDsTOhx.png)

df -t ext4
![](https://i.imgur.com/kaAJ8dM.png)

df -i
![](https://i.imgur.com/WTuPjTM.png)

df -h /home 
![](https://i.imgur.com/hkqgvqB.png)

###### 2. Команда du в Linux
du --help
![](https://i.imgur.com/RBiKcwe.png)

du /tmp
![](https://i.imgur.com/C0RdLVF.png)

du -a /home 
![](https://i.imgur.com/IGD2IDT.png)

du -h /home 
![](https://i.imgur.com/U1jsefe.png)

du -sh /home 
![](https://i.imgur.com/mQr1Cf7.png)

du -csh /var/log /var/lib
![](https://i.imgur.com/Tf8AKse.png)

du -h --max-depth=1 /var/lib
![](https://i.imgur.com/5VxCTuU.png)

du -sh --apparent-size /var/lib
![](https://i.imgur.com/8T2cDs5.png)


du -csh /home/kali/Do*
![](https://i.imgur.com/YQg0bAa.png)

du -h /var/ | sort -rh | head -5
![](https://i.imgur.com/8xy4lN6.png)

###### 3. Команда free в Linux
free --help
![](https://i.imgur.com/JhJFaZw.png)

free
![](https://i.imgur.com/dU14mMo.png)

free -h
![](https://i.imgur.com/ZzIrkYq.png)

free -h -t
![](https://i.imgur.com/YBuns7e.png)

free -s 5
![](https://i.imgur.com/X8DT74I.png)

free -h --si -s 5 -c 4
![](https://i.imgur.com/o0jk8Xr.png)

###### 4. iostat
apt-get install sysstat
![](https://i.imgur.com/PYcBCWu.png)

iostat
![](https://i.imgur.com/t057aNW.png)

iostat -h
![](https://i.imgur.com/yaXh2S7.png)

iostat /dev/nvme0n1
![](https://i.imgur.com/y7IXS2i.png)

iostat -p /dev/nvme0n1
![](https://i.imgur.com/Kyw9g9l.png)

iostat -p /dev/nvme0n1 1
![](https://i.imgur.com/Q5hO1q2.png)

iostat -y -p /dev/nvme0n1 1
![](https://i.imgur.com/grqSi4s.png)

df -hl
![](https://i.imgur.com/3KwrDUT.png)

iostat -xk -t 10 | awk '// {print strftime("%Y-%m-%d %H:%M:%S"),$0}' >> iostat.log

![](https://i.imgur.com/lC7sJVG.png)

###### 5. mpstat
mpstat -A
![](https://i.imgur.com/L9M89DS.png)

mpstat -P ALL
![](https://i.imgur.com/dh5FinV.png)

mpstat -P 0
![](https://i.imgur.com/GVZFId9.png)

mpstat -V
![](https://i.imgur.com/3OcBdvz.png)

###### 6. vmstat
vmstat
![](https://i.imgur.com/XASAXlO.png)

vmstat -a
![](https://i.imgur.com/ohuZnu7.png)

vmstat -f
![](https://i.imgur.com/Fy2cDsp.png)

vmstat -d
![](https://i.imgur.com/3y2DEU2.png)

vmstat -D
![](https://i.imgur.com/Gcwx9yW.png)

vmstat --help
![](https://i.imgur.com/uBsGoFG.png)

###### 7. Утилита/команда " w "
w
![](https://i.imgur.com/SQ6TXpw.png)

w -h
![](https://i.imgur.com/QtpOGw4.png)

w -u
![](https://i.imgur.com/37oKyib.png)

w -s
![](https://i.imgur.com/oulvFte.png)

w -f
![](https://i.imgur.com/OywCJ3H.png)

w -i
![](https://i.imgur.com/379J8mN.png)

w -o
![](https://i.imgur.com/Y5npudP.png)

w -V
![](https://i.imgur.com/JAcq8qq.png)

###### 8. Утилита htop

apt-get install htop
![](https://i.imgur.com/T2b0tdb.png)

htop
![](https://i.imgur.com/HGZcfko.png)

htop -d 1 ускорение
![](https://i.imgur.com/ZXFkmqQ.png)

htop -d 50
![](https://i.imgur.com/xkqppPe.png)

sudo htop -t
![](https://i.imgur.com/zhCjHQV.png)

## Настройка и подключение по SSH

![](https://i.imgur.com/Mv3xQWn.png)

подключение по паролю
![](https://i.imgur.com/fpo0hz6.png)

подключение через pytty
![](https://i.imgur.com/B5QQQn8.png)

![](https://i.imgur.com/QvyGOXC.png)

![](https://i.imgur.com/8vdv3yi.png)

сгенерирум ключи
![](https://i.imgur.com/8YuSb5I.png)

подключение без пароля по ключам 
![](https://i.imgur.com/oN1MFEh.png)

![](https://i.imgur.com/1G7zVqa.png)

## Сбор информации о Linux и WGET

1.Базовый сбор информации
![](https://i.imgur.com/G5P1mdB.png)

uname -a
![](https://i.imgur.com/6fW5g1U.png)

whoami
![](https://i.imgur.com/e6Yljzu.png)

uptime
![](https://i.imgur.com/EpLcT7X.png)

ls -la /home
![](https://i.imgur.com/hx1hsGC.png)

chmod o-rx /home/kali 
![](https://i.imgur.com/a79FGcv.png)

ip neigh
![](https://i.imgur.com/HDsyj6u.png)

ss -tlnp
![](https://i.imgur.com/s97quh0.png)

sudo -l
![](https://i.imgur.com/0JtsCk2.png)

###### 2.Суидные файлы

![](https://i.imgur.com/HFJny5G.png)

скачаем
![](https://i.imgur.com/YpH0588.png)

разархивируем
![](https://i.imgur.com/dLi0BVx.png)

проверка контрольных сумм
![](https://i.imgur.com/ntmGBud.png)

![](https://i.imgur.com/ywywZyl.png)

![](https://i.imgur.com/4HMGAW0.png)

отчет 
![](https://i.imgur.com/SnhF317.png)

###### 3. Проверка целостностей пакетов
![](https://i.imgur.com/LlYN3jd.png)

![](https://i.imgur.com/5g6jJ8g.png)

![](https://i.imgur.com/0I6Cai6.png)

Смог найти подменный файл
![](https://i.imgur.com/x1F2E1z.png)



![](https://i.imgur.com/NFsw2v7.png)
![](https://i.imgur.com/BsKv68q.png)


## Переменные окружения в Linux .bashrc, .bash_profile и .bash_login


1. Просмотр списка системных переменных окружения
![](https://i.imgur.com/EI5r5n1.png)
2. Запуск команд с указанием нового значения переменной окружения
![](https://i.imgur.com/8Hku3hP.png)
![](https://i.imgur.com/UzbvJKk.png)

3. Добавление и удаление пользовательских переменных
![](https://i.imgur.com/uRW4FW6.png)
![](https://i.imgur.com/0j78dnc.png)

4. Создание и удаление системных переменных окружения

![](https://i.imgur.com/h7418wr.png)


![](https://i.imgur.com/uX9lB9L.png)


