linux用touch权限不够,一天一个Linux命令(第6天touch命令)

66b52468c121889b900d4956032f1009.png

8种机械键盘轴体对比

本人程序员,要买一个写代码的键盘,请问红轴和茶轴怎么选?

touch命令touch命令有两个功能:一是用于把已存在文档的时间标签更新为系统当前的时间(默认方式),它们的数据将原封不动地保留下来;二是用来创建新的空文档。

当然了touch主要的功能是用来创建空文档,至少我常用来这么做。

语法

touch(选项)(参数)

选项:-a:或--time=atime或--time=access或--time=use 只更改访问时间;

-c:或--no-create 不建立任何文档;

-d: 使用指定的日期时间,而非现在的时间;

-f:此参数将忽略不予处理,仅负责解决BSD版本touch命令的兼容性问题;

-m:或--time=mtime或--time=modify 只更该变动时间;

-r: 把指定文档或目录的日期时间,统统设成和参考文档或目录的日期时间相同;

-t: 使用指定的日期时间,而非现在的时间;

--help:在线帮助;

--version:显示版本信息。

实例

创建文档夹dongpengju,可以看到文档夹大小为0,是为空的:[[email protected] usr]$ touch dongpengju

touch: 无法创建"dongpengju": 权限不够

[[email protected] usr]$ su root

密码:

[[email protected] usr]# pwd

/usr

[[email protected] usr]# touch dongpengju

[[email protected] usr]# ls

bin etc include lib64 local share tmp

dongpengju games lib libexec sbin src

[[email protected] usr]# ll

总用量 264

dr-xr-xr-x. 2 root root 49152 6月 22 04:37 bin

-rw-r--r--. 1 root root 0 6月 25 06:55 dongpengju

drwxr-xr-x. 2 root root 6 4月 11 2018 etc

drwxr-xr-x. 2 root root 6 4月 11 2018 games

drwxr-xr-x. 9 root root 4096 6月 22 04:34 include

dr-xr-xr-x. 42 root root 4096 6月 22 04:36 lib

dr-xr-xr-x. 142 root root 81920 6月 22 04:39 lib64

drwxr-xr-x. 49 root root 12288 6月 22 04:36 libexec

drwxr-xr-x. 12 root root 131 6月 22 04:07 local

dr-xr-xr-x. 2 root root 20480 6月 22 04:37 sbin

drwxr-xr-x. 235 root root 8192 6月 22 04:37 share

drwxr-xr-x. 4 root root 34 6月 22 04:07 src

lrwxrwxrwx. 1 root root 10 6月 22 04:07 tmp -> ../var/tmp

[[email protected] usr]#

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值