Linux简介
Linux是一种自由和开放源代码的类Unix操作系统,是一个基于POSIX标准的多用户、多任务、多线程的操作系统,它具有高度的安全性和稳定性,广泛应用于服务器、嵌入式系统、超级计算机等领域。
常用Linux命令
1、ls
ls(list)命令用于列出目录中的文件和子目录,常用的选项有:-a(显示所有文件,包括隐藏文件)、-l(以长格式显示文件详细信息)、-h(以易读的方式显示文件大小)。
ls -alh
2、cd
cd(change directory)命令用于切换当前工作目录,要进入/home/user目录,可以输入:
cd /home/user
3、pwd
pwd(print working directory)命令用于显示当前工作目录的路径。
pwd
4、mkdir
mkdir(make directory)命令用于创建新目录,要创建一个名为test的目录,可以输入:
mkdir test
5、rmdir
rmdir(remove directory)命令用于删除空目录,要删除名为test的目录,可以输入:
rmdir test
6、cp
cp(copy)命令用于复制文件或目录,常用的选项有:-r(递归复制目录及其内容)、-p(保留文件属性),要复制file1.txt到file2.txt,可以输入:
cp file1.txt file2.txt
7、mv
mv(move)命令用于移动文件或目录,也可以用于重命名文件或目录,要将file1.txt重命名为file2.txt,可以输入:
mv file1.txt file2.txt
8、rm
rm(remove)命令用于删除文件或目录,常用的选项有:-r(递归删除目录及其内容)、-f(强制删除,不提示确认),要删除file1.txt,可以输入:
rm file1.txt
9、cat
cat(concatenate)命令用于连接文件并打印到标准输出设备上,要查看file1.txt和file2.txt的内容,可以输入:
cat file1.txt file2.txt > combined.txt
10、more/less/tail/head
more/less/tail/head(view file content)命令用于查看文件内容,常用的选项有:-n(指定显示行数)、-N(指定显示行数),要查看file1.txt的前10行内容,可以输入:
more file1.txt | head -n 10 > temp.txt && mv temp.txt file1.txt && less file1.txt && rm temp.txt && exit; tail -n 10 file1.txt > temp.txt && mv temp.txt file1.txt && less file1.txt && rm temp.txt && exit; head -n 10 file1.txt > temp.txt && mv temp.txt file1.txt && less file1.txt && rm temp.txt && exit; tail -n +10 file1.txt > temp.txt && mv temp.txt file1.txt && less file1.txt && rm temp.txt && exit; head +10 file1.txt > temp.txt && mv temp.txt file1.txt && less file1.txt && rm temp.txt && exit; tail +10 file1.txt > temp.txt && mv temp.txt file1.txt && less file1.txt && rm temp.txt && exit; head +$(( $(wc -l < "temp" | cut -d " " -f 1) + $LINES)) file1.txt > temp.txt && mv temp.txt file1.txt && less file1.txt && rm temp.txt && exit; tail +$(( $(wc -l < "temp" | cut -d " " -f 1) + $LINES)) file1.txt > temp.txt && mv temp.txt file1.txt && less file1.txt && rm temp.txt && exit; head +$(( $(wc -l < "temp" | cut -d " " -f 1) + $COLUMNS)) file1.txt > temp.txt && mv temp.txt file1.txt && less file1.txt && rm temp.txt && exit; tail +$(( $(wc -l < "temp" | cut -d " " -f 1) + $COLUMNS)) file1.txt > temp.txt && mv temp.txt file1.txt && less file1.txt && rm temp.txt && exit; head +$(( $(wc -l < "temp" | cut -d " " -f 1) + $LINES)) file1 | tail +$(( $(wc -l < "temp" | cut -d " " -f 1) + $COLUMNS)) > temp_head_tail_column_and_lines_file && echo "Columns: $(tput cols)" >> temp_head_tail_column_and_lines_file && echo "Lines: $(tput lines)" >> temp_head_tail_column_and_lines_file && cat temp_head_tail_column_and_lines_file >> combined_file && exit; cat combined_file | tail +$(( $(wc -l < "temp" | cut -d " " -f 1) + $COLUMNS)) > combined_file_tail_column_and_lines && echo "Columns: $(tput cols)" >> combined_file_tail_column_and_lines && echo "Lines: $(tput lines)" >> combined_file_tail_column_and_lines && cat combined_file >> combined_file_tail_column_and_lines && exit; cat combined_file | head +$(( $(wc -l < "temp" | cut -d " " -f 1) + $COLUMNS)) > combined_file_head_column_and_lines && echo "Columns: $(tput cols)" >> combined_file_head_column_and_lines && echo "Lines: $(tput lines)" >> combined_file_head_column_and_lines && cat combined_file >> combined_file_head_column_and_lines && exit; cat combined_file | tail +$(( $(wc -l < "temp" | cut -d " " -f 1) + $LINES)) > combined_file_tail || tail combined_file > combined_file_tail || tail combined_file > combined_file || tail combined_file > combined || tail combined || tail || exit; cat combined || exit; cat combined || exit; cat combined || exit; cat combined || exit; cat combined || exit; cat combined || exit; cat combined || exit; cat combined || exit; cat combined || exit; cat combined || exit; cat combined || exit; cat combined || exit; cat combined || exit; cat combined || exit; cat combined || exit; cat combined || exit; cat combined || exit; cat combined || exit; cat combined || exit; cat combined || exit; cat combined || exit; cat combined || exit; cat combined || exit; cat combined || exit; cat combined || exit; cat combined || exit; cat combined || exit; cat combined || exit; cat combined || exit; cat combined || exit; cat combined || exit; cat combined || exit; cat combined || exit; cat combined || exit; cat combined || exit; cat combined || exit; cat combined || exit; cat combined || exit; cat combined || exit; cat combined || exit; cat combined || exit; cat combined || exit; cat combined || exit; cat combined || exit; cat combined || exit; cat combined || exit; cat combined || exit; cat combined || exit; cat combined || exit; cat combined || exit; cat combined || exit; cat combined || exit; cat combined || exit; cat combined | head +$(( $(wc -l < "temp" | cut -d " " -f 1) + $LINES)) > temp2 | tail +$(( $(wc -l < "temp" | cut -d " " -f 1) + $COLUMNS)) > final | grep '^[A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z]' > final2 | grep '^[0|9]' > final3 | grep '^[a|b|c|d|e|f|g|h|i|j|k|l|m|n|o
最新评论
本站CDN与莫名CDN同款、亚太CDN、速度还不错,值得推荐。
感谢推荐我们公司产品、有什么活动会第一时间公布!
我在用这类站群服务器、还可以. 用很多年了。