Skip to content

Instantly share code, notes, and snippets.

@YT-er
Last active January 21, 2019 03:03
Show Gist options
  • Save YT-er/d4763f213c2e536e7de5982ce3889eb5 to your computer and use it in GitHub Desktop.
Save YT-er/d4763f213c2e536e7de5982ce3889eb5 to your computer and use it in GitHub Desktop.
linux常用命令及技巧

Linux常用命令

删除文件前100行

sed -i "1,100d" filename

在文件最前面插入一列序号

awk '$0=NR"\t"$0' filename

输出文件指定列数后的内容,如第2列开始

awk -F "\t" '{for(i=2;i<=NF;i++) printf $i""FS;print ""}' file

文件去重复行
先排序后去重

sort filename|uniq

查看linux系统版本

lsb_release -a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment