Linux命令行
Linux常用命令:
初来乍到
-
自言自语 echo
-
% echo hello world % echo $PWD / echo $HOME / echo ~ -
我在哪 pwd (Print Working Directory )
-
% pwd -
换个地方 cd ( Change Directory )
-
% cd path / cd ~ % cd .. #返回上一级目录 % cd ./ #当前目录 % cd / #切换到根目录 -
瞅瞅 ls ( List Directory Contents)
-
% ls % ls -l % ls -l -a % ls -lh
文件内容
-
打印文件内容 cat (Concatenate and print files )
-
% cat a.txt % cat a.txt b.txt % cat < a.txt -
头和尾 head and tail
-
% head a.txt % tail a.txt -
交互浏览 less (readonly version of vi )
-
% less a.txt -
内容查找 / or grep
-
% man less | grep -n sim -
单词统计 wc ( Word, line and byte count )
-
% man wc | wc
重定向和管道
-
重定向:改变输入输出设备
-
% echo hello > hello.txt % echo world >> hello.txt % cat < hello.txt -
管道:将前一个命令的标准输出作为下一个程序的标准输入
-
% man less | grep sim % man less | grep -n sim | grep That > that.txt
寻求帮助
-
用户手册 man (Manual)
-
% man pwd % man man -
内置帮助 命令 -h
-
% man -h % grep --help -
面向StackOverflow编程
参考:花花酱
!!!坚持记录博客!!!

浙公网安备 33010602011771号