The most complete in the whole network, a complete collection of Linux system commands necessary for testing, a summary...


foreword

1. Directory operation

pwd:显示当前工作目录
clear:清除屏幕
cd ~:当前用户目录
cd /:根目录
cd -:上一次访问的目录
cd ..:上一级目录

ctrl+r: the command searched in the history (enter any character in the command)

View information in the directory

ll 查看当前目录下内容
ls 查看当前目录的相信内容内容

Create a directory

mkdir aaa 在当前目录下创建一个名为aaa的目录
mkdir /usr/aaa 在指定目录下创建一个名为aaa的目录

search command

find / -name 'b' 查询根目录下(包括子目录),名以b的目录和文件;
find / -name 'b*' 查询根目录下(包括子目录),名以b开头的目录和文件;

double naming

mv 原先目录 文件的名称 mv test001 test
剪切命令

mv /aaa /bb 将根目录下的aaa目录,移动到bbb目录下
mv bbbb usr/bbb 将当前目录下的bbbb目录,移动到usr目录下,并且修改名称为bbb;
mv bbb usr/aaa 将当前目录下的bbbb目录,移动到usr目录下,并且修改名称为aaa;

copy directory

cp /usr/tmp/aaa /usr 将/usr/tmp目录下的aaa目录复制到 /usr目录下面

delete directory

rm -r /bbb 普通删除,询问你是否删除每一个文件
rm -rf /bbb 强制删除/目录下的bbb目录。如果bbb目录中还有子目录,也会被强制删除,不会提示;

2. File operation

Delete Files

rm -r a.java 删除当前目录下的a.java文件
rm -rf a.java 强制删除当前目录下的a.java文件
rm -rf ./a* 强制删除当前目录下以a开头的所有文件;
rm -rf ./* 强制删除当前目录下所有文件(慎用);
rm –f *.txt 强迫删除所有以后缀名为txt文件

Create a file: touch test

Modify file vi/vim mode:

命令模式(常规模式)
vim启动后,默认进入命令模式,任何模式都可以通过esc键回到命令模式(可以多按几次),命令模式下可以键入不同的命令完成选择、复制、粘贴、撤销等操作。
命名模式常用命令如下:
i : 在光标前插入文本;
o:在当前行的下面插入新行;
dd:删除整行;
yy:将当前行的内容放入缓冲区(复制当前行)
n+yy :将n行的内容放入缓冲区(复制n行)
p:将缓冲区中的文本放入光标后(粘贴)
u:撤销上一个操作
r:替换当前字符
/ 查找关键字

(2)插入模式
在命令模式下按 " i "键,即可进入插入模式,在插入模式可以输入编辑文本内容,使用esc键可以返回命令模式。

(3)ex模式
在命令模式中按" : "键可以进入ex模式,光标会移动到底部,在这里可以保存修改或退出vim.
ext模式常用命令如下:
:w :保存当前的修改
:q :退出
:q! :强制退出,保存修改
:x  :保存并退出,相当于:wq
:set number 显示行号
:! 系统命令  执行一个系统命令并显示结果
:sh :切换到命令行,使用ctrl+d切换回vim
输出查看命令
echo:显示输入的内容  追加文件echo "liuyazhuang" >> liuyazhuang.txt
cat:显示文件内容,也可以将数个文件合并成一个文件。
格式:格式:cat[参数]<文件名>
cat  test.txt:显示test.txt文件内容
cat  test.txt | more  :逐页显示test.txt文件中的内容
cat  test.txt >> test1.txt :将test.txt的内容附加到test1.txt文件之后
cat  test.txt test2.txt >readme.txt : 将test.txt和test2.txt文件合并成readme.txt 文件
head:显示文件的头几行(默认10行) -n:指定显示的行数格式:head -n 文件名
tail:显示文件的末尾几行(默认10行)-n:指定显示的行数   -f:追踪显示文件更新 (一般用于查看日志,命令不会退出,而是持续显示新加入的内容)
格式:格式:tail[参数]<文件名>
tail-10 /etc/passwd :显示/etc/passwd/文件的倒数10行内容
tail+10 /etc/passwd :显示/etc/passwd/文件从第10行开始到末尾的内容
more:用于翻页显示文件内容(只能向下翻页)
more命令是一般用于要显示的内容会超过一个画面长度的情况。为了避免画  面显示时瞬间就闪过去,用户可以使用more命令,让画面在显示满一页时暂停,此时可按空格健继续显示下一个画面,或按Q键停止显示。
ls  -al  |more:以长格形式显示etc目录下的文件列表,显示满一个画面便暂停,可 按空格键继续显示下一画面,或按Q键跳离
less:翻页显示文件内容(带上下翻页)按下上键分页,按q退出、‘
less命令的用法与more命令类似,也可以用来浏览超过一页的文件。所不同  的是less 命令除了可以按空格键向下显示文件外,还可以利用上下键来卷动文件。当要结束浏览时,只要在less命令的提示符“:”下按Q键即可。
ls  -al | less:以长格形式列出/etc目录中所有的内容。用户可按上下键浏览或按Q键跳离

3. Hard links and soft links
Create soft links

ln -s test.txt link_1     --类似于test.txt 弄个快捷方式link_1

ln -sf test.txt link_2:  已存软链接,则强制替换(建议使用前备份源文件,以防出错,弄丢源文件)

ln -sv /opt/test1 /opt//test2  -- 目录软链接

create hard link

ln  real.txt link_2  --链接文件修改,会影响源文件

Fourth, compression and decompression
Compression

tar -cvf start.tar a.java b.java //将当前目录下a.java、b.java打包
tar -cvf start.tar ./* //将当前目录下的所欲文件打包压缩成haha.tar文件
tar -zcvf start.tar.gz a.java b.java //将当前目录下a.java、b.java打包
tar -zcvf start.tar.gz ./* //将当前目录下的所欲文件打包压缩成start.tar.gz文件

unzip

tar -xvf start.tar //解压start.tar压缩包,到当前文件夹下;
tar -xvf start.tar -C usr/local //解压start.tar压缩包,到/usr/local目录下;

tar -zxvf start.tar.gz //解压start.tar.gz压缩包,到当前文件夹下;
tar -zxvf start.tar.gz -C usr/loca //解压start.tar.gz压缩包,到/usr/local目录下;

compressed (zip)

zip lib.zip tomcat.jar //将单个文件压缩(lib.zip)
zip -r lib.zip lib/ //将目录进行压缩(lib.zip)
zip -r lib.zip tomcat-embed.jar xml-aps.jar //将多个文件压缩为zip文件(lib.zip)

decompress (unzip)

unzip file1.zip //解压一个zip格式压缩包
unzip -d /usr/app/com.lydms.test.zip //将`test.zip`包,解压到指定目录下`/usr/app/`

5. Find the command
grep

ps -ef | grep sshd 查找指定ssh服务进程
ps -ef | grep sshd | grep -v grep 查找指定服务进程,排除gerp身
ps -ef | grep sshd -c 查找指定进程个数

find

find . -name "*.log" -ls 在当前目录查找以.log结尾的文件,并显示详细信息。
find /root/ -perm 600 查找/root/目录下权限为600的文件
find . -type f -name "*.log" 查找当目录,以.log结尾的普通文件
find . -type d | sort 查找当前所有目录并排序
find . -size +100M 查找当前目录大于100M的文件

find . -name *liuyazhuang* 查找当前目录下名称中含有"liuyazhuang"的文件

find / -perm 777 查找所有权限是777的文件

locate: Quickly find files and folders: locate keyword

6. Common commands of yum

yum install iptables-services 下载并安装iptables
yum list 列出当前系统中安装的所有包
yum search package_name 在rpm仓库中搜寻软件包
yum update package_name.rpm 更新当前系统中所有安装的rpm包
yum update package_name 更新一个rpm包
yum remove package_name 删除一个rpm包
yum clean all 删除所有缓存的包和头文件

7. System service

service iptables status 查看iptables服务的状态
service iptables start 开启iptables服务
service iptables stop 停止iptables服务
service iptables restart 重启iptables服务
chkconfig iptables off 关闭iptables服务的开机自启动
chkconfig iptables on 开启iptables服务的开机自启动

8. User management

su - 用户名 切换用户,并且切换目录
exit 退出当前登录账户

Note: su does not accept the user name, you can switch to root, but it is not recommended because it is not safe

which

/etc/passwd 是用于保存用户信息的文件
/usr/bin/passwd 是用于修改用户密码的程序
which 命令可以查看执行命令所在位置,例如:
which ls
# 输出
# /bin/ls
which useradd
# 输出
# /usr/sbin/useradd

9. Other commands

查看进程:ps -ef
命令:ps -ef 查看所有正在运行的进程

结束进程:kill
命令:kill pid 或者 kill -9 pid(强制杀死进程) pid:进程号
网络通信命令:

ifconfig:查看网卡信息
命令:ifconfig 或 ifconfig | more

netstat -an:查看当前系统端口
命令:netstat -an

搜索指定端口
命令:netstat -an | grep 8080
配置网络

命令:setup
重启网络
命令:service network restart

关闭防火墙
命令:chkconfig iptables off
iptables -L;
iptables -F;
service iptables stop

修改文件权限
命令:chmod 777

清屏
命令:ctrl + l

du命令:du -lh
功能:查看某个目录中各级子目录所使用的硬盘空间数

free命令:free
功能:用于查看系统内存,虚拟内存(交换空间)的大小占用情况

df命令:df -lh
功能:用于查看文件系统的各个分区的占用情况

date:查看或设置当前系统的时间:格式化显示时间:+%Y--%m--%d;
date -s:设置当前系统的时间

uptime:查看系统运行时间
The following is the most complete software test engineer learning knowledge architecture system diagram in 2023 that I compiled

1. From entry to mastery of Python programming

Please add a picture description

2. Interface automation project actual combat

Please add a picture description

3. Actual Combat of Web Automation Project

Please add a picture description

4. Actual Combat of App Automation Project

Please add a picture description

5. Resume of first-tier manufacturers

Please add a picture description

6. Test and develop DevOps system

Please add a picture description

7. Commonly used automated testing tools

Please add a picture description

Eight, JMeter performance test

Please add a picture description

9. Summary (little surprise at the end)

The biggest challenge in life is not encountering difficulties, but how to persevere in the face of difficulties. Only if you dare to take risks and fight hard, can you create your own brilliant life. No matter how many times you fail, keep faith, because the next effort may be the key to success!

Only the indomitable struggle can light up the stars of life; only the unremitting efforts can paint the background of success. Believe in yourself and persist in chasing your dreams, you will be able to turn around and write a brilliant chapter!

As long as you have hope in your heart and persist in struggling, you will eventually reap brilliance; if you keep working hard, success will belong to you; if you face difficulties bravely and go forward, you will achieve extraordinary results; every fall is for a higher flight, as long as you persist, your dreams will surely come true. the s

Guess you like

Origin blog.csdn.net/x2waiwai/article/details/131703891