1、ls 命令

查看当前目录下可见的文件、文件夹及其相关权限
常用参数:-l 列表式查看
-al 查看所有,包括隐藏的文件、文件夹
[root@qinshengfei bin]# ls --color 以彩色显示
[root@qinshengfei bin]# ls -l 详情列出目录文件
[root@qinshengfei bin]# ls -a 显示所有文件,包括隐藏文件
[root@qinshengfei bin]# ls -al 列表显示所有文件
[root@qinshengfei bin]# ls -al|more 將目录內容分布显示

2、mkdir 创建文件夹

常用参数 : 直接接文件夹名称
[root@qinshengfei /home]# mkdir test

3、pwd 显示当前工作目录

[root@qinshengfei bin]#  pwd
/usr/bin <== 显示当前工作目录

4、cd 切换目录

[root@qinshengfei /root]#  cd ..       <== 回到上一级目录
[root@qinshengfei /]# cd <== 回到home目录
[root@qinshengfei root]# cd /usr/bin <== 到 /usr/bin 目录

5、rmdir 删除指定目录

如果要删除的目录里面有文件或文件夹,是无法移动的,这时,就需要加上参数 -rf 来强制操作删除。
[root@qinshengfei /root]#   rmdir ./test       <== 删除目录
[root@qinshengfei /root]# rmdir ./test2 -rf <== 删除目录及子目录、文件

6、rm 删除指令文件

[root@qinshengfei /root]# rm test

7、cp 就是 copy 的意思。例如我们要把 .bashrc 这个文件复制到/home目录下,可以:

[root@qinshengfei /root]# cp .bashrc /home

8、mv 移动文件、文件夹

[root@qinshengfei /root]# mv test.txt /home

9、cat 打印文件内容在控制台上,例如要打印mysql的配置文件到控制上

[root@qinshengfei /mysql.conf.d]# cat mysqld.cnf

10、tail 按行显示文件内容

[root@qinshengfei /mysql.conf.d]# tail -n 5  mysqld.cnf

11、less

less命令可查看文件。 它使用起来速度更快,而且您不会无意间修改文件。 使用更少的光标,您可以使用向上和向下箭头键,PgUp和PgDn键以及Home和End键在文件中前后滚动。 按Q键退出。
[root@qinshengfei /mysql.conf.d]# less  log.txt

12、grep 管道,输出指定文件内容

例如使用 ps -aux 查询进程,我们只需要知道 tomcat 有不有运行,就可以使用管道指令『|』加入 grep 这个命令同时操作。
[root@qinshengfei /]# ps -aux|grep tomcat

13、find 查找文件

[root@qinshengfei /]#  find / -name bin

14、tar -cvf 压缩文件

[root@qinshengfei /root]# tar  -zcvf  app.tar.gz app 

15、gzip 压缩

也是一压缩命令,跟compress 很相似,指令的用法也相同!只是压缩后缀名 .gz !
[root@qinshengfei /root]# gzip  -d  xxxxx.gz

16、unzip 解压文件

[root@qinshengfei /root]# unzip app.zip 解压一个叫做 'app.zip'的文件 

18、exit 退出登录


[root@qinshengfei /root]# exit

19、ping 与windows下的ping 一样 ,测试两台电脑之间是否连通


[root@qinshengfei /root]# ping baidu.com

20、telnet 与windows下的一样 ,测试目标机端口开放

[root@qinshengfei /root]# telnet 47.2.30.289 8080

21、who 查看当前登录的所有用户

[root@qinshengfei /root]# who

22、su 切换用户

[root@qinshengfei /root]# su  qinshengfei

23、uname uname会显示出关于系统的重要信息,如内核名称、主机名、内核版本、处理机类型等等,使用uname -a可以查看所有信息。

[root@qinshengfei /]# uname -a
Linux qinshengfei 4.18.0-80.11.2.el8_0.x86_64 #1 SMP Tue Sep 24 11:32:19 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
[root@qinshengfei /]#

24、alias

使用alias命令可以给命令或命令序列指定自己的名称。 然后,您可以输入您的简称,然后Shell将为您执行命令或命令序列。
[root@qinshengfei /]# alias pf="ps -e | grep $1"
[root@qinshengfei /]# pf tomcat

25、chmod 修改文件、文件夹权限的命令

0: No permission
1: Execute permission
2: Write permission
3: Write and execute permissions
4: Read permission
5: Read and execute permissions
6: Read and write permissions
7: Read, write and execute permissions
[root@qinshengfei /]# chmod 777 app -r <== -r 连同子目录权限一起修改

26、chown

可以使用chown更改文件的所有者或组,或两者。 必须提供所有者和组的名称,以:字符分隔。
[root@qinshengfei /]# chown dave:mary example.txt

27、curl

curl命令是从统一资源定位器(URL)或Internet地址检索信息和文件的工具。
[root@qinshengfei /]# curl http://www.baidu.com index.html

28、echo

echo命令将文本字符串打印(回显)到终端窗口。也可以将字符串打印到文件。
[root@qinshengfei /]# echo "hello world"
hello world
[root@qinshengfei /]#

29、free

free命令为您提供计算机内存使用情况的摘要。 它对主随机存取存储器(RAM)和交换存储器都执行此操作。 -h(人类)选项用于提供人类友好的数字和单位。 没有此选项,数字以字节为单位。
[root@qinshengfei /]# free
total used free shared buff/cache available
Mem: 8000348 1554508 4549432 576 1896408 6194856
Swap: 0 0 0
[root@qinshengfei /]#

30、history

history命令列出了您先前在命令行上发出的命令。 您可以通过键入感叹号来重复历史记录中的任何命令! 以及历史记录列表中的命令编号。
[root@qinshengfei /]#
[root@qinshengfei /]# history
1 yum install docker
2 yum install nginx
3 yum -y install docker-ce

31、kill

我们将使用上面关于别名命令的部分中的ps和grep技巧。 我们可以搜索快门过程并获取其PID,如下所示:

[root@qinshengfei /]# ps -ef|grep nginx
root 31884 22980 0 16:19 pts/0 00:00:00 grep --color=auto nginx
root 32400 1 0 Feb18 ? 00:00:00 nginx: master process /usr/sbin/nginx
nginx 32401 32400 0 Feb18 ? 00:00:00 nginx: worker process
nginx 32402 32400 0 Feb18 ? 00:00:00 nginx: worker process
[root@qinshengfei /]# kill -9 32400

32、passwd

passwd命令使您可以更改用户密码。 只需键入passwd即可更改您自己的密码。
[root@qinshengfei /]# sudo passwd mary

33、ssh

使用ssh命令建立与远程Linux计算机的连接并登录到您的帐户。 要建立连接,您必须提供您的用户名以及远程计算机的IP地址或域名。 在此示例中,用户mary以192.168.4.23登录到计算机。 建立连接后,将要求她输入密码。
[root@qinshengfei /]# ssh mary@192.168.4.23
mary@192.168.4.23's password:

35、df 查看系统磁盘的使用情况

[root@qinshengfei /]# df
Filesystem 1K-blocks Used Available Use% Mounted on
devtmpfs 3986836 0 3986836 0% /dev
tmpfs 4000172 0 4000172 0% /dev/shm
tmpfs 4000172 576 3999596 1% /run
tmpfs 4000172 0 4000172 0% /sys/fs/cgroup
/dev/vda1 52417516 4031296 48386220 8% /
overlay 52417516 4031296 48386220 8% /var/lib/docker/overlay2/650e5470981551bdd57ee3f9da79da55ef5170d11017e282c318f801b5c5ac4b/merged
tmpfs 800032 0 800032 0% /run/user/0
[root@qinshengfei /]#

36、ps 显示系统进程

ps命令列出了正在运行的进程。 使用不带任何选项的ps会导致它列出当前shell中正在运行的进程。
[root@qinshengfei /]# ps
PID TTY TIME CMD
9191 pts/0 00:00:00 ps
16776 pts/0 00:00:00 bash
17212 pts/0 00:00:00 mysql
22980 pts/0 00:00:00 bash
23524 pts/0 00:00:44 java
[root@qinshengfei /]#
要查询关键字进程,可以结合管道命令。
[root@qinshengfei /]# ps -ef|grep nginx
root 10377 22980 0 16:26 pts/0 00:00:00 grep --color=auto nginx
root 32400 1 0 Feb18 ? 00:00:00 nginx: master process /usr/sbin/nginx
nginx 32401 32400 0 Feb18 ? 00:00:00 nginx: worker process
nginx 32402 32400 0 Feb18 ? 00:00:00 nginx: worker process
[root@qinshengfei /]#

37、top 显示系统进程

[root@qinshengfei /]# top

38、reboot 重新计算机

[root@qinshengfei /]# reboot

39、shutdown

使用不带参数的关机将在一分钟内关闭计算机。

[root@qinshengfei /]# shutdown
使用 now 参数 ,立刻关机
[root@qinshengfei /]# shutdown -h now
使用 -r 参数 重启 与reboot效果一样  ,shutdown -r  可以定时
[root@qinshengfei /]# shutdown -r now

40、yum

centos环境下安装软件的命令
[root@qinshengfei /]# yum install nginx

最简洁明了的Linux常用命令的更多相关文章

  1. Linux常用命令(一)

    Linux常用命令 1. pwd查看当前路径(Print Working Directory)    [root@CentOS ~]# pwd/root 2. cd .. 返回上一级 .. 表示上一级 ...

  2. linux常用命令的介绍

    本文主要介绍Linux常用命令工具,比如用户创建,删除,文件管理,常见的网络命令等 如何创建账号: 1. 创建用户 useradd -m username -m 表示会在/home 路径下添加创建用户 ...

  3. linux——常用命令与脚本

    linux常用命令 --文件管理pwd --查看当前目录cd --切换当前目录ls --列出当前目录下的所有文件touch --创建文件mkdir --建立目录rmdir --删除空目录rm --删除 ...

  4. DOS 和 Linux 常用命令的对比

    DOS 和 Linux 常用命令的对比 许多在 shell 提示下键入的 Linux命令都与你在 DOS 下键入的命令相似.事实上,某些命令完全相同. 本附录提供了 Windows的 DOS 提示下的 ...

  5. 第一章,Linux常用命令

    20161124 Linux常用命令1.find find /etc/ -size +50k -lsfind /etc/ -size +50k -ls 2> /dev/null查看目录下大于50 ...

  6. linux 常用命令大全

    linux 常用命令大全 系统信息 arch 显示机器的处理器架构(1) uname -m 显示机器的处理器架构(2) uname -r 显示正在使用的内核版本 dmidecode -q 显示硬件系统 ...

  7. Linux 常用命令行

    Linux常用命令行 第一部分: cd命令 第二部分:文件操作 第三部分:压缩包操作

  8. [工作需求]linux常用命令以及vim常用命令

    一.             Linux 常用命令 mkdir dirname新建文件夹 cd ~ 进入自己的家目录 cd dirname 进入名字为dirname的目录: l 显示当前文件夹下的文件 ...

  9. 对于我的linux常用命令的说明

    我所列出的linux常用命令中的选项并不是全部的选项,是一些我们经常用到的linux命令及选项

  10. Linux 常用命令笔记

    Linux 常用命令笔记 1. locate locate:用来定位文件的位置,如:locate a.txt 但是这个命令有延迟,也就是新建的文件不一定能搜索到,如果非要找到新建的文件可以使用 upd ...

随机推荐

  1. 小知识:MySQL修改lower_case_table_names参数

    环境:MySQL 5.7.25 起初创建环境时没有要求表名称不区分大小写,后续应用使用提出要设置lower_case_table_names=1的需求,期望表名不再区分大小写. 修改这个参数需要重启实 ...

  2. CF1795

    A 先判断初始行不行,再模拟加入. B 题意:数轴上给定一些线段,和点 \(t\).问能否删去一些线段,使得 \(t\) 变成唯一的覆盖次数最多的点. 差分 + 贪心. C 有 \(n\) 杯水,\( ...

  3. Python实现二叉查找

    搜索 搜索是在一个项目集合中找到一个特定项目的算法过程.搜索通常的答案是真的或假的,因为该项目是否存在. 搜索的几种常见方法:顺序查找.二分法查找.二叉树查找.哈希查找 二分法查找 二分查找又称折半查 ...

  4. windows_exporter 安装

    windows_exporter 安装 背景 如果想使用Prometheus监控Windows主机相关参数,那么就需要在Windows系统的主机上进行安装指标收集器. windows_exporter ...

  5. js 手动实现bind方法,超详细思路分析!

    壹 ❀ 引 在 js 实现call和apply方法 一文中,我们详细分析并模拟实现了call/apply方法,由于篇幅问题,关于bind方法实现只能另起一篇. 在模拟bind之前,我们先了解bind的 ...

  6. NC20812 绿魔法师

    题目链接 题目 题目描述 "我不知道你在说什么,因为我只是个pupil."--绿魔法师 一个空的可重集合S. n次操作,每次操作给出x,k,p,执行以下操作: 1.在S中加入x. ...

  7. Windows也能拥有好用的命令行吗?Powershell+Terminal折腾记录(v1.0版本)

    PS:本文写于2021年,现在已经是2024年,有了很多新变化,我在接下来的文章里会继续更新. 前言 Windows一向以图形化操作入门容易著称,所以对于命令行的支持一直为人所诟病,比起Linux或者 ...

  8. node版本管理工具nvm的安装及使用

    一.什么是nvm nvm是一个node版本管理工具. 由于不同项目依赖的node版本可能不同,所以在维护多个项目时通常需要使用不同的node版本,这时候用nvm来切换不同的node版本就很方便. 官方 ...

  9. flutter打包android的一些配置修改(解决白屏,视频闪退)

    1.打包后视频播放闪退 视频播放器选择了flutter_tencentplayer(https://github.com/qq326646683/flutter_tencentplayer) 解决:不 ...

  10. 亲测CentOS 8.2更换yum源报错Errors during downloading metadata for repository 'epel': - Status code解决办法

    重点 提一件拉胯的事:别去参考阿里和华为云官方镜像上面的解决办法,本人试了几遍,没luan用.拉胯!!!!!!!! 报错具体信息 Errors during downloading metadata ...