[20190505]ts 命令在哪裡.txt

来源:https://www.cnblogs.com/lfree/archive/2019/05/05/10814965.html
-Advertisement-
Play Games

[20190505]ts 命令在哪裡.txt--//在論壇問一下ts命令在哪裡?沒人解答,自己也google看了一下:https://unix.stackexchange.com/questions/272433/piping-into-moreutils-ts-with-nanosecond-pr ...


[20190505]ts 命令在哪裡.txt

--//在論壇問一下ts命令在哪裡?沒人解答,自己也google看了一下:
https://unix.stackexchange.com/questions/272433/piping-into-moreutils-ts-with-nanosecond-precision

--//however, if I use the same format string with moreutils' ts, the nanosecond precision fails:

--//應該在1個moreutils包裡面.
--//另外註意有如下都不是:

#  ls -l ts-0.7.3-1.2.x86_64.rpm task-spooler-1.0-1.3.el6.x86_64.rpm
-rw-r--r-- 1 root root 40628 2019-05-05 16:02:38 task-spooler-1.0-1.3.el6.x86_64.rpm
-rw-r--r-- 1 root root 46792 2019-05-05 09:18:37 ts-0.7.3-1.2.x86_64.rpm

--//找到半天僅僅找到rhel 7 的rpm包.
http://rpm.pbone.net/index.php3/stat/4/idpl/55075202/dir/centos_7/com/moreutils-0.49-2.el7.x86_64.rpm.html

# ls -l moreutils-0.49-2.el7.x86_64.rpm perl-*
-rw-r--r--. 1 root root  77156 2019-05-05 16:16:44 moreutils-0.49-2.el7.x86_64.rpm
-rw-r--r--. 1 root root  39464 2019-05-05 16:27:12 perl-IO-1.25-2.2.x86_64.rpm
-rw-r--r--. 1 root root  42580 2019-05-05 16:31:03 perl-IO-Tty-1.10-11.el7.x86_64.rpm
-rw-r--r--. 1 root root 124524 2019-05-05 16:21:30 perl-IPC-Run-0.92-2.el7.noarch.rpm
-rw-r--r--. 1 root root  52744 2019-05-05 16:23:37 perl-TimeDate-2.30-2.el7.noarch.rpm
-rw-r--r--. 1 root root  16872 2019-05-05 16:21:37 perl-Time-Duration-1.06-17.8.noarch.rpm

# rpm -ivh moreutils-0.49-2.el7.x86_64.rpm perl-IPC-Run-0.92-2.el7.noarch.rpm perl-TimeDate-2.30-2.el7.noarch.rpm perl-Time-Duration-1.06-17.8.noarch.rpm perl-IO-Tty-1.10-11.el7.x86_64.rpm
warning: moreutils-0.49-2.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 9dbd524d: NOKEY
warning: perl-IPC-Run-0.92-2.el7.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:perl-IO-Tty-1.10-11.el7          ################################# [ 20%]
   2:perl-IPC-Run-0.92-2.el7          ################################# [ 40%]
   3:perl-Time-Duration-1.06-17.8     ################################# [ 60%]
   4:perl-TimeDate-1:2.30-2.el7       ################################# [ 80%]
   5:moreutils-0.49-2.el7             ################################# [100%]

# file /usr/bin/ts
/usr/bin/ts: Perl script, ASCII text executable


# yes | ts | uniq -c
  18069 May 05 16:32:23 y
  72879 May 05 16:32:24 y
  50330 May 05 16:32:25 y
  50756 May 05 16:32:26 y
  67530 May 05 16:32:27 y
  59702 May 05 16:32:28 y
  74953 May 05 16:32:29 y

# ping -i 2 -c 3 192.168.100.40|ts  '%Y-%m-%d %H:%M:%.S'
2019-05-05 16:35:51.603349 PING 192.168.100.40 (192.168.100.40) 56(84) bytes of data.
2019-05-05 16:35:51.603458 64 bytes from 192.168.100.40: icmp_seq=1 ttl=63 time=0.502 ms
2019-05-05 16:35:53.581129 64 bytes from 192.168.100.40: icmp_seq=2 ttl=63 time=0.286 ms
2019-05-05 16:35:55.581410 64 bytes from 192.168.100.40: icmp_seq=3 ttl=63 time=0.279 ms
2019-05-05 16:35:55.581510
2019-05-05 16:35:55.581531 --- 192.168.100.40 ping statistics ---
2019-05-05 16:35:55.581548 3 packets transmitted, 3 received, 0% packet loss, time 4000ms
2019-05-05 16:35:55.581565 rtt min/avg/max/mdev = 0.279/0.355/0.502/0.105 ms

--//%.S顯示秒後面的時間.精度更高.

# ping -i 1 -c 4 192.168.100.40|ts -i  '%.S'
00.000020 PING 192.168.100.40 (192.168.100.40) 56(84) bytes of data.
00.000083 64 bytes from 192.168.100.40: icmp_seq=1 ttl=63 time=0.489 ms
00.978879 64 bytes from 192.168.100.40: icmp_seq=2 ttl=63 time=0.335 ms
00.999936 64 bytes from 192.168.100.40: icmp_seq=3 ttl=63 time=0.280 ms
01.000335 64 bytes from 192.168.100.40: icmp_seq=4 ttl=63 time=0.313 ms
00.000073
00.000010 --- 192.168.100.40 ping statistics ---
00.000007 4 packets transmitted, 4 received, 0% packet loss, time 3000ms
00.000008 rtt min/avg/max/mdev = 0.280/0.354/0.489/0.081 ms

--//裡面還有1些小工具.其中vidir有點恐怖有意思,可以實現像文本編輯器那樣修改文件以及目錄:

# man vidir
VIDIR(1)                                                                                                                                                                                                                                                        VIDIR(1)

NAME
       vidir - edit directory

SYNOPSIS
       vidir [--verbose] [directory|file|-] ...

DESCRIPTION
       vidir allows editing of the contents of a directory in a text editor. If no directory is specified, the current
       directory is edited.

       When editing a directory, each item in the directory will appear on its own numbered line. These numbers are how
       vidir keeps track of what items are changed. Delete lines to remove files from the directory, or edit filenames
       to rename files. You can also switch pairs of numbers to swap filenames.

       Note that if "-" is specified as the directory to edit, it reads a list of filenames from stdin and displays
       those for editing. Alternatively, a list of files can be specified on the command line.

--//演示如下:
# ls -l
total 0
-rw-r--r--. 1 root root 0 2019-05-05 16:48:29 aaa
-rw-r--r--. 1 root root 0 2019-05-05 16:48:32 bbb
drwxr-xr-x. 2 root root 6 2019-05-05 16:48:37 ccc

# vidir
1       ./aaa
2       ./bbb
3       ./ccc

--//修改如下保存,註意前面的編號不要修改:
1       ./aaa1
2       ./bbb2
3       ./ccc3

# ls -l
total 0
-rw-r--r--. 1 root root 0 2019-05-05 16:48:29 aaa1
-rw-r--r--. 1 root root 0 2019-05-05 16:48:32 bbb2
drwxr-xr-x. 2 root root 6 2019-05-05 16:48:37 ccc3

--//如果你刪除了一行,對應的文件在保存後就刪除了.當然我的測試如果目錄非空好像不會刪除.會報目錄非空.


您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • 1 知識大綱 列表的初識 列表的索引切片 列表的增刪改查 列表的嵌套 元組的初識(瞭解) 元組的簡單應用(瞭解) range 2 主要內容 1. 列表的初識 why: 字元串: 存儲少量的數據。字元串只能存儲少量的數據,對於大量的數據用字元串操作不方便也不易存儲。 字元串:無論切片還是對其進行任何操 ...
  • 最近開始用DevExpress組件,發現很好的經驗總結博客,在這裡轉載分享 原作者:https://www.cnblogs.com/wordgao/p/4517011.html 一、如何解決單擊記錄整行選中的問題 View->OptionsBehavior->EditorShowMode 設置為:C ...
  • 問題 最近在進行硬體上位機開發的時候,經常會遇到將 16 進位字元串轉換為 的情況,除了這種需求以外,還需要判定一個字元串是否是有效的 16 進位數據。 解決 字元串轉 的情況可以使用 來解決,16 進位數據的判定則可以結合正則和長度來進行處理。 在這裡我是只接受以下兩種形式的 16 進位字元串,並 ...
  • windows 文件操作命令 cd 切換文件目錄 dir 顯示文件目錄內容 md 創建文件夾 rd 刪除文件夾 copy 拷貝文件 move 移動文件 del 刪除文件 replace 替換文件 mklinnk 創建符號鏈接 attrib 查看或修改文件或目錄屬性 type 查看文件內容 more ...
  • @ "TOC" 1.首先下載虛擬機管理軟體(推薦使用VMware Workstation) 可以在這裡下載 https://blog.51cto.com/happynews/2285644 然後安裝 安裝完成後,打開時推薦使用右鍵,用管理員運行 2.下載你所需要的系統鏡像文件 其實不同版本的linu ...
  • 這裡以Centos7為例: 使用tree命令查看/目錄結構如下: 下麵我們主要探討如下主要目錄: /:根目錄不必多說,文件系統的最頂端,存放系統所有目錄。 bin:該目錄主要存放系統運行所需要的重要命令,和普通用戶可以使用的絕大部分命令。 sbin:主要存放系統管理員使用的系統管理的命令。 etc: ...
  • @ "TOC" quickLook插件是Mac上的快速瀏覽的一個功能,現在win10系統上也能安裝插件,這個插件可以快速瀏覽txt,doc,圖片,表格等文件如下圖: 我認為最方便的地方是你需要查看某一個文件內容不需要編輯的時候,又不想用wps打開時就可以用這個簡單的插件。 安裝方式也很簡單,但是需要 ...
  • 一、echo 1.顯示普通字元串: 這裡的雙引號可以省略。 2.顯示轉義字元: 3.顯示變數: read 命令從標準輸入中讀取一行,並把輸入行的每個欄位的值指定給 shell 變數 輸出: 4.顯示換行: 輸出: 5.顯示不換行: 輸出: 6.顯示定向至文件: 輸出: 7.原樣輸出字元串,不進行轉義 ...
一周排行
    -Advertisement-
    Play Games
  • 移動開發(一):使用.NET MAUI開發第一個安卓APP 對於工作多年的C#程式員來說,近來想嘗試開發一款安卓APP,考慮了很久最終選擇使用.NET MAUI這個微軟官方的框架來嘗試體驗開發安卓APP,畢竟是使用Visual Studio開發工具,使用起來也比較的順手,結合微軟官方的教程進行了安卓 ...
  • 前言 QuestPDF 是一個開源 .NET 庫,用於生成 PDF 文檔。使用了C# Fluent API方式可簡化開發、減少錯誤並提高工作效率。利用它可以輕鬆生成 PDF 報告、發票、導出文件等。 項目介紹 QuestPDF 是一個革命性的開源 .NET 庫,它徹底改變了我們生成 PDF 文檔的方 ...
  • 項目地址 項目後端地址: https://github.com/ZyPLJ/ZYTteeHole 項目前端頁面地址: ZyPLJ/TreeHoleVue (github.com) https://github.com/ZyPLJ/TreeHoleVue 目前項目測試訪問地址: http://tree ...
  • 話不多說,直接開乾 一.下載 1.官方鏈接下載: https://www.microsoft.com/zh-cn/sql-server/sql-server-downloads 2.在下載目錄中找到下麵這個小的安裝包 SQL2022-SSEI-Dev.exe,運行開始下載SQL server; 二. ...
  • 前言 隨著物聯網(IoT)技術的迅猛發展,MQTT(消息隊列遙測傳輸)協議憑藉其輕量級和高效性,已成為眾多物聯網應用的首選通信標準。 MQTTnet 作為一個高性能的 .NET 開源庫,為 .NET 平臺上的 MQTT 客戶端與伺服器開發提供了強大的支持。 本文將全面介紹 MQTTnet 的核心功能 ...
  • Serilog支持多種接收器用於日誌存儲,增強器用於添加屬性,LogContext管理動態屬性,支持多種輸出格式包括純文本、JSON及ExpressionTemplate。還提供了自定義格式化選項,適用於不同需求。 ...
  • 目錄簡介獲取 HTML 文檔解析 HTML 文檔測試參考文章 簡介 動態內容網站使用 JavaScript 腳本動態檢索和渲染數據,爬取信息時需要模擬瀏覽器行為,否則獲取到的源碼基本是空的。 本文使用的爬取步驟如下: 使用 Selenium 獲取渲染後的 HTML 文檔 使用 HtmlAgility ...
  • 1.前言 什麼是熱更新 游戲或者軟體更新時,無需重新下載客戶端進行安裝,而是在應用程式啟動的情況下,在內部進行資源或者代碼更新 Unity目前常用熱更新解決方案 HybridCLR,Xlua,ILRuntime等 Unity目前常用資源管理解決方案 AssetBundles,Addressable, ...
  • 本文章主要是在C# ASP.NET Core Web API框架實現向手機發送驗證碼簡訊功能。這裡我選擇是一個互億無線簡訊驗證碼平臺,其實像阿裡雲,騰訊雲上面也可以。 首先我們先去 互億無線 https://www.ihuyi.com/api/sms.html 去註冊一個賬號 註冊完成賬號後,它會送 ...
  • 通過以下方式可以高效,並保證數據同步的可靠性 1.API設計 使用RESTful設計,確保API端點明確,並使用適當的HTTP方法(如POST用於創建,PUT用於更新)。 設計清晰的請求和響應模型,以確保客戶端能夠理解預期格式。 2.數據驗證 在伺服器端進行嚴格的數據驗證,確保接收到的數據符合預期格 ...