# linux常用,(命令)、(指令)、【快捷键】(笔记1)

常用,(命令)、(指令)、【快捷键】

                                  ┌┌╔,┌╔╔┌╔,.┌
                           ╔;ü▄MM▒▒▒▒▒▒▒▒▒▒▒▒▒██M▄▄¿┌
                      ╔╔çM▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒█M▄_.
                   ╔¿M▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒█Mç┌
                 │p▒Ö▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒MMMMMMMM▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒M¿.
              ╔($▒ÖÖ▒▒▒▒▒▒▒▒▒Mⁿⁿⁿ`└`        ``╚ÜⁿⁿM▒▒▒▒▒▒▒▒▒▒▒▒▒ç;
            ┌(MÖÖÖÖÖÖÖÖÖÖMÖÜ"                      `ⁿⁿM▒▒▒▒▒▒▒▒▒Ö▒ç.
           ╔$▒ÖÖÖÖÖÖÖÖÖⁿÜ'                            └╚ⁿM▒▒▒▒▒ÖÖÖÖ%,
          ($ÖÖÖÖÖÖÖÖÖÜ└                                  └ÖMÖÖÜ▓█████¡
        ┌{▒ÖÖÖÖÖÖÖÖÑ`                                      ╚ÖÜ████████ç,
        ░▒ÖÖÖÖÖÖÖÖÜ'                                        └{▓██████▀¼ç
       ($ÖÖÖÖÖÖÖÖÜ                                            \Ü▓▀▀▓ÜÖÉÉ\
      ╔{ÖÖÖÖ▒ÖÖÖÖ                                              (ÜܼÉÉÉÉÉM¡
      ($Ö▒▒▒▒▒ÖÉ`                                              │{ÜÉÉÉÉÖɼù
      ╢▒▒▒▒▒▒▒ÖÜ                                                [ÜÉÉÖÖÖÖÉ}
     │{▒▒▒▒▒▒▒▒]                                                ║$ÉÖÖÖÖÖÉK
     │½▒▒▒▒▒▒▒▒[                                                ║$ÉÖÖÖÖÖÖ}
     └░▒▒▒▒▒▒▒▒Ü                                                (▒ÖÖÖÖÖÖÖ}
      ░$▒▒▒▒▒▒▒k,                                              ┌q▒▒▒▒▒▒▒▒Ü
      ║Å▒▒▒▒▒▒▒▒ù                                              (▒▒▒▒▒▒▒▒▒)
       (M▒▒▒▒▒▒▒▒\                                            ║$▒▒▒▒▒▒▒▒Ü
       └Ö▒▒▒▒▒▒▒▒█¿                                          ║M▒▒▒▒▒▒▒▒Ñ'
        ╚Ö▒▒▒▒▒▒▒▒▒ç,                                      ┌(M▒▒▒▒▒▒▒▒Ñ`
         ╚ⁿ▒▒▒▒▒▒▒▒▒▒ç,                                   │M▒▒▒▒▒▒▒▒▒Ñ'
           (M▒▒▒▒▒▒▒▒▒Mç╔                              ╔jM█▒▒▒▒▒▒▒▒▒ⁿ`
            ╚ⁿ▒▒▒▒▒▒▒▒▒▒▒Mç╔                        ╔j▄▒▒▒▒▒██▒▒▒▒Ö'
              │Ñ▒▒▒▒▒▒▒▒▒▒▒▒M▄¿,.              ┌╔j▄M█▒▒▒▒▒▒▒▒▒▒▒ɺ
                ╚ⁿM▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒MMM▄▄ççç▄MMM▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ⁿª
                  └(ⁿM▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒Öⁿ`
                     └^ⁿÖ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒Mⁿ░'
                         `╚ⁿⁿWM▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒MÖⁿⁿ`'
                               `└└ⁿⁿÑⁿⁿⁿⁿⁿⁿⁿⁿⁿ```

^[ ^ascii ^art ^generator ^]

      (Init 3)为命令, 
             【ctrl+c】是快捷键

121212

命令解释大全

help ,

[user@c7e ~]$help help

help: help [-dms] [pattern ...]帮助: 帮助 [-dms] [模式 ...]
Display 显示information信息 about builtin 内置commands.命令。
显示有关内置命令的信息。

Displays brief简短 summaries 摘要of builtin 内置commands. 

显示内置命令的简要摘要。
If PATTERN模式 is
specified指定的, gives detailed 详细help on all commands matching 匹配PATTERN,
otherwise要不然 the list列表 of help帮助 topics主题 is printed.打印
如果 PATTERN模式 是
指定,提供所有匹配 PATTERN 的命令的详细帮助,
否则将打印帮助主题的列表。

PATTERN:

图案 pattern, design
模式 mode, pattern, method
格局 pattern, structure, setup, configuration
方式 manner, mode, fashion, style, pattern, way of life
图样 pattern, design, drawing, draft
样式 style, pattern, form, type
型 type, model, pattern, mold, mould
模型 model, mold, pattern, matrix, former, mould
格式 format, form, scheme, pattern, specification
形态 form, shape, pattern
模 mold, module, model, pattern, norm, matrix
动词
模 mold, model, pattern, imitate, blur, mould

来自 <https://translate.google.cn/#view=home&op=translate&sl=auto&tl=zh-CN&text=PATTERN&gt;

Options:

选项:
-d output输出 short description 简短描述for each topic每个主题
-d 为每个主题输出简短说明
-m display 显示usage 使用in pseudo昵称-manpage 伪曼页format格式
-m 以伪曼页格式显示用法
-s output 输出only a short usage synopsis简介 for each每个 topic主题 matching匹配
PATTERN模式

只输出每个主题匹配的简短使用概要
模式

Arguments:

参数
PATTERN Pattern specifiying规格 a help topic主题
模式指定帮助主题

Exit Status:

退出状态:
Returns 返回success成功 unless 除非PATTERN 模式is not found or an invalid无效 option 选项is given.
返回成功,除非未找到 PATTERN 或给出无效选项。

[user@c7e ~]$

1.Centos关闭图形化界面,Centos开启图形化界面

(Init 3),(runlevel)+(lnit 5)

2.Centos切换root用户、切换普通用户

(Su - root )或( su - user)

3.Centos强制停止当前活动

【ctrl+c】

4.Centos清理当前页面

【ctrl+L】或(clear)

5.Centos切换图形化界面、切换终端界面(xshell不能应用到虚拟机)

【ctrl+alt+F1】、【ctrl+alt+F2、F3/F4】

6.CentosIP查看

(ip a)或(ifconfig)区别windowsOS查看ip(ipconfig)

7.Centos 查看CPU

(lscpu)

8.linux关机

(poweroff),(init 0)

9.linux查看文件 例如查看centOS版本文件

(cat +文件地址 /etc/centos-release)

10.linux切换文件夹 例如切换到根文件夹 ,查看当前文件夹之下的所有文件

(cd +文件夹名称/),(ls)

11.linux查看分区参数

(lsblk)

12.xshell关闭虚拟机

(exit),(logout),[crtl+d]

13.linux修改主机名称

centos 7 :77777777777777777777777 :
主机名ctl 设置-主机名 (名字为英文/数字/个别符号+)
(hostnamectl set-hostname (名字为英文/数字/个别符号+))

切换shell,生效之前的操作,相当于重启生效
(bash)

[root@c-uscwifi ~]# hostnamectl set-hostname c7e-uscwifi.cn
hostnamectl主机名 set-hostname设置主机名为 c7e-uscwifi.cn

[root@c-uscwifi ~]# bash

[root@c7e-uscwifi ~]#

centos 6 66666666666666 / Ubuntu uuuuuuuuuuuuuuuuuuuuu:

[root@centos6 ~]# hostname c6e_uscwifi.cn
[root@centos6 ~]# bash
[root@c6e_uscwifi ~]#

用centos 6 / Ubuntu (老命令) (hostname c6e_uscwifi.cn)修改主机名称

14.linux查看用户id信息(编号,所在的ID的组),linux查看是否权限用户

(id-0(默认root用户id)) (id -u(当前登陆的用户) 或 u user(普通用户的名称))
root用户的id为0

15.linux查看内核版本

(uname -r)

16.linux查看内存情况

(free -h)and(cat /proc/meminfo)

17.ubuntu查看基本信息;centOS6查看基本信息

(lsb_release -a)

18.linux查看当前设备终端 编号ffy0/pts(关于分辨虚拟终端【虚拟机终端tty0】、伪终端【xshell终端pts】)

(tty)
ps:打开、连接虚拟机,系统会分配终端号(例如tty0,pts/1,pts/2,pts3,…)

19.linux查看当前设备的所有终端

(who),

20.(whoami),(who am i)

我是谁:(用户); 我到底是谁 : 当前终端的(用户 终端编号 登入时间 ip)

21.

linux如何更改命令提示符颜色等参数

linux如何 将更改命令 提示符颜色等参数 保存到硬盘

1.进入linux系统,输入:

( PS1="[\e[36m][\u@\h \W]\$[\e[0m]")
颜色改变,31-37,

2.重新输入命令:
 ( nano .bashrc)

编辑文档,在最下方添加1号命令
【Ctrl + x】保存,【Y】确定保存,回车。

3. 重新开机或输入命令:
(  . .bashrc )

应用文件中的命令代码1.

22.查看版本信息

(uname -r)
[user@c7e ~]$uname -r

3.10.0-862.el7.x86_64

[user@c7e ~]$

23.查看进程

(ps aux)
[user@ubuntu111english ~]$ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 1.0 18568 10384 ? Ss 19:12 0:02 /sbin/init
root 2 0.0 0.0 0 0 ? S 19:12 0:00 [kthreadd]
root 3 0.0 0.0 0 0 ? I< 19:12 0:00 [rcu_gp]
root 4 0.0 0.0 0 0 ? I< 19:12 0:00 [rcu_par_gp]
root 6 0.0 0.0 0 0 ? I< 19:12 0:00 [kworker/0:0H-kblockd]
root 8 0.0 0.0 0 0 ? I< 19:12 0:00 [mm_percpu_wq]
root 9 0.0 0.0 0 0 ? S 19:12 0:00 [ksoftirqd/0]
root 10 0.0 0.0 0 0 ? I 19:12 0:00 [rcu_sched]
root 11 0.0 0.0 0 0 ? S 19:12 0:00 [migration/0]
root 12 0.0 0.0 0 0 ? S 19:12 0:00 [idle_inject/0]
root 13 0.0 0.0 0 0 ? I 19:12 0:00 [kworker/0:1-memcg_kmem_cache]
root 14 0.0 0.0 0 0 ? S 19:12 0:00 [cpuhp/0]
root 15 0.0 0.0 0 0 ? S 19:12 0:00 [kdevtmpfs]
[user@ubuntu111english ~]$

24.bash shell

什么是shell

Shell 是Linux系统的用户界面,提供了用户与内核进行交互操作的一种接口。 它接收用户输入的命令并把它送入内核去执行 shell也被称为LINUX的命令解释器(command interpreter) shell是一种高级程序设计语言

bash shell

GNU Bourne-Again Shell(bash)是GNU计划中重要的工具软件之一,目前也 是 Linux标准的shell,与sh兼容 CentOS默认使用 显示当前使用的shell echo ${SHELL} 显示当前系统使用的所有shell cat /etc/shells 主机名示例 bj-yz-k8s-node1-100-10.magedu.com
bash,可执行文件,用户登陆时,后台自动运行bash
centos系统默认用的shell类型
接收、处理用户命令
用户输入命令时,bash会把输入内容交互给计算机

列出/bin/bash文件(ls /bin/bash)
[user@c7e ~]$ls /bin/bash
/bin/bash绿色文件表示可执行文件
[user@c7e ~]$

25.查看主机名 如何修改主机名

set
(hostname)

[user@c7e ~]$hostname

c7e.localdomain

[user@c7e ~]$

25.别名

(alias)别名
[user@c7e ~]$alias别名
默认别名:
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias l.='ls -d .* --color=auto'
alias ll='ls -l --color=auto'
alias ls='ls --color=auto'
alias vi='vim'
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'

[user@c7e ~]$

[用户]c7e]$alias
别名 egrep'egrep -颜色=自动'
别名 fgrep
'fgrep -颜色自动'
别名 grep = "grep-颜色 = 自动"
a.'ls -d . . -- 彩色自动'
别名 ll
'ls -l -颜色=自动"
别名 ls_'ls --颜色=自动"
别名 VI = "VIM"
别名"别名 |/usr/bin/哪个 --仅 tty -仅读取别名 --显示点 --显示-波浪线"
[用户]c7e ]$

26.计算器(bc)

计算器(bc)
[user@c7e ~]$bc
bc 1.06.95
Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.绝对没有保修。
For details细节 type 键入`warranty'. 保修。

[用户]c7e]$bc
bc 1.06.95
版权所有 1991-1994, 1997, 1998, 2000, 2004, 2006 自由软件基金会, Inc.
这是免费软件与无无保修。
有关详细信息,请键入"保修"。

27.GDM 配置存储

(cat /etc/gdm/custom.conf )
[root@c7e ~]#cat /etc/gdm/custom.conf

GDM configuration 配置storage

• GDM 配置存储
[daemon][守护神]
AutomaticLoginEnable=true
自动登录启用= true
AutomaticLogin=root
自动登录_根
[security]
[安全]
[xdmcp]

[chooser]
[选择者]
[debug][调试]

Uncomment the line below to turn on debugging

• 取消注释以下行以打开调试
#Enable启用=true

[root@c7e ~]#

[root_c7e]#cat /etc/gdm/自定义.conf
• GDM 配置存储
[守护神]
自动登录启用= true
自动登录_根
[安全]
[xdmcp]
[选择者]
[调试]
• 取消注释以下行以打开调试
#Enable=真
[根[c7e]#

28.查看当前shell是哪个,调用变量,自定义变量(的习惯)

echo打印shell参数到标准输出(如 终端)
(echo $SHELL)
打印参数到终端

参数:文本、变量$(如$SHELL)$SHELL $+变量名

(系统变量$ 在调用时(echo调用)必须大写(这是系统默认的),
一般情况下自定义变量可以自定义为小写字母,
但命令一般都是小写,
为了区分,习惯(建议)自定义变量为大写字母)

(echo $SHELL)
echo回送
查看当前shell是哪个(echo $SHELL)
[root@c7e ~]#echo $SHELL
/bin/bash
[root@c7e ~]#

29.查看所有shell

查看当前系统所有shell(cat /etc/shells )

[root@c7e ~]#cat /etc/shells
/bin/sh
/bin/bash
/sbin/nologin
/usr/bin/sh
/usr/bin/bash
/usr/sbin/nologin
/bin/tcsh
/bin/csh
[root@c7e ~]#

30.什么是 ls 命令

list 列表的简写

31.如何创建用户,如何删除用户

如何创建用户

切换超级root用户
(su - root)
[user@c7e ~]$su - root 您的 - 根用户
Password: 输入密码:
Last login: Fri Jul 19 19:09:06 CST 2019 on pts/0
最后登录: 星期五 七月 19 19:09:06 CST 2019 在 pts/0
[root@c7e ~]#
创建用户
(useradd uscwifi_com)

[root@c7e ~]# useradd uscwifi_com添加用户 uscwifi_com
[root@c7e ~]# passwd uscwifi_com设置新用户uscwifi_com的密码
Changing password for user uswifi_com.
更改用户 uscwifi_com 的密码。
New password:
新密码:
BAD PASSWORD弱密码: The password is a palindrome密码是回文(正反相同)的
Retype new password: 重新键入新密码:
passwd: all authentication tokens updated successfully.
passwd:所有身份验证令牌都已成功更新。

[root@c7e ~]#

如何删除用户

删除用户uscwifi_com及其所有文件
(userdel -r uscwifi_com )
查看是否删除(查看id)
(id uswifi_com)

[root@c7e ~]# userdel 删除用户 -r其所有文件 uscwifi_com

[root@c7e ~]# id uswifi_com查看id
id: uswifi_com: no such user
id: uswifi_com: 没有这样的用户
[root@c7e ~]#

32. 如何创建新的超级用户,如何创建超级用户, 给普通用户超级权限

先创建一个普通用户

如何创建用户

切换超级root用户
(su - root)
[user@c7e ~]$su - root 您的 - 根用户
Password: 输入密码:
Last login: Fri Jul 19 19:09:06 CST 2019 on pts/0
最后登录: 星期五 七月 19 19:09:06 CST 2019 在 pts/0
[root@c7e ~]#

创建用户

(useradd root.3w.uscwifi_com)

[root@c7e ~]# useradd root.3w.uscwifi_com添加用户 root.3w.uscwifi_com
[root@c7e ~]# passwd root.3w.uscwifi_com设置新用户root.3w.uscwifi_com的密码
Changing password for user uswifi_com.
更改新用户 root.3w.uscwifi_com 的密码。
New password:
新密码:
BAD PASSWORD弱密码: The password is a palindrome密码是回文(正反相同)的
Retype new password: 重新键入新密码:
passwd: all authentication tokens updated successfully.
passwd:所有身份验证令牌都已成功更新。

[root@c7e ~]#

如何 给普通用户超级权限

查看用户id信息(编号,所在的ID的组)
(id root.3w.uscwifi.cn)

将用户追加到 wheel 这个组(系统默认超级用户的组)
加入 wheel 组 的用户会拥有root权限
(usermod -aG wheel root.3w.uscwifi.cn)

再次查看用户id信息
(id root.3w.uscwifi.cn)
发现后面追加成功
10(wheel)

使用当前 root.3w.uscwifi.cn 用户切换为root用户
[root.3w.uscwifi.cn@c7e ~]$ sudo su -
如果提示需要当前用户root.3w.uscwifi.cn的密码
且输入后切换为root用户,则该用户获取超级权限,成功

否则需要输入root密码,则该用户获取超级权限,失败

[root@c7e ~]# id root.3w.uscwifi.cn
id 加 用户名
uid=1001(root.3w.uscwifi.cn) gid=1001(root.3w.uscwifi.cn) groups=1001(root.3w.uscwifi.cn)
[root@c7e ~]# usermod -aG wheel root.3w.uscwifi.cn
usermod 修改…(某个)…用户
其中-aG 是-append group -追加组 的意思 wheel
[root@c7e ~]# id root.3w.uscwifi.cn
uid=1001(root.3w.uscwifi.cn) gid=1001(root.3w.uscwifi.cn) groups=1001(root.3w.uscwifi.cn),10(wheel)

[root@c7e ~]# su - root.3w.uscwifi.cn

[root.3w.uscwifi.cn@c7e ~]$ sudo su -
We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:
我们相信您已经收到了当地系统通常的讲座
管理员。它通常归结为以下三件事:

#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.

#1) 尊重他人的隐私。
#2)在键入之前考虑。
#3)拥有强大的力量,责任重大。

[sudo] password for root.3w.uscwifi.cn:
root.3w.uscwifi.cn的 [sudo] 密码:
Last login: Sat Jul 20 15:33:38 CST 2019 from 172.18.28.28 on pts/2
最后登录: 星期六 七月 20 15:33:38 CST 2019 从 172.18.28.28 在点/2
[root@c7e ~]#

33.快捷键大全

【esc + . 】打印上一条命令最后一个的文本

34.如何修改普通用户名 如何修改用户名

修改普通用户名
(usermod -l )
usermod 修改 用户名
-l, --login --登录NEW_LOGIN 新的登录 new value of the login name登录名的新值

查看是否修改
(id 3w.uscwifi.cn)

例如
[root@c7e ~]# usermod -l 3w.uscwifi.cn user
usermod修改 用户名 -l 登录名的新值3w.uscwifi.cn新名称 user 旧名称
[root@c7e ~]# id 3w.uscwifi.cn
uid=1000(3w.uscwifi.cn) gid=1000(user) groups=1000(user)
[root@c7e ~]#

# linux常用,(命令)、(指令)、【快捷键】(笔记1)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值