Linux系统常用命令

ls(list directory contents)

1|rk356x_box:/ # ls --help
usage: ls [-ACFHLRSZacdfhiklmnpqrstuwx1] [--color[=auto]] [FILE...]

List files.

what to show:
-a  all files including .hidden    -b  escape nongraphic chars
-c  use ctime for timestamps       -d  directory, not contents
-i  inode number                   -p  put a '/' after dir names
-q  unprintable chars as '?'       -s  storage used (1024 byte units)
-u  use access time for timestamps -A  list all files but . and ..
-H  follow command line symlinks   -L  follow symlinks
-R  recursively list in subdirs    -F  append /dir *exe @sym |FIFO
-Z  security context

output formats:
-1  list one file per line         -C  columns (sorted vertically)
-g  like -l but no owner           -h  human readable sizes
-l  long (show full details)       -m  comma separated
-n  like -l but numeric uid/gid    -o  like -l but no group
-w  set column width               -x  columns (horizontal sort)
-ll long with nanoseconds (--full-time)
--color  device=yellow  symlink=turquoise/red  dir=blue  socket=purple
         files: exe=green  suid=red  suidfile=redback  stickydir=greenback
         =auto means detect if output is a tty.

sorting (default is alphabetical):
-f  unsorted    -r  reverse    -t  timestamp    -S  size

example:

rk356x_box:/sdcard/Android/data/com.sundray.meeting # ls -lsh
total 10M
 10M -rw-r----- 1 root   ext_data_rw  20M 2023-03-17 15:14 BJCastChannel_1673923040340.h264
2.0K drwxrws--- 2 system ext_data_rw 4.0K 2023-02-21 11:44 cache
2.0K drwx--S--- 3 system ext_data_rw 4.0K 2023-03-17 14:56 files

df(disk free)

显示指定磁盘文件的使用情况。如果没有指定文件,则显示所有挂载的文件系统的磁盘使用情况。

rk356x_box:/ # df --help
usage: df [-HPkhi] [-t type] [FILE...]

The "disk free" command shows total/used/available disk space for
each filesystem listed on the command line, or all currently mounted
filesystems.

-a      Show all (including /proc and friends)
-P      The SUSv3 "Pedantic" option
-k      Sets units back to 1024 bytes (the default without -P)
-h      Human readable (K=1024)
-H      Human readable (k=1000)
-i      Show inodes instead of blocks
-t type Display only filesystems of this type

Pedantic provides a slightly less useful output format dictated by Posix,
and sets the units to 512 bytes instead of the default 1024 bytes.

使用

rk356x_box:/ # df -h
Filesystem            Size  Used Avail Use% Mounted on
tmpfs                 1.8G  832K  1.8G   1% /dev
tmpfs                 1.8G     0  1.8G   0% /mnt
/dev/block/mmcblk2p15  11M  104K   11M   1% /metadata
/dev/block/dm-0       1.2G  1.1G   99M  92% /
/dev/block/dm-2       426M  424M  1.2M 100% /vendor
/dev/block/dm-4       600K  596K  4.0K 100% /odm
/dev/block/dm-3       140M  140M  432K 100% /product
/dev/block/dm-1        51M   51M  160K 100% /system_ext
tmpfs                 1.8G     0  1.8G   0% /apex
tmpfs                 1.8G  264K  1.8G   1% /linkerconfig
/dev/block/mmcblk2p14 1.9G  300K  1.9G   1% /cache
/dev/block/mmcblk2p16 122M   31M   91M  26% /sundrayconfig
/dev/block/mmcblk2p20 6.5G  1.2G  5.2G  20% /data
tmpfs                 1.8G     0  1.8G   0% /data_mirror
/dev/fuse             6.5G  1.2G  5.2G  20% /mnt/user/0/emulated

du(disk usage)

rk356x_box:/ # du --help
usage: du [-d N] [-askxHLlmc] [FILE...]

Show disk usage, space consumed by files and directories.

Size in:
-k      1024 byte blocks (default)
-K      512 byte blocks (posix)
-m      Megabytes
-h      Human readable (e.g., 1K 243M 2G)

What to show:
-a      All files, not just directories
-H      Follow symlinks on cmdline
-L      Follow all symlinks
-s      Only total size of each argument
-x      Don't leave this filesystem
-c      Cumulative total
-d N    Only depth < N
-l      Disable hardlink filter

exaple:

rk356x_box:/sdcard/Android/data # du -sh ./*
8.0K    ./com.rockchips.mediacenter
20M     ./com.sundray.meeting
12K     ./com.sundray.meeting.device.test

kernel

查看内核版本
uname -a
读取内核镜像
cd /data; dd if=/dev/block/mmcblk2p11 of=boot_a.img
写入内核镜像
dd if=boot_a.img of=/dev/block/mmcblk2p11

驱动

lsmod:显示已载入系统的模块

rk356x_box:/ $ lsmod
Module                  Size  Used by
88x2cs               3174400  0
wlan                11153408  0
wlan_cnss_core_pcie   319488  1 wlan

insmod(install module):载入模块

install module

rmmod(remove module):删除模块

rmmod 

dmesg

rk356x_box:/ $ dmesg --help
usage: dmesg [-Cc] [-r|-t|-T] [-n LEVEL] [-s SIZE] [-w]

Print or control the kernel ring buffer.

-C      Clear ring buffer without printing
-c      Clear ring buffer after printing
-n      Set kernel logging LEVEL (1-9)
-r      Raw output (with )
-S      Use syslog(2) rather than /dev/kmsg
-s      Show the last SIZE many bytes
-T      Human readable timestamps
-t      Don't print timestamps
-w      Keep waiting for more output (aka --follow)
// 清空dmesg的日志
dmesg -c 

dmesg -w > /data/dmesg.log &
// 时间
dmesg -w -T > /data/dmesg.log &

查看占用率

dmc占用率
cat /sys/class/devfreq/dmc/load
GPU占用率
cat /sys/class/devfreq/fde60000.gpu/load

ip

255|rk356x_box:/ # ip
``` java
255|rk356x_box:/ # ip
Usage: ip [ OPTIONS ] OBJECT { COMMAND | help }
       ip [ -force ] -batch filename
where  OBJECT := { link | address | addrlabel | route | rule | neigh | ntable |
                   tunnel | tuntap | maddress | mroute | mrule | monitor | xfrm |
                   netns | l2tp | fou | macsec | tcp_metrics | token | netconf | ila |
                   vrf | sr }
       OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] | -r[esolve] |
                    -h[uman-readable] | -iec |
                    -f[amily] { inet | inet6 | ipx | dnet | mpls | bridge | link } |
                    -4 | -6 | -I | -D | -B | -0 |
                    -l[oops] { maximum-addr-flush-attempts } | -br[ief] |
                    -o[neline] | -t[imestamp] | -ts[hort] | -b[atch] [filename] |
                    -rc[vbuf] [size] | -n[etns] name | -a[ll] | -c[olor]}

example:
``
ip neigh


## Android
查看SurfaceFliger的帧率
`logcat | grep mFps`

你可能感兴趣的:(Linux系统常用命令)