LINUX COMMAND
centos 7
tab tab <^>
terminal shortcut: ctrlshift+n ctrl- ctrlshift+
EDITOR:vim vi nano emacs GHOME’s gedit
gedit a.txt
vim shortcut hotkey:
i esc V/ :
aio AIO x X u r
:w :w! :q :q! :qa :x :wq :wq! :set nu
:!ifconfig
:!ifconfig ens33
:r /etc/hosts
:1,3 s/bin/xuegod
:1,3 s/bin/xuegod/g
:3 s/bin/xuegod
:% s/bin/xuegod
:% s/bin/xuegod/g
:% s/bin/xuegod/gi ignore Aa case
:% s@a@b@g change a to b
:set nu
:set nonu
:set ic ignore case
:set noic
:set list
:set ai auto wrap indent
:noh
set vim forever
vim /etc/vimrc all users set
`/.vimrc only one user, none built one
vim .viminfo
vim .vimrc
set nu
vim /etc/passwd /etc/hosts
vim -o /etc/passwd /etc/hosts vim open more files at the same time
:qa
vim -O /etc/passwd /etc/hosts vim open more files at the same time
ctrl w
ctrl ww
:qa
diff /etc/passwd /etc/passwd2
vimdiff /etc/passwd /etc/passwd2
cursor positioning:
hjkl
0 HOME $ END
gg G
5gg 3gg 15gg
/string n N :noh
y yy 2yy
dd 3dd
p
x
D
u
ctrl r
help:
man date
/mtime
date -h
date --help
check ip address:
ifconfig
ifconfig enp2s0
change ip address tempory:
ifconfig enp2s0 192.168.124.188
ifconfig enp2s0 192.168.124.188 netmask 255.255.255.0
add multiple tempory ip:
ifconfig enp2s0:0 first ip address (netmask 255.)
ifconfig enp2s0:1 second ip address (netmask 255)
delete ip:
ifconfig enp2s0:0 del 192.168.124.166
change ip address forever:
nmtui
vim /etc/sysconfig/network-scripts/ifcfg-enp2s0
restart network:
systemctl restart network (centos7)
service network restart (centos6 7)
NetworkManager (before centos 7.0, network):
systemctl status
systemctl status NetworkManager
Network config file:
ls /etc/sysconfig/network-scripts/
ls /etc/resolv.conf (dns configfile)
cat !$
cat /etc/hosts (set pc name and ip)
cat /etc/hostname (set pc name)
close firewall:
systemctl status firewalld
systemctl status firewalld.service
start
systemctl stop firewalld.service
disable
enable
close Selinux forever or tempory:
getenforce
setenforce 0
vim /etc/selinux/config
reboot
systemctl stop network
CDROM auto on:
vim /etc/fstab
/dev/cdrom /mnt iso9660 defaults 0 0
echo “/dev/sr0 /media iso9660 defaults 0 0” >> /etc/fstab
config loca YUM :
cd /etc/yum.repos.d/
ls
yum clean all
yum list
yum install -y httpd
check users:
who am i
users
check centos version:
cat /proc/version
cat /etc/issue cat /etc/redhat-release
check hardware info:
dmidecode
Terminal:
GHOME Terminal , xshell,CRT
tty
ctrl shift n
echo xuegod > /dev/pts/0 1
shutdown +10
shutdown -c
wall “this pc will be shutdown in 10 mins.”
SHELL:
internal command
external command
type cat ls pwd
$ shell prompt
BASH SHELL:
cat /etc/shells
/bin/sh
/bin/bash
/usr/bin/sh
/usr/bin/bash
/bin/tcsh
/bin/csh
BASIC COMMAND:
ls option parameter
alias vimen33=“vim /etc/sysconfig/network-scripts/ifcfg-ens33”
unalias vimen33
alias forever: root
vim /root/.bashrc
+
alias vimen33=“vim /etc/sysconfig/network-scripts/ifcfg-ens33”
source /root/.bashrc
alias foreverybody: root
vim /etc/bashrc
end
alias vimen33=“vim /etc/sysconfig/network-scripts/ifcfg-ens33”
cd change directory
cd directory
cd ~
cd -
cd …
cd.
pwd
history:
history
<^>
ctrl r
!168
!syst
LINUX SHORTCUT HOTKEY:
^C ^D ^L A E U K R
tab
!$
SYSTEM TIME:
hwclock
date
time
date -s “2023-9-12 21:15”
date “+%Y%m%d”
date “+%Y–%m–%d”
POWER ON OFF command & 7 start sequence
shutdown
init 0-6
reboot
poweroff
shutdown -h +10
shutdown -h 23:30
shutdown -h now
shutdown -r 23:31
init 0
init 3 ctrl alt F2-F6
init 5 ctrl alt F1
runlevel
(set default run interface )
systemctl set-default multi-user.target
systemctl set-default graphical.target
set service power on when electric on:
enter bios, press DELETE or F2 F1
Integrated Peripharals SuperIO Device
Restore On AC Power Loss --> Power On
set service power on on time:
enter bios,
Power Management Setup
Wake UP Event Setup
Resume By RTC Alarm
Date : EVERY DAY
HH:MM:SS 23:45:00
File Management XFS files backup
cat /proc/cpuinfo
touch mkdir mv vi rm rmdir cp cd
touch a.txt
touch file{6…20}
touch -d ‘20181019 21:30’ a.txt
vim a.txt
echo aaa>a.txt
mkdir dir1
mkdir dir2 dir3 /home/dir4
mkdir -p /a/b/c
rm -rf
cp afile/dir bfile/dir
cp -R/r
mv a.txt dir1/
mv a.txt dir1/a.txt
cat /etc/passwd
more /etc/passwd SPACE ENTER Q
less /etc/passwd PageUp PageDown SPACE ENTER Q
head /etc/passwd
head -n 3 /etc/passwd
tail /var/log/secure
tail -n 3 /var/log/secure
tail -f /var/log/secure
ssh
ssh 192.168.124.9
ssh root@192.168.124.9 22 7890
ssh -p 22 root@192.168.124.9 7890
yes
ft170526
vim
which vim
ls /usr/bin/vim
rpm -qf /usr/bin/vim
rpm -qf which vim
rpm -qf which vi
gb2312 -->utf-8
1linux install Chinese pack
iconv -f gb2312 -t utf8 win7a.txt
iconv -f gb2312 -t utf8 win7a.txt -o aa.txt
Linux files donwload to Win10 , wrap proble
rpm -ivh /mnt/Packages/dos2unix-6.0.3-7.el7.X86_64.rpm
dos2unix
unix2dos
unix2dos b.sh
echo $?
0
rm -Rf /
rm -Rf /*
windows recovery file soft: final data v2.0 easyrecovery
OPEN SOURCE WEBSITE:
github.com
sourceforege.net
fdisk /dev/sda
p
install cp
gnome-terminal GUI windows
install soft:
yum grouplist
yum -y groupinstall “KDE Plasma Workspaces”
user & group
useradd
userdel
usermod
/etc/passwd
groupadd
groupdel
groupmod
gpasswd
DISK MANAGE
1partition
fdisk -l
fdisk /dev/sda1
2format
3mount
4transmit data
netstat -tnlp
netstat -tunlp
curl -I www.taobao.com
uname -a
cat /etc/os-release
typora markdown syntax grammer:
echo ‘hello’
echo “hello”
FILE EXTENSION suffixes
.gz .bz2 .zip .tar.gz .tar.bz2
.rpm
.sh .py .java
.html .jpg .js .css
ls /dev/sd*
bash a.sh
yum install tree -y
alias
alias rm=‘rm’
tar -cvf name.tar 1 2 3 4
tar -tf name.tar
tar -xf name.tar
whereis nginx