当前位置:网站首页>Command line Basics
Command line Basics
2022-06-30 00:42:00 【Passerby_ Wang】
Catalog
One 、 Redirect
1、 function
Redirect Save the screen display information to a file
2、 Format
Output override redirection display information > file
Output additional redirection display information >> file
Output force override redirection display information >| file
Input redirection command < file
3、 example
[[email protected] ~]# hostname > /home/wangwu/hostname.txt
[[email protected] ~]# cat /home/wangwu/hostname.txt
localhost[[email protected] ~]# hostname >> /home/wangwu/hostname.txt
[[email protected] ~]# cat /home/wangwu/hostname.txt
localhost
localhost[[email protected] ~]# hostname >| /home/wangwu/hostname.txt
[[email protected] ~]# cat /home/wangwu/hostname.txt
localhost[[email protected] ~]# cat < /home/wangwu/hostname.txt
localhostTwo 、 Pipeline operation
1、 function
Pipeline command Use | Leave the standard output of the previous command to the next
2、 Format
command | command | ...
3、 example
[[email protected] ~]# ifconfig | head -1
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 15003、 ... and 、find command
1、 function
find command Recursively find the corresponding condition according to the preset condition
2、 Format
find Catalog Conditions
find [ Catalog ] [ Conditions ] -exec Processing command Search results \;
Find by criteria , And deal with the results
3、 Options
Common condition expression
-type type (f、d、l)
-name“ Document name ”
-size +|- file size (k、M、G)
-user user name
-mtime Modification time
4、 example
[[email protected] ~]# find /etc/ -name passwd
/etc/passwd[[email protected] ~]# find /boot/ -size +50M -exec ls -lh {} \;
-rw-------. 1 root root 71M Dec 4 15:22 /boot/initramfs-0-rescue-dbe7b11ce791478cbe8b60d8ffa6de6b.imgFour 、grep command
1、 function
grep command For searching text content , Sure Use Regular expressions , Or from Extract text lines according to string format
2、 Format
grep [ Options ] ‘ Regular expressions ’ text file
3、 Common command options
-v Reverse match
-i Ignore case
-c Only the matching line numbers are output
-h Do not display the file name when querying the file
-l When querying a file, only the file name containing matching characters is output
-n Show matching line numbers
-s Do not display error messages
4、 Common regular expressions
Wang Include string Wang
^Wang In string Wang start
Wang$ In string Wang ending
Wan. Wan+ Match a single character
W* W+ Any number of characters
5、 example
[[email protected] wangwu]# cat wangwu.txt
Wang
Wang wu
Da Wang
Wang1
wang[[email protected] wangwu]# grep Wang wangwu.txt
Wang
Wang wu
Da Wang
Wang1[[email protected] wangwu]# grep ^Wang wangwu.txt
Wang
Wang wu
Wang1[[email protected] wangwu]# grep Wang$ wangwu.txt
Wang
Da Wang[[email protected] wangwu]# grep Wan. wangwu.txt
Wang
Wang wu
Da Wang
Wang1[[email protected] wangwu]# grep W* wangwu.txt
Wang
Wang wu
Da Wang
Wang1边栏推荐
- 网络方向哪个发展更好?数据通信工程师学习路线分享
- Yunna | fixed assets system management, NC system management where are the fixed assets
- How to design test cases
- What is the essential difference between get and post requests?
- leetcode-1. Sum of two numbers
- Botu V16 changes the model and firmware version of PLC
- 数据中台咋就从“小甜甜”变成了“牛夫人”?
- 【mysql篇-基础篇】通用语法2
- 网工常见面试题分享:Telnet、TTL、路由器与交换机
- How to customize templates and quickly generate complete code in idea?
猜你喜欢
![[cloud native] kernel security in container scenario](/img/cc/828a8f246b28cb02b7efa1bdd8dee4.png)
[cloud native] kernel security in container scenario

Initial i/o and its basic operations

Yunna | how to use the system to manage fixed assets? How to manage fixed assets?

YuMinHong: my retreat and advance; The five best software architecture patterns that architects must understand; Redis kills 52 consecutive questions | manong weekly VIP member exclusive email weekly

Mysql Duplicate entry ‘xxx‘ for key ‘xxx‘

如何做好测试用例设计

2022年最新最详细IDEA关联数据库方式、在IDEA中进行数据库的可视化操作(包含图解过程)

IDEA工具快捷键的使用

HDCP Paring

Common interview questions for network workers: Telnet, TTL, router and switch
随机推荐
字节、字、双字 关系
岁月匆匆那年
[lorawan node application] the application and power consumption of Anxin ra-08/ra-08h module in lorawan network
Bytek suffered a disastrous defeat in the interview: he was hanged on one side, but fortunately Huawei pushed him in, and he got an offer on three sides
Automatic integration: yescomusa, an overseas cross-border e-commerce, cooperates with cloud expansion to realize one-stop Automation Service
【编程题】迷宫问题
Interviewer: why does database connection consume resources? I can't even answer.. I was stunned!
Briefly: how are fragments communicated?
[MySQL basic] general syntax 2
[cloud native] kernel security in container scenario
Use of shortcut keys for idea tools
I / o initial et son fonctionnement de base
间歇采样转发干扰
降低打新的预期
DataGridView上移 下移行
Is there any discount for securities account opening? Is it safe to open an account online?
股票网上开户及开户流程怎样?还有,在线开户安全么?
Initial i/o and its basic operations
Interviewer: how to solve the problem of massive requests for data that does not exist in redis, which affects the database?
Swift notes