6、linuxの基本コマンド(3)


1、小さなまとめ
 :
ls、cd、pwd、mkdir、rmdir、tree

 :
touch、stat、file、rm、cp、mv、vim

 :
date	

 :
cat、more、less、head、tail	

 
cut sed awk

2、cat
-n表示行番号-E表示行終了記号#linuxシステムの場合、テキストファイルの行終了記号は$記号
[root@localhost test2]# cat 1.c 
hello world

hello world


[root@localhost test2]# cat -n 1.c
     1	hello world
     2	
     3	hello world
     4	
[root@localhost test2]# cat -E 1.c
hello world$
$
hello world$
$


3、head
-n最初のn行を表示(デフォルトでは最初の10行を表示)
[root@localhost test2]# head -n3 1.c 
hello world

hello world
[root@localhost test2]# head -3 1.c 
hello world

hello world

4、tail
-n表示後n行(デフォルト表示後10行)
-fは終了せず、このファイルに追加された新しいコンテンツを表示するのを待つ####ログの後ろのコンテンツを動的に表示する
[root@localhost test2]# tail -3  1.c 


hello world

[root@localhost test2]# tail -n3  1.c 


hello world


5、more  ,  less   
-----ページごとにテキストの内容を表示
[root@localhost test2]# more /etc/passwd
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
adm:x:3:4:adm:/var/adm:/sbin/nologin
lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown

# , 
# :
/KEYWORD:      # Enter 
n:  
N: