|
mkdir #make directory
pwd #print working directory
cd #change directory
cd ~ or cd #home directory
cd .. #previous (parent directory)
ls #list contents
touch *.txt #create empty file *.txt
vim *txt #text editor see More-- http://yannesposito.com/Scratch/en/blog/Learn-Vim-Progressively/
cat #catalog file contents cat FILE
head #show first few lines of a file 默认10行
tail #show last few lines of a file 默认10行
more #view file (with less options)
less #view file (with more options)
seq #write a sequence of numbers [seq 首数 增量 尾数]
rmdir #remove empty directory
rm #remove file(s)
cp #copy files/directories
mv #move files/directories
wc #word count
sort #sort files sort FILE1 > SORTED_FILE1
uniq #display unique lines uniq [OPTIONS] INFILE > OUTFILE
tr #translate or transliterate a file,replace character tr [OPTIONS] “STRING1” “STRING2” < INFILE
######管道和重定向
cmd1 | cmd2 #send output of cmd1 to cmd2 cat FILENAME | sort | uniq
cmd < file #use file as input
cmd > file #write output to file
cmd >> file #append output to file,不直接覆盖,添加文本内容
######文本操作,正则表达
grep #search a pattern grep [OPTIONS] “PATTERN” FILENAME
sed #stream editor sed 'OPERATION/REGEXP/REPLACEMENT/FLAGS' FILENAME
* #variable used to represent many characters ls *.txt
’?’ #variable used to represent any one character ‘ls’ ?.txt
######数据下载
wget #URL download specified URL wget https://saltandpepper.jpg
scp #secure copy scp username@hostname/Path2Folder/FILENAME .
rsync #remote sync rsync -avz -e ssh username@hostname:/Path2Folder .
推荐好用的Linux命令大全网站 https://man.linuxde.net/
教程中命令索引 https://ss64.com/bash/index.html
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-10-12 12:09
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社