非常有用之 Unix/Linux 单行脚本

http://leftleg.hzpub.com/read.php?479

删除 core 文件
# find ~ -name core -exec file {} \; -exec rm -i {} \;
查看使用文件的进程
# fuser -u /usr/my_application/foo
搜索字符串
#grep "hello world" `find ./ -name "*" -print -exec file {} \; |grep text | cut -d ':' -f 1`
目录
#alias dir='ls -Lla|grep ^d'

输出 IP 地址
#ifconfig | grep "inet addr" | grep -v "127.0.0.1" | awk '{print $2;}' | awk -F':' '{print $2;}'
按文件长度排序
#ls -l | grep ^- | sort -nr -k 5 | more
#ls -lR | grep ^- | sort -nr -k 5 | more

二进制文件中的可打印字符
# strings name of binary file
一个月的最后一个星期天执行任务:
18 * * * 0 [`date "+%d"` -gt 24] && /path/to/script

修改扩展名:
# for f in *.abc; do mv $f `basename $f .abc`.def ; done

查看硬盘情况:(Solaris)
# iostat -En

整个目录树拷贝:
# cd
# find . -depth -print | cpio -pudm

按长度排序目录下所有文件
# du -a | sort -n -r | more

检查文件内每行是否有相同列数
#awk '{print NF}' test.txt |sort -nu|more

去除空行
#sed -e '/^[ ]*$/d' InputFile >OutputFile

查看进程占用的对应文件 inode 号(Solaris)
#/usr/proc/bin/pfiles

删除指定用户的所有进程
# kill -9 `ps -fu username |awk '{ print $2 }'|grep -v PID`

Bash 操作快捷键:
ctrl-l -- clear screen
ctrl-r -- does a search in the previously given commands so that you don't
have to repeat long command.
ctrl-u -- clears the typing before the hotkey.
ctrl-a -- takes you to the begining of the command you are currently typing.
ctrl-e -- takes you to the end of the command you are currently typing in.
esc-b -- takes you back by one word while typing a command.
ctrl-c -- kills the current command or process.
ctrl-d -- kills the shell.
ctrl-h -- deletes one letter at a time from the command you are typing in.
ctrl-z -- puts the currently running process in background, the process
can be brought back to run state by using fg command.
esc-p -- like ctrl-r lets you search through the previously given commands.
esc-. -- gives the last command you typed.

文件名里的空格替换为下划线
# for i in $1 ; do mv "$i" `echo $i | sed 's/ /_/g'` ; done

查看远程主机时间
# telnet remotehostname 13|grep :

只显示 top 命令的states 行
#while true; do top -d 2 | col -b | grep states; sleep 10; done

加速显示 tar 文件内容
# tar tvfn

让 目录名也能 Spell Check
#shopt -s cdspell
当输错命令时,系统会自动进入类似的目录

查看 Sun 服务器型号
# /usr/platform/`uname -m`/sbin/prtdiag -v | grep `uname -m`

在vi 中一行文字前后添加字符
:/^\(.*\)/s//我要 \1 添加/

查找某包含字符串(Verita)软件包的详细信息 (Solaris)
pkginfo -l `pkginfo | grep -i VERITAS | awk '{print $2}'`

Sun 的一大堆脚本
http://www.sun.com/bigadmin/scripts/index.html

<script type=text/javascript charset=utf-8 src="http://static.bshare.cn/b/buttonLite.js#style=-1&uuid=&pophcol=3&lang=zh"></script> <script type=text/javascript charset=utf-8 src="http://static.bshare.cn/b/bshareC0.js"></script>

阅读(804) | 评论(0) | 转发(0) |

0

上一篇:Linux禁Ping的方法

下一篇:[ZT]awk学习笔记

相关热门文章
  • linux 常见服务端口
  • 【ROOTFS搭建】busybox的httpd...
  • 什么是shell
  • linux socket的bug??
  • linux的线程是否受到了保护?...
  • IBM DS3400 盘阵怎么查看是单...
  • 启动auditd时,报错如下,怎么...
  • CGSL系统中root密码正确,但无...
  • 在CGSL系统中,如何为不同的用...
  • CGSL系统如何设置交换分区的大...
给主人留下些什么吧!~~
评论热议

[ZT]SUN非常有用之 Unix/Linux 单行脚本相关推荐

  1. 非常有用之 Unix/Linux 单行脚本

    转自:http://fanqiang.chinaunix.net/program/code/2006-06-27/4695.shtml 删除 core 文件 # find ~ -name core - ...

  2. linux下实用小脚本,十个增加 Linux Shell 脚本趣味的小工具

    很多人误以为shell脚本只能在命令行下使用.其实shell也可以调用一些GUI组件,例如菜单,警告框,进度条等等.你可以控制最终的输出,光标位置还有各种输出效果.下面我将介绍一些工具,帮助你创建强大 ...

  3. linux/unix 单行脚本

    linux/unix 单行脚本 自:http://www.freelamp.com/1150374370/index_html linuxlamp.com真是个不错的站点 删除 core 文件 # f ...

  4. 细说高端服务器 SGI HP Sun IBM RS Unix Linux

    细说高端服务器 高端服务器作为与网络关系最为密切的硬件产品之一,是在网络环境下提供网上客户机共享资源(包括查询.存储和计算等)的设备.它具有高可靠性.高性能.高吞吐能力和大内存容量等特点,并且具备强大 ...

  5. Unix/Linux下文件基本操作[zt]

    Unix/Linux下文件基本操作 来源: ChinaUnix博客 日期: 2008.06.16 17:16 (共有0条评论) 我要评论 比较重要的设备文件有三个,它们是/dev/console./d ...

  6. 10 个最酷的 Linux 单行命令

    转自:http://linuxtoy.org/archives/top-10-one-liners.html 下面是来自 Commandlinefu 网站由用户投票决出的 10 个最酷的 Linux ...

  7. 为什么VDI(桌面虚拟化)对于硬核UNIX/Linux工程应用程序是有意义的?

    ​Why VDI Makes Sense for Hard-Core UNIX and Linux Engineering Applications 为什么VDI(桌面虚拟化)对于硬核UNIX/Lin ...

  8. linux下启动tlq命令,UNIX/LINUX命令

    1 如何查看磁盘使用情况 查看磁盘空间 df -k 可以看出磁盘空间使用情况.以及分区或者逻辑卷的挂载目录等. $ df -k Filesystem 1024-blocks Free %Used Iu ...

  9. 转载 :28 个 Unix/Linux 的命令行神器

    2019独角兽企业重金招聘Python工程师标准>>> 下面是Kristóf Kovács收集的28个Unix/Linux下的28个命令行下的工具(原文链接),有一些是大家熟悉的,有 ...

最新文章

  1. webpack.config.js配置遇到Error: Cannot find module '@babel/core'问题
  2. Lambda表达式的注意事项【理解】
  3. 数学--数论--随机算法--Pollard Rho 大数分解算法 (带输出版本)
  4. Android之运行PopupWindow提示Unable to add window -- token null is not valid; is your activity running?
  5. 阅读react-redux源码 - 一
  6. linux svn 看不到文件,SVN更新时不能打开新文件svn-base系统找不到指定的文件
  7. mysql怎么找出树形的根节点,Oracle 层级语句 树形结构 显示根节点 不显示根节点...
  8. json接口(使用,以及自定义)
  9. 一款APP的完整开发流程
  10. 复制csdn或者博客园文章时,图片无法直接粘贴过来解决办法
  11. 勇士大战恶魔?这款桌游明明是套高质量原创手办
  12. chrome清除https状态
  13. python qrcode 中文乱码_Python qrcode不一致
  14. winpe修复计算机无法启动,用winpe来修复无法进入系统的问题
  15. 【jenkins】Synopsys Detect入门简介
  16. apache配置wss
  17. pingpong 攻防世界
  18. c语言程序设计冒泡排序在哪,C语言程序设计冒泡排序教学案例杨进
  19. Vue+Electron
  20. python爬虫ip代理没有作用_可能是一份没什么用的爬虫代理IP指南

热门文章

  1. kafka partion个数分析
  2. caffe2学习笔记一:图像预处理
  3. (二十二)岁月无声 - 5
  4. 拆解300个自媒体爆款标题,总结三点教你玩转自媒体标题
  5. 笔记本突然没有wifi功能了?!我的解决办法
  6. mysql insert or replace_mysql 操作总结 INSERT和REPLACE
  7. 《Flowable流程引擎从零到壹》Flowable流程引擎介绍和实战项目初始化流程引擎实例
  8. 和信创天联手Websense支持Linux Deepin开源社区发展
  9. MTK平台如何获取所有异常的AEE db文件
  10. Katalon Studio Enterprise 8.5 Crack-New