linux常用的配置有哪些?
发表于:2025-12-03 作者:千家信息网编辑
千家信息网最后更新 2025年12月03日,变量值echo $USERecho $?echo $PS1echo $PATH配置文件修改部分:[root@node4~]#cp /etc/DIR_COLORS ~/dir_colors vim ~
千家信息网最后更新 2025年12月03日linux常用的配置有哪些?
变量值
echo $USERecho $?echo $PS1echo $PATH
配置文件修改部分:
[root@node4~]#cp /etc/DIR_COLORS ~/dir_colors vim ~/dir_colors 88 DIR 01;33 # directory[root@centos6 ~]#vim ~/.bashrc alias rm='rm -i'alias cp='cp -i'alias mv='mv -i'alias grep='grep --color=auto'# Source global definitionsif [ -f /etc/bashrc ]; then . /etc/bashrcfialias cdnet='cd /etc/sysconfig/network-scripts/' [root@centos6 ~]#. .bashrc[root@node4~]#cat ~/.vimrcset nuset culset ai set pasteset icset ai centos6 防火墙: service iptables stop chconfig iptables off centos7:防火墙: systemctl stop firewalld systemctl disable firewalld
日志清理部分:
[root@centos6 /proc/10]#find / -mount -type f -size +100M |xargs -i du -sh {}|sort -nr3.8G /root/centos6.9.iso脚本部分:
df |grep ^/dev/sd |sed -r "s/.*[ ]+([0-9]{1,3})%.*/\1/"df -i |grep ^/dev/sd |sed -r "s/.*[ ]+([0-9]{1,3})%.*/\1/"[root@node4~]#ifconfig eth0 |head -n2 |tail -n1 |tr -s " " |cut -d " " -f3192.168.137.47[root@centos6 ~]#ifconfig eth0 |head -n2 |tail -n1 |cut -d ":" -f2 |cut -d " " -f1192.168.137.6[root@centos6 /app]#df |tr -s " " "%" |cut -d % -f 5 [root@node4/var/log/httpd]#cut -d " " -f1 access_log |sort |uniq -c|sort -nr 4 192.168.137.1 2 192.168.0.118[root@node4/var/log/httpd]#awk '{a[$1]++}END{for (i in a ){print i,a[i]}}'< /var/log/httpd/access_log[root@node4/app]#seq 1 10 |sort -R |head -n1 随机取数3[root@node4/app]#cut -d: -f1,3 /etc/passwd |sort -t: -k2 -nroot:0bin:1daemon:2adm:3lp:4[root@node4/app]#cat /var/log/httpd/access_log |cut -d " " -f1 |sort |uniq -c |sort -nr 7 192.168.137.1 2 192.168.0.118 [root@centos6 /app]#awk 'BEGIN{x=1.5;y=1024;z=85/100;printf "%0.2f\n",x*y*z}' 1305.60[root@node4~]#df |grep /dev/sd |grep -o "[0-9]\+%" |grep -o "[0-9]\+" |sort -nr |head -n129[root@node4~]#egrep -v "^#|^$" /etc/fstab[root@node4~]#grep -v -e "^#" -e "^$" /etc/fstab[root@node4~]#grep -v -e"^[[:space:]]*$" -e "^#" /etc/fstab [root@node4~]#cat /etc/passwd |grep "^\(.*\):.*/\1$"sync:x:5:0:sync:/sbin:/bin/syncshutdown:x:6:0:shutdown:/sbin:/sbin/shutdownhalt:x:7:0:halt:/sbin:/sbin/halt[root@node4~]#cat /etc/passwd |egrep "^(.*):.*/\1$" axy[root@node4~]#echo axy |egrep "(a|b)xy"axy[root@node4~]#cat /etc/redhat-release|grep -o " [0-9]\+." |grep -o "[0-9]\+" 7[root@node4~]#cat /etc/centos-release |grep -o "[0-9]\+" |head -n17分组:\(\) 将一个或多个字符捆绑在一起,当作一个整体进行处理,如: \(root\)\+ 分组括号中的模式匹配到的内容会被正则表达式引擎记录于内部的变量中,这 些变量的命名方式为: \1, \2, \3, ... \1 表示从左侧起第一个左括号以及与之匹配右括号之间的模式所匹配到的字符 示例: \(string1\+\(string2\)*\) \1 :string1\+\(string2\)* \2 :string2 后向引用:引用前面的分组括号中的模式所匹配字符,而非模式本身 或者:\| 示例:a\|b: a或b C\|cat: C或cat \(C\|c\)at:Cat或cat
修改密码部分;
密码部分:[root@centos6 /app]#openssl rand -base64 100 |tr -dc "[:alnum:]"|head -c124oa9aPP1tr9I[root@centos6 /app]#cut -d : -f 1,3 /etc/passwd [root@centos6 /app]#df |tr -s " " "%" |cut -d % -f 5
变量:
[root@centos6 /app]# echo $[$RANDOM%80+1]30
[root@node4~]#egrep -w "^(root|sun)" /etc/passwd|cut -d: -f1,7
root:/bin/bash
sun:/bin/bash
ip地址:
[root@node4~]#egrep -w "^(root|sun)" /etc/passwd|cut -d: -f1,7
root:/bin/bash
sun:/bin/bash
部分
括号
模式
变量
字符
分组
密码
示例
防火墙
防火
配置
之间
内容
地址
多个
引擎
整体
文件
方式
日志
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
数据库启动事件命令
怎么搭建做系统的服务器
医疗数据库的安全威胁
在线工具软件开发
好用的代理服务器搭建
计算机网络技术基础知识介绍
江湾网络安全
京津冀数据库是干什么的
密码字典数据库
黄浦区综合软件开发销售方法
威海家和网络技术公司
服务器登录失败无法输入开机密码
跟踪系统软件开发
网络安全 统计
金蝶非法加密服务器
旋转轮胎用哪个软件开发模组
中央整顿网络安全内容
高科技互联网时代下载
数据库的完整性约束都有什么
2022年重要时间节点网络安全
我国网络安全趋势
代理服务器 上国外网站
易语言财经数据库
数据库技术有哪两种模型
网络安全和国际商务
计算机网络技术课本主编都有谁
上海动产管理软件开发定制电话
拉萨市软件开发公司那个好
揭阳网络安全平台
警察网络安全检测