linux入门--cat,head,less命令的使用练习

2021-01-23  本文已影响0人  Seurat_Satija

查看文件是生信技能树[生信爆款入门课程]linux部分Day12的讲到的一个重要知识点。为加深理解,现在对几个常用函数做下练习巩固。

练习题

image.png

1.

$ cd
Last10 11:59:22 ~
$ cat >catFile
[image.png](https://img.haomeiwen.com/i19009296/b73d585c77c1db8a.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
^C
Last10 12:00:20 ~
$ cat catFile 
[image.png](https://img.haomeiwen.com/i19009296/b73d585c77c1db8a.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
Last10 12:00:41 ~

2.

$ cd
Last10 12:02:05 ~
$ ls
1            file     readme.txt  wenjianjia1
catFile      Music    test1       wenjianjia{1:5}
Data         mydir    test2
Data.tar.gz  mydircd  wenjian3
Last10 12:02:08 ~
$ cd Data/
Last10 12:02:15 ~/Data
$ LS
The program 'LS' is currently not installed. To run 'LS' please ask your administrator to install the package 'sl'
Last10 12:02:18 ~/Data
$ ls
Data.tar.gz
example.fa
example.fq
example.gtf
Homo_sapiens.GRCh38.102.chromosome.Y.gff3.gz
readme.txt
Last10 12:02:22 ~/Data
$ head example.fq
@ERR329499.1 HWUSI-EAS697:8:115:13414:19955#ACAGTG/1
AAAAAATTGGTGTTATAAGACTTCTGGACCCTGAAGATGTCGATGTCTCCTCACCTGATGAAAAATCAGT
+
HIIIIIIHIIHIHIIIGEIIIIIIIIIIIIIIHEHIGIIHHHIIIHIGIIIIIIGGIEHIDEIHBEBEFB
@ERR329499.2 HWUSI-EAS697:8:116:12001:8002#ACAGTG/1
CATGTTGTCACTTTTTCCATGAGCCACGTAGTACAGAGAACGCGGCACTCCATAAGGACCATTTGTCCTG
+
GGEECDGGE@GGGGGGGGBGEDBGGHHGHGEBGDDDB@DGHDHFBGBDBDD@D2DCECEB@>?C@BECEC
@ERR329499.3 HWUSI-EAS697:8:109:15856:9893#ACAGTG/1
GCCAGATCCATTTTCAGTGGTCTGGATTTCTTTTTATTTTCTTTTCAACTTGAAAGAAACTGGACATTAG
Last10 12:02:39 ~/Data
$ head -n example.fq
head: invalid number of lines: ‘example.fq’
Last10 12:02:54 ~/Data
$ tail example.fq
+
GHHHHHDHHHGBGGD;D==;CEC?BA*?A==@?==DEEGEC<8A##########################
@ERR329499.999 HWUSI-EAS697:8:105:13870:5157#ACAGTG/1
CTTCGGTGTGTCCTTCAAAGATTTACACAACATTGTCCTAAAGGGAAGTCACAGCAGCTTAGCTGTTTCT
+
IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIHIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIHHIII
@ERR329499.1000 HWUSI-EAS697:8:113:1532:14172#ACAGTG/1
CAGATTACTTTTAACTNCATGGGTTAAATTCCTGTGGGAGTCTTACAGGCAGTGTTTGGACCTTCTTAGA
+
IHIIIIIIIIIIIIID#DBEBBC?BHIGIIIIHIIHHHHIGIIIIGIHGHIIDDGFFFCDGIGIFGHDFG
Last10 12:03:17 ~/Data

3.

$ less -N example.gtf
 1 chr1    ENSEMBL UTR     1737    2090    .             1 +       .       gene_id "ENSG00000223972"; trans      1 cript_id "ENST00000456328"; gene_type "protein_c      1 oding"; gene_status "KNOWN"; gene_name "RP11-34P      1 13.1"; transcript_type "protein_coding"; transcr      1 ipt_status "KNOWN"; transcript_name "RP11-34P13.      1 1-201"; level 3; havana_gene "OTTHUMG00000000961      1 ";
      2 chr1    ENSEMBL exon    1737    2090    .             2 +       .       gene_id "ENSG00000223972"; trans      2 cript_id "ENST00000456328"; gene_type "protein_c      2 oding"; gene_status "KNOWN"; gene_name "RP11-34P      2 13.1"; transcript_type "protein_coding"; transcr      2 ipt_status "KNOWN"; transcript_name "RP11-34P13.      2 1-201"; level 3; havana_gene "OTTHUMG00000000961      2 ";
      3 chr1    ENSEMBL transcript      1737    4275    example.gtf

$ less -S example.gtf
chr1    ENSEMBL UTR     1737    2090    .       +       
chr1    ENSEMBL exon    1737    2090    .       +       
chr1    ENSEMBL transcript      1737    4275    .       
chr1    HAVANA  gene    1737    4275    .       +       
chr1    HAVANA  exon    1873    1920    .       +       
chr1    HAVANA  transcript      1873    3533    .       
chr1    HAVANA  exon    2042    2090    .       +       
chr1    HAVANA  exon    2476    2560    .       +       
chr1    ENSEMBL UTR     2476    2584    .       +       
chr1    ENSEMBL exon    2476    2584    .       +       
chr1    HAVANA  exon    2838    2915    .       +       
chr1    HAVANA  exon    3084    3237    .       +       
chr1    ENSEMBL UTR     3084    4021    .       +       
chr1    ENSEMBL exon    3084    4275    .       +       
chr1    HAVANA  exon    3316    3533    .       +       
chr1    ENSEMBL start_codon     4022    4024    .       
chr1    ENSEMBL CDS     4022    4249    .       + 
上一篇下一篇

猜你喜欢

热点阅读