Check processors on linux:
Zobrazujú sa príspevky s označením root. Zobraziť všetky príspevky
Zobrazujú sa príspevky s označením root. Zobraziť všetky príspevky
nedeľa 9. januára 2022
piatok 14. mája 2021
How to reduce root in ext4
How to reduce root in ext4
Miesto:
Košice, Slovensko
štvrtok 29. apríla 2021
Ako zmenšiť root v lvm?
Ako zmenšiť root v lvm?
Miesto:
091 01 Stropkov, Slovensko
utorok 27. apríla 2021
List of account in Linux
Some customers need list of account on linux without user=services.
piatok 27. marca 2020
Debian - zoznam balíčkov na upgrade
Stane sa, že chceme vedieť, čo ideme upgradovať. Ako to urobíme? Poďme sa opäť vŕtať s apt, keďže sme v Debiane :-)
utorok 18. februára 2020
Šikovný alias unmount
Občas sa stretneme s tým, že niekto (alebo my) píšeme príkaz unmount. Skúsme si vytvoriť šikovný alias.
Menovky:
echo,
Linux,
root,
umount,
unmount,
zapisky admina,
zápisky linux admina
Miesto:
Darmstadt, Germany
sobota 15. februára 2020
ssh a mkdir
Občas potrebujeme na server(och) vytvoriť priečinok. Ako to urobiť cez ssh?
Menovky:
apostrof,
apostrofy,
Linux,
linux zápisky,
ls,
mkdir,
root,
sokol,
ssh,
zapisky linux admina,
zemplinske_jastrabie
nedeľa 2. februára 2020
$ a # pri zisťovaní, kto som
Občas nám chýbajú skryté súbory ako .bash_rc a pod. Vtedy vidíme len holý bash. Ako však vieme, či sme obyčajný user alebo root?
Menovky:
#,
$,
Debian,
echo,
groot,
guliverkel,
Linux,
root,
YNWA,
Zápisky admina,
zápisky linux admina
Miesto:
Chtelnica, Slovakia
sobota 21. decembra 2019
chgrp
Pokračujeme trojicou (chown, chgrp, chmod) a dnes si predstavíme príkaz chgrp.
Chgrp alebo zmena vlastníka skupiny.
Chgrp alebo zmena vlastníka skupiny.
Menovky:
Debian,
chgrp,
Linux,
root,
senzi-senzus,
skupiny,
verbose,
vlastníkskupiny
Miesto:
044 71 Čečejovce, Slovakia
utorok 17. decembra 2019
Update Debian 9
Update Debianu:
Alebo ako som si updatoval operačný systém. (Nie upgrade na novšiu verziu)
root@guliverkel:/home/martin# df -h /dev/sda3
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 15G 3.9G 11G 27% /
root@guliverkel:/home/martin# mkdir /media/data2/grub
root@guliverkel:/home/martin# cp /boot/grub/grub.cfg /media/data2/grub
root@guliverkel:/home/martin# ls -lh /media/data2/grub
total 12K
-r--r--r-- 1 root root 12K Dec 17 08:08 grub.cfg
root@guliverkel:/home/martin# cat /etc/*release
PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
NAME="Debian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
root@guliverkel:/home/martin# uname -r
4.9.0-8-amd64
root@guliverkel:/home/martin# apt update
Ign:1 http://ftp.sk.debian.org/debian stretch InRelease
Get:2 http://ftp.sk.debian.org/debian stretch Release [118 kB]
Get:3 http://ftp.sk.debian.org/debian stretch Release.gpg [2,365 B]
Get:4 http://security.debian.org/debian-security stretch/updates InRelease [94.3 kB]
Get:5 http://ftp.sk.debian.org/debian stretch/main Sources [6,747 kB]
Get:6 http://security.debian.org/debian-security stretch/updates/non-free Sources [1,216 B]
Get:7 http://security.debian.org/debian-security stretch/updates/main Sources [202 kB]
Get:8 http://security.debian.org/debian-security stretch/updates/main amd64 Packages [509 kB]
Get:9 http://security.debian.org/debian-security stretch/updates/main Translation-en [224 kB]
Get:10 http://security.debian.org/debian-security stretch/updates/non-free amd64 Packages [1,596 B]
Get:11 http://ftp.sk.debian.org/debian stretch/contrib Sources [44.7 kB]
Get:12 http://ftp.sk.debian.org/debian stretch/non-free Sources [79.4 kB]
Get:13 http://ftp.sk.debian.org/debian stretch/main amd64 Packages [7,086 kB]
Get:14 http://ftp.sk.debian.org/debian stretch/main Translation-en [5,385 kB]
Get:15 http://ftp.sk.debian.org/debian stretch/non-free amd64 Packages [78.3 kB]
Get:16 http://ftp.sk.debian.org/debian stretch/non-free Translation-en [80.3 kB]
Get:17 http://ftp.sk.debian.org/debian stretch/contrib amd64 Packages [50.9 kB]
Fetched 20.7 MB in 6s (3,284 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
83 packages can be upgraded. Run 'apt list --upgradable' to see them.
root@guliverkel:/home/martin# apt list --upgradable
Listing... Done
base-files/oldstable 9.9+deb9u11 amd64 [upgradable from: 9.9+deb9u9]
debian-archive-keyring/oldstable 2017.5+deb9u1 all [upgradable from: 2017.5]
e2fslibs/oldstable 1.43.4-2+deb9u1 amd64 [upgradable from: 1.43.4-2]
e2fsprogs/oldstable 1.43.4-2+deb9u1 amd64 [upgradable from: 1.43.4-2]
root@guliverkel:/home/martin# apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following NEW packages will be installed:
83 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
Need to get 176 MB of archives.
After this operation, 244 MB of additional disk space will be used.
root@guliverkel:/home/martin# apt dist-upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
root@guliverkel:/home/martin#
(niečo z catmanu)
root@guliverkel:/home/martin# catman
Updating cat files for section 1 of man hierarchy /usr/share/man
2to3-2.7, 2to3-3.5, 7z, 7za, 7zr, Xorg.wrap, acpi_available, add-apt-repository, apm_available, appres, appstreamcli, apropos, apt-extracttemplates, apt-ftparchive, apt-listchanges, apt-sortpkgs, ar, arch, ark, asn1parse, aspell,
root@guliverkel:/home/martin# cat /etc/*release
PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
NAME="Debian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
VERSION_CODENAME=stretch
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
root@guliverkel:/home/martin# uname -r
4.9.0-8-amd64
root@guliverkel:/home/martin# uptime -s
2019-12-17 08:22:25
Alebo ako som si updatoval operačný systém. (Nie upgrade na novšiu verziu)
1. Zistíme, či máme vôbec voľné miesto:
root@guliverkel:/home/martin# df -h /dev/sda3
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 15G 3.9G 11G 27% /
2. Zálohujem si grub
root@guliverkel:/home/martin# mkdir /media/data2/grub
root@guliverkel:/home/martin# cp /boot/grub/grub.cfg /media/data2/grub
root@guliverkel:/home/martin# ls -lh /media/data2/grub
total 12K
-r--r--r-- 1 root root 12K Dec 17 08:08 grub.cfg
3. Pozriem sa na to, akú konkrétnu verziu Debianu mám, plus aké mám jadro:
root@guliverkel:/home/martin# cat /etc/*release
PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
NAME="Debian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
root@guliverkel:/home/martin# uname -r
4.9.0-8-amd64
4. Môžem spustiť prvý krok updatu (apt-get update) alebo v týchto novších verziách stačí apt update
root@guliverkel:/home/martin# apt update
Ign:1 http://ftp.sk.debian.org/debian stretch InRelease
Get:2 http://ftp.sk.debian.org/debian stretch Release [118 kB]
Get:3 http://ftp.sk.debian.org/debian stretch Release.gpg [2,365 B]
Get:4 http://security.debian.org/debian-security stretch/updates InRelease [94.3 kB]
Get:5 http://ftp.sk.debian.org/debian stretch/main Sources [6,747 kB]
Get:6 http://security.debian.org/debian-security stretch/updates/non-free Sources [1,216 B]
Get:7 http://security.debian.org/debian-security stretch/updates/main Sources [202 kB]
Get:8 http://security.debian.org/debian-security stretch/updates/main amd64 Packages [509 kB]
Get:9 http://security.debian.org/debian-security stretch/updates/main Translation-en [224 kB]
Get:10 http://security.debian.org/debian-security stretch/updates/non-free amd64 Packages [1,596 B]
Get:11 http://ftp.sk.debian.org/debian stretch/contrib Sources [44.7 kB]
Get:12 http://ftp.sk.debian.org/debian stretch/non-free Sources [79.4 kB]
Get:13 http://ftp.sk.debian.org/debian stretch/main amd64 Packages [7,086 kB]
Get:14 http://ftp.sk.debian.org/debian stretch/main Translation-en [5,385 kB]
Get:15 http://ftp.sk.debian.org/debian stretch/non-free amd64 Packages [78.3 kB]
Get:16 http://ftp.sk.debian.org/debian stretch/non-free Translation-en [80.3 kB]
Get:17 http://ftp.sk.debian.org/debian stretch/contrib amd64 Packages [50.9 kB]
Fetched 20.7 MB in 6s (3,284 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
83 packages can be upgraded. Run 'apt list --upgradable' to see them.
5. Tu mi vyhodí, čo bude upgradovať (len časť vypíšem)
root@guliverkel:/home/martin# apt list --upgradable
Listing... Done
base-files/oldstable 9.9+deb9u11 amd64 [upgradable from: 9.9+deb9u9]
debian-archive-keyring/oldstable 2017.5+deb9u1 all [upgradable from: 2017.5]
e2fslibs/oldstable 1.43.4-2+deb9u1 amd64 [upgradable from: 1.43.4-2]
e2fsprogs/oldstable 1.43.4-2+deb9u1 amd64 [upgradable from: 1.43.4-2]
6. spustím upgrade balíčkov:
root@guliverkel:/home/martin# apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following NEW packages will be installed:
83 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
Need to get 176 MB of archives.
After this operation, 244 MB of additional disk space will be used.
7. spustím apt dist-upgrade
root@guliverkel:/home/martin# apt dist-upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
root@guliverkel:/home/martin#
8. Keďže sa natiahli aj nejaké nové manuály, updatujem aj tie pomocou príkazu catman
catman - update man stránok(niečo z catmanu)
root@guliverkel:/home/martin# catman
Updating cat files for section 1 of man hierarchy /usr/share/man
2to3-2.7, 2to3-3.5, 7z, 7za, 7zr, Xorg.wrap, acpi_available, add-apt-repository, apm_available, appres, appstreamcli, apropos, apt-extracttemplates, apt-ftparchive, apt-listchanges, apt-sortpkgs, ar, arch, ark, asn1parse, aspell,
9. rebootujem operačný systém (reboot and pray)
init 610. zistím, či sa nezmenil grub, verziu OS a jadra:
root@guliverkel:/home/martin# cat /etc/*release
PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
NAME="Debian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
VERSION_CODENAME=stretch
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
root@guliverkel:/home/martin# uname -r
4.9.0-8-amd64
root@guliverkel:/home/martin# uptime -s
2019-12-17 08:22:25
Miesto:
Košice, Slovakia
nedeľa 15. decembra 2019
sudo rm -rf /
Dosť často sa stretnete s vtipom sudo rm -rf /
Čo to vlastne je? Pokúsme sa to rozanalyzovať:
rm je príkaz na mazanie súborov:
máme tu súbor Zaira.txt
martin@guliverkel:~$ ls -lh Zaira.txt
-rw-r--r-- 1 martin martin 1.9K Dec 15 20:42 Zaira.txt
Vymazali sme súbor Zaira.txt
martin@guliverkel:~$ rm Zaira.txt
martin@guliverkel:~$ ls -lh Zaira.txt
ls: cannot access 'Zaira.txt': No such file or directory
rm má prepínač -i ako interactive: bude sa vás pýtať: ako vidíte tu:
martin@guliverkel:~$ rm -i Diego_kokain.txt
rm: remove regular file 'Diego_kokain.txt'? y
martin@guliverkel:~$ ls -lh Diego_kokain.txt
ls: cannot access 'Diego_kokain.txt': No such file or directory
(Na RHEL distribúciach RHEL, CentOS, Fedora, Oracle Linux je rovno v aliasoch zabudované to, aby sa vás pýtalo, či chcete skutočne zmazať. Veď dajte na tých distribúciach príkaz alias)
potom tu máme prepínač rm -r
Ako teda mažeme adresáre? (na prázdne adresáre používame príkaz rmdir) Príklad:
martin@guliverkel:~$ mkdir sexi_kocky
martin@guliverkel:~$ rmdir sexi_kocky/
Vytvorme si ale adresár a dajme tam súbory: (a pozrime sa na príkaz rmdir teraz)
martin@guliverkel:~$ mkdir sexi_divoke_kocky
martin@guliverkel:~$ touch sexi_divoke_kocky/Diego_Kokain.drg
martin@guliverkel:~$ touch sexi_divoke_kocky/Zaira.txt
martin@guliverkel:~$ touch sexi_divoke_kocky/RobertF.avi
martin@guliverkel:~$ touch sexi_divoke_kocky/xxx_VladkoM_rozdelenieRepubliky.fin
martin@guliverkel:~$ rmdir sexi_divoke_kocky/
rmdir: failed to remove 'sexi_divoke_kocky/': Directory not empty
V takom prípade vyskúšam príkaz rm -r s tým, že -r znemaná rekurzívne. (Zmaže všetko, čo sa nachádza, teda, adresár, ba aj súbory v ňom. Aj Diegovu kokainovu minulosť. Na tomto systéme.) Pozrime sa na to:
martin@guliverkel:~$ rm -r sexi_divoke_kocky/
martin@guliverkel:~$ ls -lh sexi_kocky/
ls: cannot access 'sexi_kocky/': No such file or directory
rm -rf spraví to, že zmaže všetko rekurzívne (r). prepínač f znamená force, tj. nepýta sa a spraví to. Pozrime sa:
martin@guliverkel:~$ mkdir futbalisti
martin@guliverkel:~$ touch futbalisti/crespo
martin@guliverkel:~$ touch futbalisti/sevcenko
martin@guliverkel:~$ touch futbalisti/Pali
martin@guliverkel:~$ touch futbalisti/Mudra
martin@guliverkel:~$ rm -rf futbalisti/
martin@guliverkel:~$ ls -lh futb*
ls: cannot access 'futb*': No such file or directory
V linuxe sa koreňové adresáre určujú týmto znakom /
To je najvyššia možná úroveň. Pokiaľ by sme ako obyčajný užívateľ dali rm -rf /, zmažeme svoj domáci adresár. (Vyššie nemáme práva zápisu.)
Pokiaľ ako root (alebo s pomocou sudo ako bežný užívateľ) vykonáme túto činnosť, zmažeme si celý systém.
Preto pre lásku Božiu, nikdy nepíšte sudo rm -rf / - zmažete si celý koreňový adresár.
PS: Zbytok článku som dopísal z telefónu, pretože som vykonal tento príkaz a čaká ma tak inštalácia Linuxu. (Veď si všimnite lokalitu, kde som to písal.)
Čo to vlastne je? Pokúsme sa to rozanalyzovať:
rm je príkaz na mazanie súborov:
máme tu súbor Zaira.txt
martin@guliverkel:~$ ls -lh Zaira.txt
-rw-r--r-- 1 martin martin 1.9K Dec 15 20:42 Zaira.txt
Vymazali sme súbor Zaira.txt
martin@guliverkel:~$ rm Zaira.txt
martin@guliverkel:~$ ls -lh Zaira.txt
ls: cannot access 'Zaira.txt': No such file or directory
rm má prepínač -i ako interactive: bude sa vás pýtať: ako vidíte tu:
martin@guliverkel:~$ rm -i Diego_kokain.txt
rm: remove regular file 'Diego_kokain.txt'? y
martin@guliverkel:~$ ls -lh Diego_kokain.txt
ls: cannot access 'Diego_kokain.txt': No such file or directory
(Na RHEL distribúciach RHEL, CentOS, Fedora, Oracle Linux je rovno v aliasoch zabudované to, aby sa vás pýtalo, či chcete skutočne zmazať. Veď dajte na tých distribúciach príkaz alias)
potom tu máme prepínač rm -r
Ako teda mažeme adresáre? (na prázdne adresáre používame príkaz rmdir) Príklad:
martin@guliverkel:~$ mkdir sexi_kocky
martin@guliverkel:~$ rmdir sexi_kocky/
Vytvorme si ale adresár a dajme tam súbory: (a pozrime sa na príkaz rmdir teraz)
martin@guliverkel:~$ mkdir sexi_divoke_kocky
martin@guliverkel:~$ touch sexi_divoke_kocky/Diego_Kokain.drg
martin@guliverkel:~$ touch sexi_divoke_kocky/Zaira.txt
martin@guliverkel:~$ touch sexi_divoke_kocky/RobertF.avi
martin@guliverkel:~$ touch sexi_divoke_kocky/xxx_VladkoM_rozdelenieRepubliky.fin
martin@guliverkel:~$ rmdir sexi_divoke_kocky/
rmdir: failed to remove 'sexi_divoke_kocky/': Directory not empty
V takom prípade vyskúšam príkaz rm -r s tým, že -r znemaná rekurzívne. (Zmaže všetko, čo sa nachádza, teda, adresár, ba aj súbory v ňom. Aj Diegovu kokainovu minulosť. Na tomto systéme.) Pozrime sa na to:
martin@guliverkel:~$ rm -r sexi_divoke_kocky/
martin@guliverkel:~$ ls -lh sexi_kocky/
ls: cannot access 'sexi_kocky/': No such file or directory
rm -rf spraví to, že zmaže všetko rekurzívne (r). prepínač f znamená force, tj. nepýta sa a spraví to. Pozrime sa:
martin@guliverkel:~$ mkdir futbalisti
martin@guliverkel:~$ touch futbalisti/crespo
martin@guliverkel:~$ touch futbalisti/sevcenko
martin@guliverkel:~$ touch futbalisti/Pali
martin@guliverkel:~$ touch futbalisti/Mudra
martin@guliverkel:~$ rm -rf futbalisti/
martin@guliverkel:~$ ls -lh futb*
ls: cannot access 'futb*': No such file or directory
V linuxe sa koreňové adresáre určujú týmto znakom /
To je najvyššia možná úroveň. Pokiaľ by sme ako obyčajný užívateľ dali rm -rf /, zmažeme svoj domáci adresár. (Vyššie nemáme práva zápisu.)
Pokiaľ ako root (alebo s pomocou sudo ako bežný užívateľ) vykonáme túto činnosť, zmažeme si celý systém.
Preto pre lásku Božiu, nikdy nepíšte sudo rm -rf / - zmažete si celý koreňový adresár.
PS: Zbytok článku som dopísal z telefónu, pretože som vykonal tento príkaz a čaká ma tak inštalácia Linuxu. (Veď si všimnite lokalitu, kde som to písal.)
Prihlásiť na odber:
Príspevky (Atom)


