随笔分类 -  CLI

摘要:vim cheat sheet Keep this handy as you experiment with vim: http://www.fprintf.net/vimCheatSheet.html Here is another guide that covers the commands i 阅读全文
posted @ 2024-07-12 14:42 Zhentiw 阅读(4) 评论(0) 推荐(0) 编辑
摘要:Bash is built to handle multiple programs running in parallel. time cat Type time cat and then hit ctrl-c before one second, as close as possible with 阅读全文
posted @ 2024-06-26 17:54 Zhentiw 阅读(7) 评论(0) 推荐(0) 编辑
摘要:Subshell () You can wrap a cmd into () then it works a spreated command line. $ (if test -f cool.txt; then echo true; else echo false; fi); echo $? fa 阅读全文
posted @ 2024-06-26 17:38 Zhentiw 阅读(6) 评论(0) 推荐(0) 编辑
摘要:Exit code and Operators (&&, ||, 😉 When the previous command run successful, it returns 0, otherwise 1 $ date Wed Jun 26 12:17:17 EEST 2024 $ echo $? 阅读全文
posted @ 2024-06-26 17:31 Zhentiw 阅读(7) 评论(0) 推荐(0) 编辑
摘要:The basic syntax of a for loop in Bash is: for variable in list do commands done Examples Example 1: Iterating Over a List of Words #!/bin/zsh for wor 阅读全文
posted @ 2024-06-11 18:35 Zhentiw 阅读(7) 评论(0) 推荐(0) 编辑
摘要:Create a logger.sh file #!/bin/bash echo `date +'%T %F'` $* >> `date +%F`.log $*: Represents all script arguments Example $ logger hello $ logger hell 阅读全文
posted @ 2024-06-11 18:18 Zhentiw 阅读(2) 评论(0) 推荐(0) 编辑
摘要:Single quotes If you want to use characters like < or > in the arguments to a program, you will need to use quotes so that the shell doesn't try to in 阅读全文
posted @ 2024-06-10 14:43 Zhentiw 阅读(6) 评论(0) 推荐(0) 编辑
摘要:Environment variables are defined by the shell and shell scripts. To list the current environment variables, type export: ~ $ export declare -x DISPLA 阅读全文
posted @ 2024-06-10 14:36 Zhentiw 阅读(8) 评论(0) 推荐(0) 编辑
摘要:watch For example every 5 second, I want to print out the time then save the time into the a txt file $watch -n5 'echo `date +%T` >> hello.txt' # then 阅读全文
posted @ 2024-06-07 20:58 Zhentiw 阅读(6) 评论(0) 推荐(0) 编辑
摘要:Backticks Using to exec cmd and return the output as string $ echo `date` Fri Jun 7 15:40:11 EEST 2024 The same effect you can achieve by using $ echo 阅读全文
posted @ 2024-06-07 20:47 Zhentiw 阅读(3) 评论(0) 推荐(0) 编辑
摘要:Ping ping is a utility used to test the reachability of a host on an IP network and to measure the round-trip time for messages sent from the originat 阅读全文
posted @ 2024-06-06 02:38 Zhentiw 阅读(7) 评论(0) 推荐(0) 编辑
摘要:pbcopy is a command-line utility available on macOS that allows you to copy the output of a command directly to the clipboard. It can be very handy fo 阅读全文
posted @ 2024-06-03 19:52 Zhentiw 阅读(5) 评论(0) 推荐(0) 编辑
摘要:Sometimes it's handy to break long lines into shorter lines. # read moby-dick file for first 250 lines # then fold each line to have max 30 char (-w) 阅读全文
posted @ 2024-05-30 17:49 Zhentiw 阅读(3) 评论(0) 推荐(0) 编辑
摘要:Calendar cal May 2024 Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 # all months cal 2024 # 阅读全文
posted @ 2024-05-30 17:46 Zhentiw 阅读(2) 评论(0) 推荐(0) 编辑
摘要:grep is a powerful command-line tool used for searching text using patterns. It's widely used for finding specific text within files or output streams 阅读全文
posted @ 2024-05-30 03:40 Zhentiw 阅读(8) 评论(0) 推荐(0) 编辑
摘要:curl is a powerful command-line tool for transferring data with URL syntax. It supports various protocols including HTTP, HTTPS, FTP, and many others. 阅读全文
posted @ 2024-05-29 00:58 Zhentiw 阅读(27) 评论(0) 推荐(0) 编辑
摘要:The kill command sends a signal to a process, usually to terminate the process. kill PID This command sends the SIGTERM signal to the process with the 阅读全文
posted @ 2024-05-24 03:11 Zhentiw 阅读(8) 评论(0) 推荐(0) 编辑
摘要:ps The ps command is used to display information about running processes. This command displays a snapshot of the current processes. Common Options: a 阅读全文
posted @ 2024-05-24 02:52 Zhentiw 阅读(4) 评论(0) 推荐(0) 编辑
摘要:Error handling in Bash can be managed using exit statuses and traps. Every commands in Bash returns an exit status (0 for success, non-zero for failur 阅读全文
posted @ 2024-05-23 03:20 Zhentiw 阅读(7) 评论(0) 推荐(0) 编辑
摘要:Functions in Bash allow you to group commands into reusable blocks. This helps make your scripts more modular and easier to manage. function_name() { 阅读全文
posted @ 2024-05-23 03:09 Zhentiw 阅读(4) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示