Some notes on the EX200 exam.
makewhatis
is gone, use mandb
.-h -x -? --help
>
Redirect output, target is truncated before writing starts.»
Redirect output, append to target.|
Connect standard output to standard input (a pipe).2>
redirect stderr.#
or empty space: grep ^[^#] file
grep -F <string> <file> #or fgrep
grep -v
.~/.ssh/config
.ssh -vvv <host>
.ssh -L8080:host:80 host
.ssh -X <host
.sudo -i
or sudo su -
.visudo
or add to /etc/sudoers.d/
.su -s /bin/bash user
.c
.v
.f
.z
.j
.gzip <file>
, gunzip <file>
.vi
or vim
.echo “hi” > filename
.touch
.rm file
.-f
.-r
.cp source destination
.-p
.-r
.mv source destination
ln target link-name
.ln -s target link-name
.ls -i
.ls -l
or stat file
.chmod 755
or chmod o+rw
etc.chown user:group target
.man command
.man -k command
.man -K text
.info command
./usr/share/doc
directories.reboot
or shutdown -r now
or systemctl isolate reboot.target
shutdown -h now
or systemctl isolate poweroff.target
.systemctl get-default
or ls -lh /etc/systemd/system/default.target
systemctl list-units --type target --all
systemctl rescue
.systemctl emergency
single
. Boot the system.# press 'e' in the grub menu, # change add: rd.break enforcing=0 # press ctrl-x mount -o remount,rw /sysroot chroot /sysroot passwd root touch /.autorelabel mount -o remount,ro / exit exit
top
.nice command -n <number -20 - 19>
and renice -n <priority> <PID>
. A higher number is more nice. ps -efl
.journalctl
.-f
.-x
.journalctl /usr/sbin/sshd
.virsh console <vm>
.virsh stop <vm>
.virsh start <vm>
.nmcli c show
nmcli c up eth0
nmcli c down eth0
nmcli c edit eth0
scp <file> <target-host>
fdisk -l /dev/vda
or fdisk /dev/vda
fdisk
or parted
pvcreate /dev/vda2
.vgextend <VGname> <PhysicalDevicePath>
.lvcreate -L 5GB -n <lvname> <vgname>
.lvremove /dev/<vgname>/<lvname>
.blkid
.UUID=7c2eaf53-ae5b-4b81-a539-b5f5d34c60c5 /boot xfs defaults,noatime 0 0
e2label /dev/mapper/testV testlv
/etc/fstab
use: LABEL=testlv
as device.partx -a /dev/vdc
.partprobe
.mkswap /dev/vdc1
.swapon -v /dev/vdc1
.swapon -s
.dd if=/dev/zero of=/var/tmp/swapfile1 bs=1024 count=524288
.chown root:root /var/tmp/swapfile1
chmod 0600 /var/tmp/swapfile1
.mkswap /var/tmp/swapfile1
.swapon /var/tmp/swapfile1
.swapon -s
.mkfs.<fstype>
.mount -t <vfstype> <device> <directory>
.showmount -e
.mount <server>:mountoint <directory>
.smbclient -L diskstation -U user
.mount -t cifs //server/share /mnt -o user=username
pvs
, vgs
lvresize -r -l+100%FREE <lvname>
.chmod g+s /data/team
.chmod g+w /data/team
.chmod +t /data/team
mount
. But ext4 is already acl aware.mount -o remount /var
ls -l
will show a plus sign next to the rwx modes.setfacl -m u:user:rw- <filename>
ls -l
, getfacl
, lsattr
.chmod
, chown
, setfacl
, chattr
.nmcli
/etc/hosts
.hostnamectl set-hostname <hostname>
./etc/crontab
and below directories /etc/cron.d
, /etc/cron.daily
, etc.min hour daymonth month dayweek(0=sun)
30 4 1,15 * 5
would cause a command to be run at 4:30 am on the 1st and 15th of each month, plus every Friday.systemctl list-unit-files --type service
systemctl start sshd.service
.systemctl stop sshd.service
.systemctl restart sshd.service
.systemctl enable sshd.service
.systemctl disable sshd.service
.systemctl list-units --type target --all
systemctl get-default #or ls -lh /etc/systemd/system/default.target
systemctl get-default multi-user.target
yum -y install httpd system-config-kickstart
./var/www/html/pub
ks=http://192.168.122.35/ks.cfg
yum groupinstall Virtualization “Virtualization Tools”
.virsh
or virt-manager
.virsh autostart <vm>
nmcli
above.yum-config-manager
rpm
or yum
./etc/default/grub
./etc/default/grub
.grub2-mkconfig -o /boot/grub2/grub.cfg
grub2-editenv list
grub2-set-default
useradd
.usermod
.userdel
.passwd
.chage
.chage -l <username>
.groupadd
.groupmod
.groupdel
.SSSd
or PAM-LDAP
.authconfig-tui
.firewall-cmd –get-active-zones
.firewall-cmd –zone public –list-all
.firewall-cmd –zone public –add-service httpd –permanent
.firewall-cmd –zone public –add-source 10.1.2.3 –permanent
.firewall-cmd –reload
.ssh-keygen -t <type>
.~/.ssh/authorized_keys
on remote server.setenforce 1
.setenforce 0
./etc/selinux/config
for permanent configuration.ls -lZ
.ps -efZ
.restorecon -Rv /var/www/html
.getsebool -a
.setsebool <boolean> <value>
, use -P
for permanent (at boot time)./var/log/audit/audit.log
.audit2allow
.