Linux指令学习

本文作为学习Hua Hua “玩转Linux命令行”的笔记,视频地址:https://www.youtube.com/playlist?list=PLLuMmzMTgVK6LIon2E7rjM2XBInMzfmjQ

EP1: 

echo:自言自语

pwd: print working directory,打印目前位置

cd: change directory, cd path, cd ~, cd ..

ls:  list directory contents

    ls

    ls -l #list mode

    ls -l -a = ls -la  # list mode + all files

    ls -lh # list mode + human readable size

man: 用户手册

    man pwd

    man -h

    grep --help

cat: 打印文件内容,concatenate and print files

    cat a.txt

    cat a.txt b.txt # print a.txt then b.txt

    cat < a.txt # read from stdin

head and tail

    head a.txt #默认前十行

    tail a.txt #默认后十行

    tail -n 5 a.txt     #-n+number,打印后number行

    tail -f a.txt     #-f用来观察变化,比如观察log

less: read-only version of vi

    less a.txt

grep: 内容查找

    cat a.txt | grep 8 #查找A中带8的内容

    cat a txt | grep -n 8 #查找A中带8并且返回行号   

wc:单词统计 word, line and byte count

    man wc | wc #统计wc这个manual手册,返回A-行数 B-单词书 C-字节数

重定向:改变输入输出设备

    标准输入stdin/标准输入stdout:控制台/键盘/屏幕

    echo hello > hello.txt # redirect to a file

    echo world >> hello.txt # append to a file

    cat < hello.txt # use file as stdin, read from file

管道:将前一个命令的标准输出作为下一个程序的标准输入

    man less | grep sim #在less manual中找有sim的内容

    man less | grep -n sim | grep That > that.txt #multiple pipe 在less manual中找有sim内容以及其行,在其中找有That内容及其行数,重定向到that.txt文件

利用nano实现echo:

打开nano: 直接输入nano

写代码

ctrl+x退出并保存代码

g++编译

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值