Three stages of learning Linux must go through
1.ADMIN (cloud computing system management)
2.ENGINEER (cloud computing application management)
3.SERVICES (system, service management advanced)
Yes, you are very good, believe in yourself, it doesn’t matter if you lose, as long as you are not defeated by failure! —Tuge
Directory summary
- Three stages of learning Linux must go through
- One.ADMIN (Cloud Computing System Management)
- Two.ENAINEER (Cloud Computing Application Management)
- Three.SERVICES (Advanced System Service Management)
- 3. Command line basis, directory file management, text content operation
- 4. Archive compression, redirection, pipeline, find precise search, advanced use of vim
- 5. RPM software package management, yum software warehouse, command supplement
- 6. User management, group account management, scheduled tasks
- Tell the important thing three times
One.ADMIN (Cloud Computing System Management)
Two.ENAINEER (Cloud Computing Application Management)
Three.SERVICES (Advanced System Service Management)
3. Command line basis, directory file management, text content operation
Command line basics
1. How to write commands
The execution of the command depends on the interpreter -> user ->
interpreter (program, default interpreter: /bin/bash) -> kernel -> hardware
which: Find the program corresponding to the command
2. The general format of the command line
3. The general format of the command line continued 1
4. Quick editing skills
TAB key auto completion
Command words, options, parameters, file paths, software names, service names can be completed
hot key
Ctrl+l:清空整个屏幕
Ctrl+u:清空至首行
Ctrl+w:往回删除一个单词
Ctrl+c:废弃当前命令的编辑行
Esc+.或者Alt+.:粘贴上一个命令的参数
Ctrl+a:光标到行首
Ctrl+e:光标到行尾
5. Mount
mount /dev/cdrom /mnt
unmount /mnt
装包须挂载
光盘中有软件包
将光盘撞到某个linux目录
6. Mount the disc or partition
7. Unmount the mounted CD
Directory file management
1. View and switch directories
ls lists documents and attributes
ls option directory file name
ls -l :长格式
ls -A :显示所有包括隐藏
ls -d :显示目录本身,不是目录属性
ls -h :易读容量单位
ls -R :递归显示内容
Use wildcards
Use special characters for uncertain document names
_* : 任意多个任意字符
_? : 单个字符
[a-z]:多个字符或连续范围中的一个无则忽略(显示a-z)
{a,min,xy}:多组不同的字符串,全匹配 (只显示大括号内)
Explanation: As shown below
Definition of alias
View aliases that have been set
alias [别名名称]
Define new alias
alias 名称=‘实际执行的命令’
Cancel alias
unalias [别名名称]
example:
[root@Tuge~]# alias bb='poweroff'
定义一个别名,输入bb执行关机操作
[root@Tuge~]# bb
执行关机操作
[root@Tuge~]# alias bb
alias bb=‘poweroff’
New document
mkdir -p [path] directory name...
解释:这里递归是啥意思呢,就是查看这个目录和这个目录以下
的所有子目录
创建隐藏目录或文件:
[root@Tuge~]# touch /opt/.b.txt
查看隐藏目录或文件:
[root@Tuge~]# ls -A /opt
2. Copy, delete, move
Copy cp
cp option source file destination path
Common command options: -r recursive (you must use this when copying directories)
example:
[root@C ~]# mkdir /opt/tuge
[root@C ~]# touch /opt/tuge/a.txt
[root@C ~]# cp -r /opt/tuge/a.txt /opt/
[root@C ~]# ls /opt/
a.txt rh tuge
[root@C ~]# ls /opt/tuge/
a.txt
[root@C ~]#
Remove rm
rm option file or directory
Common command options:
-r delete recursively (including directory)
-f force delete (no prompt y/n)
generally use two options together
example:
[root@C ~]# rm -r /opt/a.txt
rm:是否删除普通空文件 "/opt/a.txt"?y
[root@C ~]# ls /opt/
rh tuge
[root@C ~]# rm -rf /opt/tuge/a.txt
[root@C ~]# ls /opt/tuge/
[root@C ~]#
mv (movable, can be renamed)
mv option source file destination path
移动:
[root@C ~]# touch /opt/a.txt
[root@C ~]# touch /opt/tuge/b.txt
[root@C ~]# ls /opt/
a.txt rh tuge
[root@C ~]# ls /opt/tuge/
b.txt
[root@C ~]# mv /opt/a.txt /opt/tuge/
[root@C ~]# ls /opt/tuge/
a.txt b.txt
改名:
[root@C ~]# mv /opt/tuge/b.txt /opt/tuge/c.txt
[root@C ~]# ls /opt/tuge/
a.txt c.txt
Text content manipulation
1.vim text content editor
Use vim to create and modify files
vim 有三种模式(命令模式,插入模式,末行模式)
[root@C ~]# vim /opt/tuge/a.txt
[root@C ~]# cat /opt/tuge/a.txt
I am a programmer please call me Tuge thank you !
[root@C ~]#
2. File content filtering
Find text content
grep option'matching mode' common command options for text files:
-v negate
-i ignore case,
^: what begins with ^root
$ ends with bash$
-v ^$: do not empty lines
-v ^#: do not comment
例如:
[root@C ~]# grep -v ^$ /etc/passwd | grep -v ^#
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
.......
[root@C ~]#
Commonly used matching modes:
Commonly used wildcards
*:匹配任意李多个字符
?:匹配单个字符
[a-z]:多个字符或连续范围中的一个,若无则忽略。(显示a-z)
{a,b,c}:多组不同的字符串,全匹配。(只显示大括号内的)
注意:* ? [a-z] {a,b,c} 这类通配符不能用在grep。
可以用在其他地方,比如find(下节课会讲)
Expand
[root @Tuge ~]# date
查看日期
[root @Tuge ~]# date -s "2020-12-21 09:30"
修改系统时间
[root @Tuge ~]# hwclocl -s
重设系统时间
[root @Tuge ~]# cal
查看日历
[root @Tuge ~]# man ls
查询和解释ls这个命令怎么用
[root @Tuge ~]# locate test :
查看test这个词在哪里
[root @Tuge ~]# shutdown -t 1
一分钟后关机
4. Archive compression, redirection, pipeline, find precise search, advanced use of vim
To predict what will happen, please see the next breakdown!
5. RPM software package management, yum software warehouse, command supplement
6. User management, group account management, scheduled tasks
Tell the important thing three times
As a coder who has dedicated his life to Linux, I am very honored and proud. Here I have summarized some of the essence of Linux, that is, a quick article, which will be updated later, I hope you will pay attention to it. It is absolutely useful!