首页 文章 精选 留言 我的

精选列表

搜索[管道服务],共10026篇文章
优秀的个人博客,低调大师

CentOS7设置SWAP分区,小内存服务器的救世主

前言 Swap分区在系统的物理内存(这里应该是运行内存)不够用的时候,把物理内存中的一部分空间释放出来,以供当前运行的程序使用。那些被释放的空间可能来自一些很长时间没有什么操作的程序,这些被释放的空间被临时保存到Swap分区中,等到那些程序要运行时,再从Swap分区中恢复保存的数据到内存中。 设置 1.添加SWAP分区 sh 复制代码 cd / && dd if=/dev/zero of=swapfile bs=1024 count=4194304 chmod 600 /swapfile && mkswap /swapfile swapon /swapfile && swapon -s echo "/swapfile swap swap defaults 0 0" >> /etc/fstab 注: count=4194304中4194304为交换分区大小 4194304=102410244大小为4G 交换区大小设置有个参考依据,物理内存小于4G则SWAP设置为物理内存的两倍、物理内存等于4G则SWAP设置为4G、物理内存大于4G则SWAP设置为物理内存的1/2。 2.重启系统 sh 复制代码 shutdown -r now 3.查看分区结果 sh 复制代码 free -m 4.关闭交换空间 sh 复制代码 cd / && swapoff swapfile && rm -rf swapfile

优秀的个人博客,低调大师

Linux管道及IO重定向小练习

1.统计/usr/bin目录下的文件个数 1 2 3 [root@localhost ~] # ls /usr/bin | wc -l 1306 [root@localhost ~] # 2.取出当前系统上所有用户的SHELL,要求,每种SHELL只显示一次,并且按顺序进行显示 1 2 3 4 5 6 7 8 9 10 [root@localhost ~] # cut -d: -f7 /etc/passwd | sort -u /bin/bash /bin/nologin /bin/sync /bin/tcsh /sbin/halt /sbin/login /sbin/nologin /sbin/shutdown [root@localhost ~] # 3.思考:如何显示/var/log目录下每个文件的内容类型? 1 2 3 4 5 6 7 8 9 10 11 [root@localhost ~] # file /var/log/* /var/log/acpid : ASCII text /var/log/anaconda .log: ASCII English text, with very long lines /var/log/anaconda .syslog: ASCII English text /var/log/anaconda .xlog: ASCII English text /var/log/audit : directory /var/log/boot .log: empty /var/log/boot .log.1: empty /var/log/boot .log.2: empty /var/log/boot .log.3: empty /var/log/boot .log.4: empty 4.取出/etc/inittab文件的第6行 1 2 3 4 5 6 7 8 9 10 [root@localhost ~] # head -6 /etc/inittab # # inittab This file describes how the INIT process should set up # the system in a certain run-level. # # Author: Miquel van Smoorenburg, <miquels@drinkel.nl.mugnet.org> # Modified for RHS Linux by Marc Ewing and Donnie Barnes [root@localhost ~] # head -6 /etc/inittab | tail -1 # Modified for RHS Linux by Marc Ewing and Donnie Barnes [root@localhost ~] # 5.取出/etc/passwd文件中倒数第9个用户的用户名和SHELL,显示到屏幕上并将其保存至/tmp/uses文件中 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 [root@localhost ~] # tail -9 /etc/passwd zhangfengzhe10:x:1102:1102:: /home/zhangfengzhe10 : /bin/bash zhangfengzhe11:x:1103:1103:: /home/zhangfengzhe11 : /sbin/nologin zhangfengzheforsys:x:101:102:: /home/zhangfengzheforsys : /bin/bash test1:x:1104:1104:: /home/test1 : /bin/bash mandriva:x:4004:3004:: /home/mandriva : /bin/bash fedora:x:2003:2003:Fedora Commnuity: /home/fedora : /bin/tcsh hbase:x:102:103:: /home/hbase : /bin/nologin openstack:x:4005:4005:: /home/openstack : /bin/bash hive:x:5000:5000:: /home/hive : /bin/bash [root@localhost ~] # tail -9 /etc/passwd | head -1 zhangfengzhe10:x:1102:1102:: /home/zhangfengzhe10 : /bin/bash [root@localhost ~] # tail -9 /etc/passwd | head -1 | cut -d: -f1,7 zhangfengzhe10: /bin/bash [root@localhost ~] # tail -9 /etc/passwd | head -1 | cut -d: -f1,7 | tee /tmp/users zhangfengzhe10: /bin/bash [root@localhost ~] # cat /tmp/users zhangfengzhe10: /bin/bash [root@localhost ~] # 6.显示/etc目录下所有以pa开头的文件,并统计其个数 1 2 3 4 5 6 7 [root@localhost ~] # ls -ld /etc/pa*/ drwxr-xr-x 2 root root 4096 Mar 5 2012 /etc/pam .d/ drwxr-xr-x 2 root root 4096 Aug 17 2011 /etc/pam_pkcs11/ drwxr-xr-x 3 root root 4096 Aug 17 2011 /etc/pango/ [root@localhost ~] # ls -ld /etc/pa*/ | wc -l 3 [root@localhost ~] # 7.不使用文本编辑器,将alias cls=clear一行内容添加至当前用户的.bashrc文件中 1 2 3 4 5 6 7 8 9 10 11 12 13 14 [root@localhost ~] # echo "alias cls='clear'" alias cls= 'clear' [root@localhost ~] # echo "alias cls='clear'" >> ~/.bashrc [root@localhost ~] # tail -1 ~/.bashrc alias cls= 'clear' [root@localhost ~] # tail ~/.bashrc alias cp = 'cp -i' alias mv = 'mv -i' # Source global definitions if [ -f /etc/bashrc ]; then . /etc/bashrc fi alias cls= 'clear' [root@localhost ~] # LINUX的重要哲学思想: 组合小命令完成复杂功能。 本文转自zfz_linux_boy 51CTO博客,原文链接:http://blog.51cto.com/zhangfengzhe/1413214,如需转载请自行联系原作者

资源下载

更多资源
Mario

Mario

马里奥是站在游戏界顶峰的超人气多面角色。马里奥靠吃蘑菇成长,特征是大鼻子、头戴帽子、身穿背带裤,还留着胡子。与他的双胞胎兄弟路易基一起,长年担任任天堂的招牌角色。

腾讯云软件源

腾讯云软件源

为解决软件依赖安装时官方源访问速度慢的问题,腾讯云为一些软件搭建了缓存服务。您可以通过使用腾讯云软件源站来提升依赖包的安装速度。为了方便用户自由搭建服务架构,目前腾讯云软件源站支持公网访问和内网访问。

Nacos

Nacos

Nacos /nɑ:kəʊs/ 是 Dynamic Naming and Configuration Service 的首字母简称,一个易于构建 AI Agent 应用的动态服务发现、配置管理和AI智能体管理平台。Nacos 致力于帮助您发现、配置和管理微服务及AI智能体应用。Nacos 提供了一组简单易用的特性集,帮助您快速实现动态服务发现、服务配置、服务元数据、流量管理。Nacos 帮助您更敏捷和容易地构建、交付和管理微服务平台。

WebStorm

WebStorm

WebStorm 是jetbrains公司旗下一款JavaScript 开发工具。目前已经被广大中国JS开发者誉为“Web前端开发神器”、“最强大的HTML5编辑器”、“最智能的JavaScript IDE”等。与IntelliJ IDEA同源,继承了IntelliJ IDEA强大的JS部分的功能。

用户登录
用户注册