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. 使用URL读取网络资源

    import java.io.InputStream;import java.io.OutputStream;import java.net.URL; import android.os.Bundle ...

  2. poj 3468 A Simple Problem with Integers 线段树第一次 + 讲解

    A Simple Problem with Integers Description You have N integers, A1, A2, ... , AN. You need to deal w ...

  3. Hibernate中的多对多映射

    1.需求 项目与开发员工 一个项目,有多个开发人员 一个开发人员,参与多个项目 [多对多] 2.实体bean设计 Project: public class Project { private int ...

  4. Quartz2D

    http://donbe.blog.163.com/blog/static/138048021201052093633776/ 详解 代码如下: DJView 绘制线段 基本图形 // // DJVi ...

  5. iOS知名第三方框架和流行APP们所用的第三方框架小结

    网易新闻AppleReachabilityASIHTTPRequestEGOTableViewPullRefreshGTMNSString+HTMLMGTemplateEngineMPOAuthReg ...

  6. java基础-003

    10.进程和线程 进程是执行者的应用程序,而线程是进程内部的一个执行序列.一个进程可以有多个线程.线程又叫轻量级进程. 创建线程的三种方式: I> 继承Thread类 II> 实现Runn ...

  7. cometd的服务器配置

    CometDServlet必须在web.xml中进行配置,如下: <servlet>        <servlet-name>cometd</servlet-name& ...

  8. postgreSQL9.1忘记postgres用户密码怎么办

    在网络上找了一篇文章http://www.linuxidc.com/Linux/2010-04/25232.htm,如下: Ubuntu 9.10下PostgreSQL 8.4忘记密码的解决方法 Ub ...

  9. Linux在IA-32体系结构下的地址映射

    1.概览 2.逻辑地址到线性地址 逻辑地址到线性地址的映射在IA-32体系结构中又被称为段式映射.如上图所示,段式映射我们首先需要获取逻辑地址和段选择符,段选择符用于获取GDT中段的基地址,将逻辑地址 ...

  10. FR #2题解

    A. 考虑把(u,v)的询问离线挂在u上,然后dfs,每次从fath[x]到[x]相当于x子树dis区间加1,x子树以外区间-1,然后维护区间和区间平方和等. 常数略大. #include<io ...