Linux operating system basic commands

        Each computer system is equipped with an operating system. The operating system is a system software in the computer system. It is a collection of such program modules-they manage and control the hardware and software resources in the computer system, and rationally organize the computer workflow In order to effectively use these resources to provide users with a powerful, easy-to-use and extensible working environment, thereby acting as an interface between the computer and its users.

The composition of the Linux system

(1) Linux kernel (linus team management)

(2) shell: user-interface interface with the kernel

(3) File system: ext3, ext4, etc. windows has fat32 and ntfs

(4) Third-party application software

Shutdown and restart

shutdown

     -r             关机重启

     -h             关机不重启

     now          立刻关机

halt               关机

reboot          重启

User Management

/etc/passwd    存储用户账号

/etc/group       存储组账号

/etc/shadow    存储用户账号的密码

/etc/gshadow  存储用户组账号的密码

useradd 用户名

userdel 用户名

adduser 用户名

groupadd 组名

groupdel 组名

passwd root     给root设置密码

su root

su - root 

/etc/profile     系统环境变量

bash_profile     用户环境变量

.bashrc              用户环境变量

su user              切换用户,加载配置文件.bashrc

su - user            切换用户,加载配置文件/etc/profile ,加载bash_profile

Common instructions

ls          显示文件或目录

     -l           列出文件详细信息l(list)

     -a          列出当前目录下所有文件及目录,包括隐藏的a(all)

mkdir         创建目录

     -p           创建目录,若无父目录,则创建p(parent)

cd               切换目录

touch          创建空文件

echo            创建带有内容的文件。

cat              查看文件内容

cp                拷贝

mv               移动或重命名

rm               删除文件

     -r            递归删除,可删除子目录及文件

     -f            强制删除

find              在文件系统中搜索某文件

wc                统计文本中行数、字数、字符数

grep             在文本文件中查找某个字符串

rmdir           删除空目录

tree             树形结构显示目录,需要安装tree包

pwd              显示当前目录

ln                  创建链接文件

more、less  分页显示文本文件内容

head、tail    显示文件头、尾内容

ctrl+alt+F1  命令行全屏模式

System management commands

stat              显示指定文件的详细信息,比ls更详细

who               显示在线登陆用户

whoami          显示当前操作用户

hostname      显示主机名

uname           显示系统信息

top                动态显示当前耗费资源最多进程信息

ps                  显示瞬间进程状态 ps -aux

du                  查看目录大小 du -h /home带有单位显示目录信息

df                  查看磁盘大小 df -h 带有单位显示磁盘信息

ifconfig          查看网络情况

ping                测试网络连通

netstat          显示网络状态信息

man                如:man ls

clear              清屏

alias               对命令重命名 如:alias showmeit="ps -aux" ,另外解除使用unaliax showmeit

kill                 杀死进程,可以先用ps 或 top命令查看进程的id,然后再用kill命令杀死进程。

 Use of Vim

vim three modes: command mode, insert mode, edit mode. Use ESC or i or: to switch modes.

In command mode:

:q                      退出

:q!                     强制退出

:wq                   保存并退出

:set number     显示行号

:set nonumber  隐藏行号

/apache            在文档中查找apache 按n跳到下一个,shift+n上一个

yyp                   复制光标所在行,并粘贴

h(左移一个字符←)、j(下一行↓)、k(上一行↑)、l(右移一个字符→)

 Reference article: https://blog.csdn.net/y1553595299/article/details/79196513?depth_1-utm_source=distribute.pc_relevant.none-task&utm_source=distribute.pc_relevant.none-task

Reference article: https://blog.csdn.net/yuanzhen1/article/details/89323245?depth_1-utm_source=distribute.pc_relevant.none-task&utm_source=distribute.pc_relevant.none-task

Reference article: https://blog.csdn.net/weixin_40822052/article/details/82828503

Reference article: https://www.cnblogs.com/aipiaoborensheng/p/9091644.html

Published 128 original articles · Like 132 · Visits 170,000+

Guess you like

Origin blog.csdn.net/yql_617540298/article/details/105232347