linux基础命令练习1

简介:

# ls -l | grep "^d"   

# cat /etc/ssh/sshd_config | grep -v  ^#

[^xx]  不包括xx

# ls -Fl  | grep /$

# grep   -Ev "^#|^$"   /etc/ssh/sshd_config

# egrep   -v "^#|^$"   /etc/ssh/sshd_config 

# find  . -type d ! -name "."

# find  . -type d ! -name "."  -prune

# tree -Ld  1

# ls -l | sed -n /^d/p

ls -l | awk '/^d/'

# ls -lF | sed -n '/\/$/p'

#find   -o    -and   !

^$空行

\

# cd -

当一个命令的输出,含有我们需要的内容的时候,我们要想到这个命令可能会有对应的参数直接显示,我们需要的内容。

# ll -lrt /etc/   最近时间的文件            (照着更新时间,反着排练文件)

# grep hequan  --color=auto   1.txt

# source /etc/profile  别名生效

#ln  硬链接      -s 软连接          目录          新的目录

# find ./  -type f -name "*.log"  -mtime  +7  | xargs rm -f

for n in `seq 100`; do sleep 1 ; echo $n >> /var/log/messages ;done 

# cat -n         #more   #less    :set nu :set  nonu  

# runlevel

more  less 

# ls /etc/rc.d/rc3.d/ | grep sshd

# grep -Ev "^#|^$"  /etc/inittab

# vi /etc/sysconfig/i18n 

echo    source     export

spacer.gif

# tar zcvf  /tmp/etc.tar.gz  /etc/   打包       筐  苹果 

# tar tf etc.tar.gz  看

# tar vxf   hequan.tar.gz   -C  /tmp/ 解包

 #tar zcfv  hequan.tar.gz     --exclude=/etc/ssh   /etc/        不包括

# tar zcvfX   hequan.tar.gz   a.txt /etc/

 # tar jcvf  hequan.tar.bz  /etc/

# tar jxvf  hequan.tar.bz

-N增量打包

# awk '{print $3 " " $6}'  hequan.txt

# cut -c 6-12,21- hequan.txt

# sed s#,##g  hequan.txt | awk  '{print $3" " $6}'

  

cut  -d  切割   -f数据选列,    -c按字符切割

# wc -l hequan.txt

# cat -n /etc/services  | tail -l 

# sed -n '$='  /etc/services

# awk  '{print NR }'  /etc/services   | tail -l

# ps -ef 

# ps -ef | grep sshd

# ps -ef | grep sshd | wc -l

# ps -ef |grep -v grep | grep sshd 











本文转自 295631788 51CTO博客,原文链接:http://blog.51cto.com/hequan/1758200,如需转载请自行联系原作者
目录
相关文章
|
18小时前
|
安全 网络协议 Linux
linux必学的60个命令
Linux是一个功能强大的操作系统,提供了许多常用的命令行工具,用于管理文件、目录、进程、网络和系统配置等。以下是Linux必学的60个命令的概览,但请注意,这里可能无法列出所有命令的完整语法和选项,仅作为参考
|
20小时前
|
监控 Linux 数据处理
|
20小时前
|
编解码 Ubuntu Linux
|
1天前
|
JSON Linux 数据格式
Linux命令发送http
请注意,`curl`命令非常灵活,可以根据您的需求进行多种配置和自定义。您可以查看 `curl`命令的文档以获取更多详细信息。
4 0
|
2天前
|
安全 Linux 测试技术
|
2天前
|
安全 Linux Windows
Linux中Shutdown命令使用介绍
Linux中Shutdown命令使用介绍
10 2
|
3天前
|
缓存 关系型数据库 Linux
Linux目录结构:深入理解与命令创建指南
Linux目录结构:深入理解与命令创建指南
|
3天前
|
数据挖掘 Linux vr&ar
Linux命令实战:解决日常问题的利器
Linux命令实战:解决日常问题的利器
|
3天前
|
NoSQL Linux Redis
Redis的介绍,以及Redis的安装(本机windows版,虚拟机Linux版)和Redis常用命令的介绍
Redis的介绍,以及Redis的安装(本机windows版,虚拟机Linux版)和Redis常用命令的介绍
17 0
|
3天前
|
安全 Linux Shell
linux基础命令详解
linux基础命令详解
10 0