LINUX基础报错汇总

1. SyntaxError: invalid syntax

使用命令提示:

[root@localhost ~]# dstat
  File "/usr/bin/dstat", line 120
    except getopt.error, exc:
                       ^
SyntaxError: invalid syntax

原因:python版本问题,dstat只支持python2
解决:修改python版本

[root@localhost]# vi /usr/bin/dstat
#!/usr/bin/python2.7
[root@localhost ~]# dstat
You did not select any stats, using -cdngy by default.
----total-cpu-usage---- -dsk/total- -net/total- ---paging-- ---system--
usr sys idl wai hiq siq| read  writ| recv  send|  in   out | int   csw 
  2   1  97   0   0   0|1370B   65k|   0     0 |   0     0 | 993  6139 
  5   2  94   0   0   0|   0    28k| 180B 1054B|   0     0 |3533  8163 ^C

2. missing operand

# stat -t
stat: missing operand
Try 'stat --help' for more information.

原因:缺少命令使用时需要带上操作数,
stat '文件'

# stat /data/
  File: ‘/data/’
  Size: 4096      	Blocks: 8          IO Block: 4096   directory
Device: fd01h/64769d	Inode: 5373953     Links: 4
Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2020-04-01 10:14:08.462803052 +0800
Modify: 2020-04-01 10:14:07.164753687 +0800
Change: 2020-04-01 10:14:07.164753687 +0800
 Birth: -
原文地址:https://www.cnblogs.com/sihye/p/12611448.html