Note - Linux

2023-05-16

1    Terminal Command

1.1  ls -- list

List files of current direction or target direction

$ ls [option] [file]
OptionExplanation
-aList all files and direction -A excludes '.' and '..'
-lLong list and show details
-TUse tabular length instead of 8- bit length
-BIgnore files ending with '~'
-dList content of directory
-hhuman - readable mode "G, M, K"
-rReversed sort
-cSort out files by created time
-t Sort out files by modified time
-sSort out files by file size
-u Sort out files by last access time

1.2  top

Displays the resource usage of each process in the system in real time

$ top [option]
OptionExplanation
-sSafe mode
-SAccumulation mode
-p pidPID Monitor the status of some process
-iNo idle or zombie processes (Internal command)
-dSpecifies the refresh interval (unit: s) (Internal command)
-cDisplays the entire command line

Internal commands are used to control the display mode of processes
\Rightarrow N                 根据 PID 大小排序
\Rightarrow P                 根据 CPU 占用量排序
\Rightarrow M                根据 Memory 占用量排序
\Rightarrow K                 Kill a process.
\Rightarrow r                  Reprioritize a process.
\Rightarrow N                 Set the number of processes to be displayed in the process list.

1.3  du -- disk usage, df -- disk free

du : Display the size of objective directory or file.

df : Statistics on file system disk usage 

$ du [option]
$ df -h
OptionExplanation
-aDisplay individual sizes of all single files.
-cDisplay all single files and summary. 
-hhuman-readable K M G
-sDisplay summary
-X [file]Exclude objective file
--max-depthIgnore exceeding depth

1.4  cat -- Concatenate

View the contents of file.

$ cat [filename]
$ cat [filename] | grep [option] Pattern

Create a file (Not exist), ending with EOF marker.

$ cat > [filename] <<EOF

Concatenate several files and append the contents into one.

$ cat [file1] [file2] ... >> [file]
OptionExplanation
-nNumber all lines starting with 1
-bSimilar with '-n', ignoring blank lines
-sSqueeze 2+ blank lines into one

1.5  grep -- Global Regular Expression Print

Use regular expressions to search for text and print out matching lines.

$ grep [option] Pattern [filename1] [filename2]...
OptionExplanation
-iIgnore case.
-vDisplay dismatching lines.
-oOnly matched strings are displayed
-A #Display the line matched by the pattern and the following # lines
-B #Display the line matched by the pattern and the preceding # lines
-C # -A # and -B #

2. Linux Tool

2.1 unar 解压缩

Installation

$ yum install epel-release -y
$ yum install unar -y

使用

# specify directory
$ unar -o /opt example.rar

# specify password
$ unar -p 123456 examaple.rar

# specify decoder
$ unar -e GBK robin.tar.xz

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Note - Linux 的相关文章

  • GLIBCXX_3.4.26 未找到在 BeagleBone 上运行交叉编译的程序

    我有以下程序 include
  • 如何使用 bash 锁定文件

    我有一个任务从远程服务器同步目录 rsync av email protected cdn cgi l email protection srv data srv data 为了使其定期运行并避免脚本 reEnter 问题 我使用 rsyn
  • 如何根据 HTTP 请求使用 Python 和 Flask 执行 shell 命令并流输出?

    下列的这个帖子 https stackoverflow com questions 15092961 how to continuously display python output in a webpage 我能够tail f网页的日志
  • 如何查明CONFIG_FANOTIFY_ACCESS_PERMISSIONS是否启用?

    我想利用fanotify 7 http man7 org linux man pages man7 fanotify 7 html我遇到的问题是在某些内核上CONFIG FANOTIFY ACCESS PERMISSIONS不起作用 虽然C
  • chown:不允许操作

    我有问题 我需要通过 php 脚本为系统中的不同用户设置文件所有者权限 所以我通过以下命令执行此操作 其中 1002 是系统的用户 ID file put contents filename content system chown 100
  • sendfile64 只复制约2GB

    我需要使用 sendfile64 复制大约 16GB 的文件 到目前为止我所取得的成就是 include
  • 将 PDF 转换为 600dpi 的 TIFF 和 jpg 96 dpi

    我想使用 ImageMagick 从 Python 脚本将 pdf 转换为 600 dpi 的 tiff 和 96 dpi 的 jpg 我使用 imagemagick 命令行完成了这项任务 但我想使用python中的Imagemagick将
  • os.Mkdir 和 os.MkdirAll 权限

    我正在尝试在程序开始时创建一个日志文件 我需要检查是否 log如果不创建目录 则目录存在 然后继续创建日志文件 好吧 我尝试使用os Mkdir 也os MkdirAll 但无论我在第二个参数中输入什么值 我都会得到一个没有权限的锁定文件夹
  • Linux 可执行文件与 OS X“兼容”吗?

    如果您在基于 Linux 的平台上用 C 语言编译一个程序 然后将其移植以使用 MacOS 库 它会工作吗 来自编译器的核心机器代码在 Mac 和 Linux 上兼容吗 我问这个问题的原因是因为两者都是 基于 UNIX 的 所以我认为这是真
  • 使用 sh 运行 bash 脚本

    我有 bash 脚本 它需要 bash 另一个人尝试运行它 sh script name sh 它失败了 因为 sh 是他的发行版中 dash 的符号链接 ls la bin sh lrwxrwxrwx 1 root root 4 Aug
  • 如何通过保持目录结构完整来同步路径中匹配模式的文件?

    我想将所有文件从服务器 A 复制到服务器 B 这些文件在不同级别的文件系统层次结构中具有相同的父目录名称 例如 var lib data sub1 sub2 commonname filetobecopied foo var lib dat
  • 为什么我可以直接从 bash 执行 JAR?

    我是一个长期从事 Java 工作的人 并且知道运行带有主类的 JAR 的方法MANIFEST MFJar 中的文件很简单 java jar theJar jar 我用它来启动 Fabric3 服务器 包含在bin server jar在其标
  • 将 jar 作为 Linux 服务运行 - init.d 脚本在启动应用程序时卡住

    我目前正在致力于在 Linux VM 上实现一个可运行的 jar 作为后台服务 我已经使用了找到的例子here https gist github com shirish4you 5089019作为工作的基础 并将 start 方法修改为
  • 多处理:仅使用物理核心?

    我有一个函数foo它消耗大量内存 我想并行运行多个实例 假设我有一个有 4 个物理核心的 CPU 每个核心有两个逻辑核心 我的系统有足够的内存来容纳 4 个实例foo并行但不是 8 个 此外 由于这 8 个核心中的 4 个是逻辑核心 我也不
  • jq中如何分组?

    这是 json 文档 name bucket1 clusterName cluster1 name bucket2 clusterName cluster1 name bucket3 clusterName cluster2 name bu
  • 查找哪个程序运行另一个程序

    我有一个 NAS 运行在 Redhat Linux 的有限版本上 我按照指示破解了它 这样我就可以访问 shell 这很有帮助 我还做了一些修改 其他人也做过修改 除了一个问题之外 它们似乎都工作得很好 不知何故 每隔 22 天 系统就会关
  • 如何通过ssh检查ubuntu服务器上是否存在php和apache

    如何通过ssh检查Ubuntu服务器上apache是 否安装了php和mysql 另外如果安装的话在哪个目录 如果安装了其他软件包 例如 lighttpd 那么它在哪里 确定程序是否已安装的另一种方法是使用which命令 它将显示您正在搜索
  • 如何确保应用程序在 Linux 上持续运行

    我试图确保脚本在开发服务器上保持运行 它会整理统计数据并提供网络服务 因此它应该会持续存在 但一天中有几次 它会因未知原因而消失 当我们注意到时 我们只需再次启动它 但这很麻烦 并且某些用户没有权限 或专有技术 来启动它 作为一名程序员 我
  • Linux 上有关 getBounds() 和 setBounds() 的 bug_id=4806603 的解决方法?

    在 Linux 平台上 Frame getBounds 和 Frame setBounds 的工作方式不一致 这在 2003 年就已经有报道了 请参见此处 http bugs java com bugdatabase view bug do
  • 如何使用 GOPATH 的 Samba 服务器位置?

    我正在尝试将 GOPATH 设置为共享网络文件夹 当我进入 export GOPATH smb path to shared folder I get go GOPATH entry is relative must be absolute

随机推荐