linux shell 命令笔记
标准输入、标准输出、标准错误
File descriptors are integers associated with an opened file or data stream. File descriptors 0,
1, and 2 are reserved as follows:
0 – stdin (standard input)
1 – stdout (standard output)
2 – stderr (standard error)
重定向(默认只重定向标准输出) > 覆盖重写 >> 添加
重定向标准错误和标准输出到不同文件 cmd 2>stderr.txt 1>stdout.txt
重定向到同一个文件 cmd 2>&1 out.txt
不输出标准错误 cmd 2>/dev/null
管道命令(|)
find 命令
find ../ test.txt
find -name "*.txt"
find . -iname "example*" -print 忽略大小写查找
find . \( -name "*.txt" -o -name "*.pdf" \) -print 多条件查找
find /home/users -path "*slynux*" -print 查找目录
find . -regex ".*\(\.py\|\.sh\)$" 正则表达式查找
find . ! -name "*.txt" -print 查找不是以.txt结尾的文件
find . -type d -print 查找目录
根据时间做查找
find . -type f -atime -7 -print 查找7天内访问过的文件
find . -type f -mtime -7 -print 查找7天内修改过的文件
find . -type f -ctime -7 -print 查找7天内修改过权限或者拥有者的文件
以下三个选项对应的是分钟
-amin (access time)
f -mmin (modification time)
f -cmin (change time)
find . -type f -newer file.txt -print 查找修改时间比file.txt早的文件
根据文件大小做查找
b – 512 byte blocks
c – bytes
w – two byte words
k – Kilobyte
M – Megabyte
G – Gigabyte
find . -type f -size +2k 查找大于2k的文件
find . -type f -size -2k 查找小于2k的文件
find . -type f -size 2k 查找等于2k的文件
File type Type argument
Regular file f
Symbolic link l
Directory d
Character special device c
Block device b
Socket s
Fifo p
find . -type f -name "*.swp" -delete 找到文件的同时删除
find . -type f -atime -7 | xargs ls -lt 2>>/dev/null | head -n 1 查找七天内访问过的最近一条文件记录
ls -lrt 时间升序排列
ls -lt 时间降序排列
删除某个进程
ps -aux | grep 'python' | awk '{print $2}' | xargx kill
linux shell 命令笔记的更多相关文章
- 73条日常Linux shell命令汇总,总有一条你需要!
转载: 73条日常Linux shell命令汇总,总有一条你需要! 1.检查远程端口是否对bash开放: echo >/dev/tcp/8.8.8.8/53 && echo &q ...
- Linux常用命令 笔记
Linux常用命令 笔记 一.文件处理命令 1. ls命令:显示目录文件 -a 显示所有文件,包括隐藏文件.(all) ...
- Linux 常用命令笔记
Linux 常用命令笔记 1. locate locate:用来定位文件的位置,如:locate a.txt 但是这个命令有延迟,也就是新建的文件不一定能搜索到,如果非要找到新建的文件可以使用 upd ...
- Linux shell命令中expr
在Linux shell命令中expr虽然不是很起眼,但是它的作用是非常大的!到目前为止,我个人看来最大的作用就是两个——四则运算和字符串的操作. 先说四则运算,在Shell中四则运算不能简简单单的加 ...
- Linux/shell命令的实际应用——查看Port占用 netstat
启动1024端口一下,是需要root权限的 该Linux/shell命令主要用于解决: 1.查看某端口是否被占用: 2.查看某端口被哪个进程占用: 3.查看某个进程占用了哪些端口: 比如我tomcat ...
- [Python2.x] 利用commands模块执行Linux shell命令
用Python写运维脚本时,经常需要执行linux shell的命令,Python中的commands模块专门用于调用Linux shell命令,并返回状态和结果,下面是commands模块的3个主要 ...
- java使用Runtime.exec()运行windwos dos或linux shell命令
使用Runtime.exec()运行windwos dos或linux shell命令,按实际情况具体测试 实例代码: package com.bookoo.test.command; imp ...
- 15个有趣好玩的linux shell 命令
今天介绍一些有趣的linux shell命令,所有的命令都可以使用man + 命令名称 来查看完整的使用方法. 1,figlet 字符画 figlet 可以将英文字符串以字符画的形式输出: >& ...
- 常用Linux Shell命令,了解一下!
目录 1 前言 2 正文 2.1 关机/重启 2.2 echo 2.3 vim文本编辑器 2.3.1 最基本用法 2.3.2 常用快捷键 2.3.3 查找/替换 2.4 拷贝/删除/移动/重命名 2. ...
随机推荐
- vundle就是vim bundle的插件管理成ide
如何配置一个高效的php编辑环境, 很好 对vundle的操作, 除了仓库名称是vundle.git (*.git就是仓库) 和 本地目录名是 vundle之外, 其他的操作都是bundle git ...
- tensorflow 分布式搭建
https://blog.csdn.net/qq_40652148/article/details/80467131 https://yq.aliyun.com/articles/602111 git ...
- 性能测试工具之Apache ab
一.apache ab简介 ab全称ApacheBench,是著名的Web服务器软件apache附带的一款非常简单的压力测试工具,它可以同时模拟多个并发请求,测试Web服务器最大承受压力.Apache ...
- window.screenLeft&&window.screenTop&&window.screenX&&window.screenY
http://blog.sina.com.cn/s/blog_14e2a237b0102w4i0.html window.screenLeft&&window.screenTop&am ...
- oracle ogg--ogg搭建过程中遇到的错误及处理
1 PRVF-0002 : Could not retrieve local nodename---# Begin Stacktrace #---------------------------ID: ...
- DB.JDBC_jar_下载
1.Download Microsoft JDBC Driver for SQL Server - SQL Server _ Microsoft Docs.html(https://docs.micr ...
- python 并发编程 多进程 JoinableQueue
JoinableQueue和Queue 使用一样 这就像是一个Queue对象,但队列允许项目的使用者通知生成者项目已经被成功处理.通知进程是使用共享的信号和条件变量来实现的. JoinableQueu ...
- Scrapy输出文件格式问题汇总
Q:Scrapy抓取的内容(包含中文)输出到JSON Lines文件时如何确保输出的是字符本身而不是其unicode编码? A:默认的JsonLinesItemExporter其ensure_asci ...
- ubuntu使用iptables 持久化
iptables 持久化 安装持久化工具apt-get install iptables-persistent Ubuntu 16.04 调用语法netfilter-persistent savene ...
- 前端导出excel文件
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...