当前位置:网站首页>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边栏推荐
猜你喜欢

简单的页面

Developers, why does the maturity of container technology herald the arrival of cloud native era?
![[cloud native] kernel security in container scenario](/img/cc/828a8f246b28cb02b7efa1bdd8dee4.png)
[cloud native] kernel security in container scenario

Briefly: how are fragments communicated?

字节面试惨遭滑铁卢:一面就被吊打,幸得华为内推,三面拿到offer

01 backpack problem

Automatic integration: yescomusa, an overseas cross-border e-commerce, cooperates with cloud expansion to realize one-stop Automation Service

The SQL statement concat cannot find the result

关联性——典型相关分析

微信支付 APP端 第三弹 申请退款
随机推荐
面试官:大量请求 Redis 不存在的数据,从而影响数据库,该如何解决?
Interviewer: why does database connection consume resources? I can't even answer.. I was stunned!
【mysql篇-基础篇】通用语法2
How much is the fixed asset management system and the price of the fixed asset management system
[cloud native] kernel security in container scenario
微信支付 APP端 第三弹 申请退款
关联性——典型相关分析
【服装软件】服装出产办理体系选型的准则有哪些?
[MySQL basic] general syntax 2
Five key elements of the data center
【UML】UML的几种关系(依赖-关联-聚合-组合-继承-实现)
【Spark】scala基础操作(持续更新)
[qnx hypervisor 2.2 user manual]6.2.2 communication between guest and host
Interviewer: how to solve the problem of massive requests for data that does not exist in redis, which affects the database?
外包干了三年,废的一踏糊涂...
视频转图像-cv2.VideoCapture()用法
Mr. Hu Bo, CIO of weiduomei, a scientific innovator: digitalization is a bloodless revolution, and the correct answer lies in the field of business
Developers, why does the maturity of container technology herald the arrival of cloud native era?
Is there any discount for securities account opening? Is it safe to open an account online?
I / o initial et son fonctionnement de base