1.1-linux file system files and common command skills

Time:2021-6-18

 

Query Linux version information: cat / etc / CentOS release

Query memory: Free – H

Close GUI: init   three   Query memory 340m   The GUI consumes a lot of memory, and the GUI is closed in the production environment

 

Query local IP address:   ip a ;   ifconfig ;   hostname -I

Differentiated terminal: TTY

 

Query login user: who

 

 

Login user: W

 

Modify host name

 [[email protected]~]#

|– root   user name

|—[email protected]   Divider

|——-Centos8-3 host name

|———–~Home directory

|———–# represents administrator and $represents user

There are two modifications

 

 

echo ‘PS1=”\[\e[1; 40; 34m\][\[email protected]\h \W]\\$\[\e[0m\]”‘ > /etc/profile.d/env.sh   Save to file

Internal command shell provides and external command queries external command: which who

Internal command and external command query: type

Echo has both external and internal commands   Give priority to internal commands

echo $PATH   External command sequence

 /usr/local/sbin

/usr/local/bin

/usr/sbin

/usr/bin

/root/bin

Alias add alias

example:

 

 

 

alias scandisk=”echo ‘- – -‘ >/sys/class/scsi_host/host0/scan;echo ‘- – -‘ >/sys/class/scsi_host/host1/scan;echo ‘- – -‘ >/sys/class/scsi_host/host2/scan”

 

Command execution order: alias, internal, hash, external command, error ^ C

Save the alias file and download nano. After downloading, nano. Bashrc   Enter the alias formula to save

 

If the alias conflicts with other internal or external commands, you can use ‘or’

 

 

Full format   COMMAND   【 OPTIONS…..】【 ARGUMENTS….】