linux基础指令

1 Linux命令
1.1 cd命令集
ifconfig 检查IP地址
pwd: 显示当前路径
cd命令是linux中最基本的命令语句,必须熟练掌握
cd / 返回根目录
cd ~ 用户主目录
cd . 当前目录
cd …返回到上一级目录
cd /usr/ 进入到usr目录
cd – 返回上一个目录
cd 直接回家

1.2 ls目录和文件
ls –l 详细格式,文件权限,时间
ll 和ls –l作用相同
ls .txt 查看所有的txt类型文档
1.3 目录操作
mkdir 创建目录
mkdir a 创建 a目录
mkdir -p a/b 创建 a目录,并在a目录里创建b目录
mkdir -m 777 c 创建一个权限为777的C目录
rmdir 删除目录(如果目录里有文件,则不能用此命令)
1.4 Vi/vim创建/查看/编辑文件
命令行:Esc切换到命令行模式。
编辑模式:
按i,在光标前开始编辑
按a,在光标后开始编辑
按o,在当前行的下一行开始编辑
底行模式:按 shift+:冒号。
:q! 不保存退出
:wq 保存退出
:/world 从当前光标处,向上查找world关键字
:?world 从当前光标处,向后查找world关键字
esc+u 表示撤销
1.5 删除文件
rm 删除文件
rm n.txt 提示y删除n放弃
rm –f n.txt 不提示
rm –rf dirname 不提示递归删除目录下所以内容
rm –rf * 删除所有文件
rm –rf /
删除所有子目录所有和文件
1.6 复制和移动文件
cp复制文件
cp nginx.conf n.txt
cp –R tomcat1 tomcat2 #复制整个目录
mv 修改文件名,移动文件
mv n.txt m.txt
1.7 浏览文件
cat 输出文件所有的内容
more 输出文档所有的内容,分页输出,空格浏览下一屏,q退出
less 用法和more相同,只是通过PgUp、PgOn键来控制
tail 用于显示文件后几号,使用频繁
tail -10 nginx.conf 查看nginx.conf的最后10行
tail –f nginx.conf 动态查看日志,方便查看日志新增的信息
ctrl+c 结束查看
1.8 打包命令
tar命令位于/bin目录下,它能够将用户所指定的文件或目录打包成一个文件,但不做压缩。一般Linux上常用的压缩方式是选用tar将许多文件打包成一个文件,再以gzip压缩命令压缩成name.tar.gz的文件。
-c 创建一个新的tar文件
-v 显示运行过程的信息
-f 指定文件名
-z 调用gzip压缩命令进行压缩
-t 查看压缩文件的内容
-x 解开tar文件
tar –cvf n.tar ./* 压缩当前目录下的所有文件和目录,文件名为n.tar
tar –xvf n.tar 解压压缩包中的文件到当前目录(如果长时间未解压成功 Ctrl+C推出)
tar –cvzf m.tar ./* 解压m.tar文件到当前目录
1.9 grep命令
grep root /etc/passwd 在文件中查找关键字root
grep root /etc/passwd –-color 高亮显示
grep root /etc/passwd –A5 –B5 高亮显示,A后5行,B前5行
grep -n root /etc/passwd 查找并显示行数
grep -v root /etc/passwd 取反,查出不含root的数据

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
MobaXterm一个包含很多功能的小工具,personal版本已经需要收费下载,此版本为之前没有收费前下载的,功能还是比较齐全。 MobaXterm X server and SSH client MobaXterm is your ultimate toolbox for remote computing. In a single Windows application, it provides loads of functions that are tailored for programmers, webmasters, IT administrators and pretty much all users who need to handle their remote jobs in a more simple fashion. MobaXterm provides all the important remote network tools (SSH, X11, RDP, VNC, FTP, MOSH, ...) and Unix commands (bash, ls, cat, sed, grep, awk, rsync, ...) to Windows desktop, in a single portable exe file which works out of the box. More info on supported network protocols There are many advantages of having an All-In-One network application for your remote tasks, e.g. when you use SSH to connect to a remote server, a graphical SFTP browser will automatically pop up in order to directly edit your remote files. Your remote applications will also display seamlessly on your Windows desktop using the embedded X server. See demo You can download and use MobaXterm Home Edition for free. If you want to use it inside your company, you should consider subscribing to MobaXterm Professional Edition: this will give you access to much more features and the "Customizer" software. Features comparison When developing MobaXterm, we focused on a simple aim: proposing an intuitive user interface in order for you to efficiently access remote servers through different networks or systems. Screenshots MobaXterm is being actively developed and frequently updated by Mobatek.

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值