1. 如果要删除目录,

rmdir or rm -d 或许可以删除空目录,但是只有
rm -R 可以把目录以及其内容连带删除!

2. 查看文件大小:

ls -l --block-size=G 还可以换成MB
#or
ls -lh

3. mac中使用sudo user:

sudo -s
然后输入你的用户密码(不是master code)即可!

4. 截取部分文件

截取行: head - file.txt > top_100_row.txt 同理可用tail截取  还可使用grep进行行的选择

截取列: cut -f1- -d',' file.txt > top_10_column.txt

5. 查找文件中是否含有某字符串

#查找目录下的所有文件中是否含有某个字符串
find .|xargs grep -ri "IBM"
#查找目录下的所有文件中是否含有某个字符串,并且只打印出文件名
find .|xargs grep -ri "IBM" -l
#or
find ./ -name "IBM"
#Ref:http://blog.sina.com.cn/s/blog_691a84f301015khx.html

6. Export path

export PATH=/Volumes/Macintosh_HD_2/Programs/samtools-0.1./misc/:$PATH
#you can now type directly on the terminal "samtools"

7. comm 命令

#找出两个文件不同的地方:
comm - <(sort a) <(sort b)
#注意这里的“<“。这个符号是”using a file as standard input"
#i.e. cat xyz.txt 和 cat < xyz.txt 效果是一样的

8. sed command

#to delete the 3rd line of a file
sed '3d' fileName.txt
#to select several lines of a file
sed -n '320123,320150'p filename

9. less command

less text.txt
#then, just type
450g
#you can find the 450th line

Linux Command Line 备忘的更多相关文章

  1. 《The Linux Command Line》 读书笔记04 Linux用户以及权限相关命令

    Linux用户以及权限相关命令 查看身份 id:Display user identity. 这个命令的输出会显示uid,gid和用户所属的组. uid即user ID,这是账户创建时被赋予的. gi ...

  2. 《The Linux Command Line》 读书笔记02 关于命令的命令

    <The Linux Command Line> 读书笔记02 关于命令的命令 命令的四种类型 type type—Indicate how a command name is inter ...

  3. 《The Linux Command Line》 读书笔记01 基本命令介绍

    <The Linux Command Line> 读书笔记01 基本命令介绍 1. What is the Shell? The Shell is a program that takes ...

  4. Linux Command Line Basics

    Most of this note comes from the Beginning the Linux Command Line, Second Edition by Sander van Vugt ...

  5. Linux Command Line 解析

    Linux Command Line 解析 0 处理模型 Linux kernel的启动包括很多组件的初始化和相关配置,这些配置参数一般是通过command line进行配置的.在进行后续分析之前,先 ...

  6. 15 Examples To Master Linux Command Line History

    When you are using Linux command line frequently, using the history effectively can be a major produ ...

  7. 10 Interesting Linux Command Line Tricks and Tips Worth Knowing

    I passionately enjoy working with commands as they offer more control over a Linux system than GUIs( ...

  8. Reso | The Linux Command Line 的中文版

    http://book.haoduoshipin.com/tlcl/book/zh/ 本书是 The Linux Command Line 的中文版, 为大家提供了多种不同的阅读方式. 中英文双语版- ...

  9. [笔记]The Linux command line

    Notes on The Linux Command Line (by W. E. Shotts Jr.) edited by Gopher 感觉博客园是不是搞了什么CSS在里头--在博客园显示效果挺 ...

随机推荐

  1. 新手必看,老鸟绕道–LAMP简易安装

    导读 LAMP是企业中最常用的服务,也是非常稳定的网站架构平台.其中L-指的是Linux,A-指的是Apache,m-指的是mysql或者marriDB,p-php.相信大家对这些都已经非常熟悉了,但 ...

  2. js基础之COOKIE

    一.COOKIE的封装函数 function setCookie(name,value,eDate){ var oDate = new Date(); oDate.setDate(oDate.getD ...

  3. ZOJ 3647 Gao the Grid dp,思路,格中取同一行的三点,经典 难度:3

    http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=4837 三角形的总数=格子中任取3个点的组合数-同一横行任取3个点数目-同一纵行 ...

  4. java程序(一)----HashMap同时获取键值

    快速会用: HashMap<Integer,String> maps=new HashMap<Integer,String>(); maps.put(1,"xiaom ...

  5. scikit-learn 机器学习工具包

    scikit-learn官网:http://scikit-learn.org/stable/ scikit-learn初始化学习:  http://scikit-learn.org/stable/in ...

  6. Rhel7的基本使用

    1.修改主机名 [root@localhost ~]# cat /etc/hostname localhost.localdomain[root@localhost ~]# hostnamectl s ...

  7. 《JAVA学习笔记 (final关键字)》

    [14-9]面向对象-final关键字 /* 继承的弊端,打破封装性. 不让其他类继承该类,就不会有重写. 怎么能实现呢?通过Java中的一个关键子来实现,final(最终化). [final关键字] ...

  8. Apparmor——Linux内核中的强制访问控制系统

      AppArmor 因为最近在研究OJ(oline judge)后台的安全模块的实现,所以一直在研究Linux下沙箱的东西,同时发现了Apparmor可以提供访问控制. AppArmor(Appli ...

  9. Chapter 5: Container

    Chapter 5: Container A container is a module that processes the requests for a servlet and populates ...

  10. 三极管的妙用之C118自动刷机

    首先咱们要搞清楚咱们自动刷机的原理,不谈修改固件那么高深的东西,简单的就是控制开机键. 使用继电器来控制基本上算是上个世纪的想法吧,之前博主也做过,做出来的感觉其实也很不错,就像是一个收藏品.因为继电 ...