The most concise Linux common commands

1. ls command

查看当前目录下可见的文件、文件夹及其相关权限
常用参数:-l 列表式查看
-al 查看所有,包括隐藏的文件、文件夹
[root @ qinshengfei bin] # LS - Color display in color 
[root @ qinshengfei bin] # LS - L details listed in the directory file 
[root @ qinshengfei bin] # LS - A show all files, including hidden files 
[root @ qinshengfei bin] # LS - Al displays a list of all the files 
[root @ qinshengfei bin] # LS -al | More display directory content distribution

2. mkdir create a folder

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

3. pwd Displays the current working directory

[root @ qinshengfei bin] # pwd
 / usr / bin <== current working directory

4. cd Change directory


[root @ qinshengfei / root] # cd .. <== back to the parent directory 
[@ qinshengfei the root /] CD # <== Back home directory 
[the root @ qinshengfei the root] # CD / usr / bin <== to / usr / bin directory
5. rmdir to delete the specified directory
如果要删除的目录里面有文件或文件夹,是无法移动的,这时,就需要加上参数 -rf 来强制操作删除。
[root @ qinshengfei / root] # rmdir ./test <== delete the directory 
[root @ qinshengfei / root] # rmdir ./test2 -rf <== delete the directory and subdirectories, file

6. rm command deletes files

[root@qinshengfei /root]# rm test

7. cp is copy meaning. For example, we want to copy the .bashrc file to the / home directory, you can:

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

8. mv move files, folders

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

9. cat print file contents on the console, for example, to print mysql configuration file to control

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

10. tail display file contents in a row

[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 pipeline, output specification file contents

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

13. find find files

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

14. tar -cvf archive

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

15. gzip compression

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

16. unzip unzip the file

[root @ qinshengfei / root] # unzip app.zip decompression called ' app.zip ' files

17. exit Log

[root@qinshengfei /root]# exit
18. A ping and ping as the windows, if the test communication between two computers
[Root @ qinshengfei / root] # ping baidu.com

19. Under the telnet and windows, as a test target port open

[root@qinshengfei /root]# telnet 47.2.30.289 8080

20. who view all users currently logged on

[root@qinshengfei /root]# who
21. su switch user
[Root @ qinshengfei / root] # su qinshengfei
22. uname uname displays important information about the system, such as the kernel name, host name, kernel version, processor type, etc., use uname -a You can view all the information.
[@ qinshengfei the root /] # the uname - A 
the Linux qinshengfei 4.18 . 0 - 80.11 . 2 .el8_0.x86_64 # . 1 the SMP Tue On Sep 24  . 11 : 32 : . 19 UTC 2019 the x86_64 the x86_64 the x86_64 the GNU / the Linux 
[@ qinshengfei the root /] #
23. alias
使用alias命令可以给命令或命令序列指定自己的名称。然后,您可以输入您的简称,然后Shell将为您执行命令或命令序列。
[root @ qinshengfei /] # Alias PF = " PS -e | grep $ 1 " 
[root @ qinshengfei /] # PF Tomcat

24. chmod modify a file, folder permissions command

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 连同子目录权限一起修改

25. chown

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

26. curl

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

27. echo

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

28. 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 /]#

 

 

29. history

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

30. kill


We will use the above section ps and grep tips on the alias command. We can search shutter process and get its PID, as follows:
[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

31. passwd

passwd命令使您可以更改用户密码。只需键入passwd即可更改您自己的密码。

[root@qinshengfei /]# sudo passwd mary

32. ssh

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

[root@qinshengfei /]# ssh mary@192.168.4.23
mary@192.168.4.23's password:
33. df view disk usage system
[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 /]#

34. ps display system processes


ps命令列出了正在运行的进程。使用不带任何选项的ps会导致它列出当前shell中正在运行的进程。
[root @ qinshengfei / ] # PS 
  PID TTY the 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 the Java 
[root @ qinshengfei / ] #
To process the query keywords, the pipeline can be combined command. 
[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: Process worker 
nginx    32402 32400  0 Feb18 ?        00:00:00 nginx: worker process
[root@qinshengfei /]#

 

35. top display system processes


[Root @ qinshengfei /] # top

 

36. reboot the computer again

[root @ qinshengfei /] # reboot

 

37. shutdown


Shutdown used without parameters, the computer will shut down within one minute. 
[@ qinshengfei the root / ] # the shutdown 
using parameters now, immediately shut 
[@ qinshengfei the root /] # the shutdown - H now 
use -r reboot and restart the same effect as the parameters, the shutdown - R & lt be timed 
[@ qinshengfei the root /] # the shutdown -r now

38. yum

   Under centos command to install the software environment
[root@qinshengfei /]# yum install nginx
Write your message

Guess you like

Origin www.cnblogs.com/llxpbbs/p/12361702.html