linux常用命令 之 文件处理(二)

 命令名称:touch

所在路径:/bin.touch

执行权限:所有用户

oot@localhost tmp]# touch list.txt
[root@localhost tmp]# touch /root/list.txt
[root@localhost tmp]# touch program files
[root@localhost tmp]# ll
总计 52
drwxr-xr-x 2 root root 4096 12-01 13:05 china
-rw-r--r-- 1 root root    0 12-01 13:43 files
drwx------ 3 root root 4096 11-30 19:15 gconfd-root
-rw------- 1 root root  630 12-01 13:08 grub.conf
drwx------ 2 root root 4096 11-30 19:15 keyring-n4KWUI
-rw-r--r-- 1 root root    0 12-01 13:36 list.txt
srwxr-xr-x 1 root root    0 11-30 19:15 mapping-root
drwx------ 2 root root 4096 12-01 12:10 orbit-root
-rw-r--r-- 1 root root    0 12-01 13:43 program
-rw-r--r-- 1 root root    5 12-01 13:00 scim-bridge-0.3.0.lockfile-0@localhost:0.0
srwxr-xr-x 1 root root    0 11-30 20:10 scim-bridge-0.3.0.socket-0@localhost:0.0
srw------- 1 root root    0 11-30 19:16 scim-helper-manager-socket-root
srw------- 1 root root    0 11-30 19:16 scim-panel-socket:0-root
srw------- 1 root root    0 11-30 19:15 scim-socket-frontend-root
drwx------ 2 root root 4096 11-30 19:15 ssh-mibWGs4219
drwx------ 2 root root 4096 11-30 19:15 virtual-root.tyft1a
drwxr-xr-x 2 root root 4096 11-30 21:48 vmware-config0
drwxrwxrwt 4 root root 4096 11-30 18:13 VMwareDnD
drwxr-xr-x 2 root root 4096 11-30 19:13 vmware-root
drwx------ 2 root root 4096 11-30 19:15 vmware-root-2083992326
[root@localhost tmp]# touch " profile file"
[root@localhost tmp]# ls
china
files
gconfd-root
grub.conf
keyring-n4KWUI
list.txt
mapping-root
orbit-root
 profile file
program
scim-bridge-0.3.0.lockfile-0@localhost:0.0
scim-bridge-0.3.0.socket-0@localhost:0.0
scim-helper-manager-socket-root
scim-panel-socket:0-root
scim-socket-frontend-root
ssh-mibWGs4219
virtual-root.tyft1a
vmware-config0
VMwareDnD
vmware-root
vmware-root-2083992326
[root@localhost tmp]# 


命令名称:cat

命令所在路径:/bin/cat

执行权限:所有用户

[root@localhost tmp]# cat /etc/issue
Red Hat Enterprise Linux Server release 5.4 (Tikanga)
Kernel \r on an \m

[root@localhost tmp]# cat -n /etc/issue
     1  Red Hat Enterprise Linux Server release 5.4 (Tikanga)
     2  Kernel \r on an \m
     3
[root@localhost tmp]# 

命令名称:tac

所在路径:/usr/bin/tac

[root@localhost tmp]# cat /etc/issue
Red Hat Enterprise Linux Server release 5.4 (Tikanga)
Kernel \r on an \m

[root@localhost tmp]# cat -n /etc/issue
     1  Red Hat Enterprise Linux Server release 5.4 (Tikanga)
     2  Kernel \r on an \m
     3
[root@localhost tmp]# 
[root@localhost tmp]# tac /etc/issue

Kernel \r on an \m
Red Hat Enterprise Linux Server release 5.4 (Tikanga)
[root@localhost tmp]# tac -n /etc/issue
tac:无效选项 -- n
请尝试执行“tac --help”来获取更多信息。

命令名称:more  只能向下翻页

所在路径:/bin/more

空格 f q

命令名称:less 

page UP (向上一页) 

进行收索

[root@localhost tmp]# less /etc/services 

命令名称:head 、tail

[root@localhost tmp]# head  /etc/services 
# /etc/services:
# $Id: services,v 1.42 2006/02/23 13:09:23 pknirsch Exp $
#
# Network services, Internet style
#
# Note that it is presently the policy of IANA to assign a single well-known
# port number for both TCP and UDP; hence, most entries here have two entries
# even if the protocol doesn't support UDP operations.
# Updated from RFC 1700, ``Assigned Numbers'' (October 1994).  Not all ports
# are included, only the more common ones.
[root@localhost tmp]# head -1  /etc/services 
# /etc/services:
[root@localhost tmp]# 

[root@localhost tmp]# tail -f  /etc/services  #动态变化
nimspooler      48001/udp                       # Nimbus Spooler
nimhub          48002/tcp                       # Nimbus Hub
nimhub          48002/udp                       # Nimbus Hub
nimgtw          48003/tcp                       # Nimbus Gateway
nimgtw          48003/udp                       # Nimbus Gateway
com-bardac-dw   48556/tcp                       # com-bardac-dw
com-bardac-dw   48556/udp                       # com-bardac-dw
iqobject        48619/tcp                       # iqobject
iqobject        48619/udp                       # iqobject

命令名称:ln

硬链接可以进行同步更新,但不能夸分区,不能针对目录建立硬链接

[root@localhost tmp]# ln -s /etc/issue /tmp/issue.soft
[root@localhost tmp]# ln  /etc/issue /tmp/issue.hard
[root@localhost tmp]# ln -l /etc/issue
ln:无效选项 -- l
请尝试执行“ln --help”来获取更多信息。
[root@localhost tmp]# ls -l /etc/issue
-rw-r--r-- 2 root root 74 2009-08-04 /etc/issue
[root@localhost tmp]# ls -l /tmp/issue*
-rw-r--r-- 2 root root 74 2009-08-04 /tmp/issue.hard
lrwxrwxrwx 1 root root 10 12-01 14:36 /tmp/issue.soft -> /etc/issue
[root@localhost tmp]# 
[root@localhost tmp]# ls -i /etc/issue /tmp/issue.soft /tmp/issue.hard 
1573051 /etc/issue  1573051 /tmp/issue.hard   917638 /tmp/issue.soft
[root@localhost tmp]# 



郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。