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. ASP.NET MVC 在子页中引用头文件

    在很多时候我们把网站公共的js.css文件放在模板页中,这样在具体的每一个页面里面就不需要单独引用. ASP.NET WebForm里面使用.site文件. 而在ASP.NET MVC 中使用了类似下 ...

  2. cf 307

    一开始我是不想打的  又因为307这个数字太特殊了 毕竟307  希望今天的考试不要挂掉 http://codeforces.com/contest/551/problem/A #include< ...

  3. HDU 4888 Redraw Beautiful Drawings(2014 Multi-University Training Contest 3)

    题意:给定n*m个格子,每个格子能填0-k 的整数.然后给出每列之和和每行之和,问有没有解,有的话是不是唯一解,是唯一解输出方案. 思路:网络流,一共 n+m+2个点   源点 到行连流量为 所给的 ...

  4. Android利用ContentProviderOperation添加联系人

    Android添加联系人有两种方式: 1. 直接调用插入语句,先插入一个空Item,得到一个id,然后给这个id对应的插入其他信息,如姓名,号码,邮件等: 2. 利用ContentProviderOp ...

  5. HDOJ 1754 I Hate It 线段树 第二题

    I Hate It Problem Description 很多学校流行一种比较的习惯.老师们很喜欢询问,从某某到某某当中,分数最高的是多少.这让很多学生很反感. 不管你喜不喜欢,现在需要你做的是,就 ...

  6. 11个Linux基础面试问题

    Q.1: Linux 操作系统的核心是什么? Shell Kernel Command Script Terminal 答: 内核(Kernel)是Linux 操作系统的核心.Shell是一个命令行解 ...

  7. 【转】Centos系统文件与用户权限分配详解ftp,nginx,php

    linux系统中权限是非常完善的一个功能了,我们如果设置不正确文件就无法使用了,像我们以一般情况需要把文件权限设置为777或644了,对于用户权 限就更加了,像素ftp,nginx,php这些我们都可 ...

  8. JVM-对象

    1.对象的创建 当虚拟机遇到一条new指令时,首先去检查这个指令的参数是否能在常量池中定位到一个类的符号引用,并且检查这个符号引用代表的类是否已经被加载.解析和初始化.如果没有,那必须先执行相应的类加 ...

  9. IOS 中的KVO模式 观察者模式

    / // KvoObject.h // KVO // // Created by lin kang on 16/6/7. // Copyright © 2016年 lin kang. All righ ...

  10. windows防火墙添加规则

    #include <windows.h> #include <crtdbg.h> #include <netfw.h> #include <objbase.h ...