当前位置:网站首页>liunx指令
liunx指令
2022-06-29 20:01:00 【有诗亦有远方】
liunx指令
1. ls(查看文件)
ls
2. mkdir(创建文件夹)
mkdir 文件夹名
3. touch (创建文件)
touch 文件名
4. cat(查看内容)
cat 文件名
5. rm -rf(删除文件)
rm -rf deamon.json
6. vi(修改)
1.vi + filename //进入文件编辑模式
2.按i,进入插入模式
3.按esc退出
4.按shift+ : 号 然后输入 wq退出
7. 修改环境变量

1.打开编辑
vim /etc/profile
2.$PATH:(路径1):$PATH:(路径2)
第一个环境 第二个环境
8. docker exec -it(进入容器)
docker exec -it 容器ID /bin/bash
9. ls -lah(显示隐藏文件)
ls -lah
10. cp(复制命令)
cp 文件名 目录
11. docker logs -f (查看容器日志)
docker logs -f logstash(容器名)
12. 清除容器日志
新建文件docker-clear-log,放在/usr/local/bin/目录下,文件内容如下:
#!/bin/bash -e
if [[ -z $1 ]]; then
echo "No container specified"
exit 1
fi
if [[ "$(docker ps -aq -f name=^/${1}$ 2> /dev/null)" == "" ]]; then
echo "Container \"$1\" does not exist, exiting."
exit 1
fi
log=$(docker inspect -f '{
{
.LogPath}}' $1 2> /dev/null)
truncate -s 0 $log
赋予文件相应的权限,我仅仅给了它所有者读写执行的权限,其他人无权限执行:
chmod 700 /usr/local/bin/docker-clear-log
最后,执行
docker-clear-log <container>
边栏推荐
- Configuration du Flume 4 - source personnalisée + sink
- PowerShell command outputs only a list of directories
- How to use the configuration in thinkphp5
- There is no small green triangle on the method in idea
- 童年经典蓝精灵之百变蓝爸爸数字藏品中奖名单公布
- 一个mysql里有3306端口下,一个mysql有20多个数据库,怎么一键备份20多个数据库,做系统备份,防止数据误删除?
- MySQL remote connection
- 剑指 Offer 41. 数据流中的中位数
- One hour to build a sample scenario sound network to release lingfalcon Internet of things cloud platform
- Zotero期刊自動匹配更新影響因子
猜你喜欢

Tiger painter mengxiangshun's digital collection is on sale in limited quantities and comes with Maotai in the year of the tiger

How to set a pod to run on a specified node

【编译原理】语法分析

一次 Keepalived 高可用的事故,让我重学了一遍它!

文件包含漏洞

Creators foundation highlights in June

Flume configuration 4 - Custom source+sink

JMeter BeanShell explanation and thread calling

Finally, Amazon~

Connaissance générale des paramètres de sécurité du serveur Cloud
随机推荐
攻防演练中的防守基石——全方位监控
一个mysql里有3306端口下,一个mysql有20多个数据库,怎么一键备份20多个数据库,做系统备份,防止数据误删除?
Zotero期刊自动匹配更新影响因子
数据链路层
How to set a pod to run on a specified node
JVM(4) 字節碼技術+運行期優化
Test method learning
2022年深圳市福田区支持先进制造业发展若干措施
Koa 源码剖析
How to solve the problem of insufficient memory space in Apple iPhone upgrade system?
Flume theory
Notepad++ -- macro (record operation process)
剑指 Offer 41. 数据流中的中位数
画虎国手孟祥顺数字藏品限量发售,随赠虎年茅台
使用Gunicorn部署web.py应用
【编译原理】语义分析
【译】十二因子应用(四)
Flume configuration 1 - basic case
A great open source image watermarking solution
JVM (4) Bytecode Technology + Runtime Optimization