Basic tools - RHCSA

Description

RHCSA - BASIC TOOLS
Luiz  Eduardo
Mind Map by Luiz Eduardo, updated more than 1 year ago
Luiz  Eduardo
Created by Luiz Eduardo over 4 years ago
331
0

Resource summary

Basic tools - RHCSA
  1. basic linux tools
    1. Aceessing rhell
      1. #ssh 192.168.1.52
        1. #ssh -l user1 192.168.1.3
          1. #ssh -X 192.168.5.2
          2. listing directory
            1. #ls
              1. -la
                1. -lh
                  1. -ld
                    1. -R
                      1. -lt
                        1. -ltr
                      2. prrinting directory
                        1. #pwd
                        2. chaging directory
                          1. #cd
                            1. #cd ..
                              1. #cd -
                                1. #cd ~
                                  1. #cd /
                                  2. showing the terminal fille
                                    1. #tty
                                    2. Currently loggd-in users
                                      1. #who am i
                                        1. #who
                                          1. #logname
                                          2. inspect system's uptime
                                            1. #uptime
                                            2. Examinig user and group information
                                              1. #id
                                                1. #groups
                                                2. Viewing history falid login
                                                  1. #last
                                                    1. #lastb
                                                    2. viewing system information
                                                      1. #hostnamectl
                                                        1. #hostnamectl set-hostname host1.exemple.com
                                                      2. display setting system date and time
                                                        1. #timedatectl
                                                          1. #timedatectl set-tme 2029-08-12
                                                            1. #date
                                                              1. date --set "2019-11-25 11:15"
                                                                1. #timedatectl list-timezones
                                                                  1. #timedatectl set-timezone America/Sao_Paulo
                                                                  2. Display command path
                                                                    1. #which cat
                                                                    2. Couting words, lines, and characters
                                                                      1. #wc /etc/txt
                                                                        1. -l : lines
                                                                          1. -w: words
                                                                            1. -c: byte count
                                                                              1. -m : character count
                                                                            2. Listing pci, usb and cpu device information
                                                                              1. #lspci -m

                                                                                Annotations:

                                                                                • legible output informations about cpu, usb, and pci buses devices
                                                                                1. #lsusb
                                                                                  1. #lscpu
                                                                                    1. #lsmod
                                                                                    2. compression tools
                                                                                      1. #gzip /opt/anaconda.cfg /opt/initial.setup
                                                                                        1. #gunzip /opt/anaconda.cfg

                                                                                          Annotations:

                                                                                          • descompress
                                                                                          1. #gzip -d /opt/anaconda.cfg

                                                                                            Annotations:

                                                                                            • descompress
                                                                                            1. #bzip2 /opt/anaconda.cfg /opt/initial.setup

                                                                                              Annotations:

                                                                                              • compress .bz2
                                                                                              1. #bunzip2 /opt/anaconda.cfg
                                                                                                1. #bzip2 -d /opt/anaconda.cfg
                                                                                                  1. TAR
                                                                                                    1. #tar cvf /tmp/home.tar /home
                                                                                                      1. #tar cvf /tmp/files.tar /etc/host.conf /etc/passwd /etc/groups /etc/shadow
                                                                                                        1. #tar rvf /tmp/home.tar /etc/yum.repos.d

                                                                                                          Annotations:

                                                                                                          • append files to home.tar
                                                                                                          1. #tar tvf /tmp/home.tar
                                                                                                            1. #tar xvf /tmp/home.tar
                                                                                                              1. #tar cvj --selinux --xattrs -f /tmp/extattr.tar.bz2 /home
                                                                                                              2. STAR

                                                                                                                Annotations:

                                                                                                                • the star command is an enchanced version of tar. It also supports SElinux security contexts and extended files atributes; Options for reating listing, appending, updating and extracting tarballs are the same as the tar command's. This utility is not installed by default; however, we can install the star package to install it.
                                                                                                                1. # star cvf /tmp/etc.tar -xattr -H=exustar /etc

                                                                                                                  Annotations:

                                                                                                                  • to create a tarball /tmp/etc.tar containing the entire /etc directory with all extended file attributes and SElinux file contexts, run this command: 
                                                                                                                  1. #star tvf /tmp/etc.tar
                                                                                                                2. VI
                                                                                                                  1. commands

                                                                                                                    Annotations:

                                                                                                                    • i - insere dados no local atual I - insere dados no início da linha a - insere dados após o curso do mouse A - insere dados no final da linha h - mover para esquerda j - mover para baixo k - mover para cima l - mover para direita w - mover para o final da palavra b - mover para atrás de uma palavra e - move para última letra da palavra $ - move para o final da linha 0 - move para o início da linha ctrl + f - move para o final da página ]] - move para  última linha do documento [[ - move para a primeira linha do documento x - Deleta um carácter na posição atual do cursor X - deleta um carácter antes da posição atual do cursor u - desfazer alteração U - desfazer todas as operações / - procurar por string (início do texto) ?  - procurar por string (final do texto) n - encontrar a próxima ocorrência :%s/old/new - alterar palavra :%s/old/new/g - altera todas as palavras  yl - copia a linha atual yw - copia a linha dentro do buffer p - cola a linha P - cola a linha sobre as atuais :1,3co5  - copia a linha 1 e 3 sobre a linha 5 :4,6m8 - copia a linha 4 e 6 depois da linha 8 :w  - salvar  :w file2 - salvar com nome :w! - escrever alterações :wq! escrever alterações e sair forçado :q - sair sem salvar :q! sair forçado sem salvar
                                                                                                                  2. man

                                                                                                                    Annotations:

                                                                                                                    • Utilizado para obter ajuda e informações sobre um comando
                                                                                                                    1. #man passwd
                                                                                                                      1. #man 5 passwd
                                                                                                                        1. #/usr/share/doc
                                                                                                                        2. Comandos
                                                                                                                          1. #find
                                                                                                                            1. options
                                                                                                                              1. -perm
                                                                                                                                1. -perm -2000
                                                                                                                                2. -name / -iname
                                                                                                                                  1. -user / -group
                                                                                                                                    1. -inum

                                                                                                                                      Annotations:

                                                                                                                                      • inode
                                                                                                                                      1. -atime / -mtime / -ctime
                                                                                                                                        1. -size +40M / -type c/d/s
                                                                                                                                        2. actions
                                                                                                                                          1. -exec cmd {} \;
                                                                                                                                            1. -exec cp -r {} dir2 \;
                                                                                                                                              1. -delete {} \;
                                                                                                                                                1. -exec rm {} \;
                                                                                                                                              2. #awk
                                                                                                                                                1. #sed
                                                                                                                                                  1. #firewall-cmd
                                                                                                                                                  2. Control Attributes
                                                                                                                                                    1. #lsattr rh

                                                                                                                                                      Annotations:

                                                                                                                                                      • ---------------- ./rh
                                                                                                                                                      1. chattr
                                                                                                                                                        1. lsattr
                                                                                                                                                          1. #chattr +i rh

                                                                                                                                                            Annotations:

                                                                                                                                                            • O arquivo não poderá ser removido
                                                                                                                                                            1. #chattr +a rh

                                                                                                                                                              Annotations:

                                                                                                                                                              • O arquivo não poderá ser escrito
                                                                                                                                                            2. #chattr +ia rh
                                                                                                                                                            3. soft link
                                                                                                                                                              1. ln -s file1 file2

                                                                                                                                                                Annotations:

                                                                                                                                                                • [root@server1 opt]# ls -la file* -rw-r--r--. 1 root root 0 Nov 18 12:56 file1 lrwxrwxrwx. 1 root root 5 Nov 18 12:57 file2 -> file1
                                                                                                                                                              2. Hard link

                                                                                                                                                                Annotations:

                                                                                                                                                                • hard link associates one or more files with a single inode number
                                                                                                                                                                1. ln file1 file2
                                                                                                                                                                2. Access Permission
                                                                                                                                                                  1. Read | r ; Write | w ; Execute| x
                                                                                                                                                                    1. User | u ; Group| g ; Others | o
                                                                                                                                                                      1. Permission mode
                                                                                                                                                                        1. Add (+) | Remove (-) | Assign (=)
                                                                                                                                                                        2. x =1 | 2=w | 4=r
                                                                                                                                                                        3. systemctl
                                                                                                                                                                          1. #systemctl -t mount --all
                                                                                                                                                                            1. #systemctl poweroff | halt| reboot| hybrid-sleep
                                                                                                                                                                            2. Shutdown
                                                                                                                                                                              1. SET UP PASSWORD AGING ON USER ACCOUNTS
                                                                                                                                                                                1. #passwd -n 7 -x 28 -w 5 user1
                                                                                                                                                                                  1. -n

                                                                                                                                                                                    Annotations:

                                                                                                                                                                                    • --minimum=DAYS tempo mínimo de vida útil da senha (somente root)
                                                                                                                                                                                    1. -x

                                                                                                                                                                                      Annotations:

                                                                                                                                                                                      • -x, --maximum=DAYS tempo máximo de vida útil da senha (somente root)
                                                                                                                                                                                      1. -w

                                                                                                                                                                                        Annotations:

                                                                                                                                                                                        • --warning=DAYS número de dias para avisar o usuário antes da
                                                                                                                                                                                        1. -l

                                                                                                                                                                                          Annotations:

                                                                                                                                                                                          • --lock Bloqueando a senha para a conta escolhida ( somente para o root )
                                                                                                                                                                                          1. -u

                                                                                                                                                                                            Annotations:

                                                                                                                                                                                            • --unlock Desbloqueando a senha para a conta escolhida (
                                                                                                                                                                                            1. -S

                                                                                                                                                                                              Annotations:

                                                                                                                                                                                              • --status reportar status da senha na conta mencionada
                                                                                                                                                                                              1. -i

                                                                                                                                                                                                Annotations:

                                                                                                                                                                                                • i, --inactive=DAYS número de dias após a expiração da senha para
                                                                                                                                                                                              2. #chage -l user1
                                                                                                                                                                                                1. -E

                                                                                                                                                                                                  Annotations:

                                                                                                                                                                                                  • --expiredate DATA_EXPIRAÇÃO define data de expiração de conta para
                                                                                                                                                                                                  1. -d

                                                                                                                                                                                                    Annotations:

                                                                                                                                                                                                    • --lastday ULTIMO_DIA define última mudança de senha para ULTIMO_DIA
                                                                                                                                                                                                    1. -l

                                                                                                                                                                                                      Annotations:

                                                                                                                                                                                                      • --list exibe informação sobre idade da conta
                                                                                                                                                                                                      1. -W

                                                                                                                                                                                                        Annotations:

                                                                                                                                                                                                        • --warndays DIAS_AVISO definir para DIAS_AVISO o número de dias
                                                                                                                                                                                                        1. -m

                                                                                                                                                                                                          Annotations:

                                                                                                                                                                                                          • --mindays MIN_DIAS define número mínimo de dias antes da
                                                                                                                                                                                                          1. -M

                                                                                                                                                                                                            Annotations:

                                                                                                                                                                                                            • --maxdays MAX_DAYS set maximum number of days before password
                                                                                                                                                                                                          2. #visudo
                                                                                                                                                                                                            1. %dba

                                                                                                                                                                                                              Annotations:

                                                                                                                                                                                                              • group
                                                                                                                                                                                                              1. user1

                                                                                                                                                                                                                Annotations:

                                                                                                                                                                                                                • user
                                                                                                                                                                                                              2. GROUP ACCOUNTS
                                                                                                                                                                                                                1. #groupmod
                                                                                                                                                                                                                  1. #groupdel
                                                                                                                                                                                                                    1. #groupadd
                                                                                                                                                                                                                      1. -n

                                                                                                                                                                                                                        Annotations:

                                                                                                                                                                                                                        • nome
                                                                                                                                                                                                                        1. -g

                                                                                                                                                                                                                          Annotations:

                                                                                                                                                                                                                          •   -g, --gid GID usa GID para o novo grupo
                                                                                                                                                                                                                          1. -o

                                                                                                                                                                                                                            Annotations:

                                                                                                                                                                                                                            • -o, --non-unique permite criar grupos com GID duplicado
                                                                                                                                                                                                                            1. #groupadd -g 5 linuxadm
                                                                                                                                                                                                                              1. #groupadd -o -g 5 dbaadm
                                                                                                                                                                                                                            2. #gpasswd
                                                                                                                                                                                                                              1. -a

                                                                                                                                                                                                                                Annotations:

                                                                                                                                                                                                                                •   -a, --add USUÁRIO adiciona o USUÁRIO ao GRUPO
                                                                                                                                                                                                                                1. # gpasswd -a user1 dba
                                                                                                                                                                                                                                2. -d

                                                                                                                                                                                                                                  Annotations:

                                                                                                                                                                                                                                  •   -d, --delete USUÁRIO remove USUÁRIO do GRUPO
                                                                                                                                                                                                                                  1. # gpasswd -d user1 dba
                                                                                                                                                                                                                                  2. -A

                                                                                                                                                                                                                                    Annotations:

                                                                                                                                                                                                                                    •   -A, --administrators ADMIN,...
                                                                                                                                                                                                                                    1. # gpasswd -A user1 dba
                                                                                                                                                                                                                                  3. # newgrp adm

                                                                                                                                                                                                                                    Annotations:

                                                                                                                                                                                                                                    • altera o grupo primário newgrp (1) - log in to a new group newgrp (1p) - change to a new group
                                                                                                                                                                                                                                Show full summary Hide full summary

                                                                                                                                                                                                                                Similar

                                                                                                                                                                                                                                U.S. Naturalization Test
                                                                                                                                                                                                                                Jaffar Barjan
                                                                                                                                                                                                                                Analysing Text
                                                                                                                                                                                                                                amberbob27
                                                                                                                                                                                                                                Religious Language
                                                                                                                                                                                                                                michellelung2008
                                                                                                                                                                                                                                GCSE Computing : OCR Computing Course Revision
                                                                                                                                                                                                                                RoryOMoore
                                                                                                                                                                                                                                B1.1.1 Diet and Exercise Flash Cards
                                                                                                                                                                                                                                Tom.Snow
                                                                                                                                                                                                                                AS Sociology - Education Theories
                                                                                                                                                                                                                                HannahLB
                                                                                                                                                                                                                                The Berlin Crisis 1961 - Cause and Consequence
                                                                                                                                                                                                                                n.mcdonald
                                                                                                                                                                                                                                Treaty of Versailles (1919)
                                                                                                                                                                                                                                Inez Simpson
                                                                                                                                                                                                                                Dr Jekyll and Mr Hyde THEMES
                                                                                                                                                                                                                                deanakentish
                                                                                                                                                                                                                                Comparative Study
                                                                                                                                                                                                                                Vitor_Cruz
                                                                                                                                                                                                                                Unit 1 Chapter 1 Items
                                                                                                                                                                                                                                Gene G. Dydasco