zoukankan      html  css  js  c++  java
  • Linux命令二 之乱七八糟

    #目录和文件
    ls list 显示当前目录下的文件或目录
    ll 详细信息
    l 软连接
    d 目录
    ls -a 显示所有 包括隐藏


    pwd 我当前在哪里
    - 超级管理员root 默认的家目录(登进系统默认进入的) /root

    cd change dir 进入指定目录
    - cd 目录名
    - cd . 当前目录
    - cd .. 上一级目录
    - cd ~ 回家
    - cd - 切换到刚才(最近切换)那个目录

    cat 查看一个文件 /etc/sysconfig/network-scripts

    cp 复制 备份 切记 改服务器配置文件的时候,尽可能先备份

    ## 创建文件
    - touch 创建一个文件 重复touch不会覆盖 但是时间
    - vi vim

    more 一般用于文本比较多 需要一行一行(回车) 或一页一页的(空格)


    head -n(行) 文件的开始几行

    tail -n(行) 文件最后几行


    chomd -R 777 文件名


    rwx
    421

    ##
    systemctl restart network.service 重启网络

    # 常用快捷
    clear 清屏
    tab 补全
    上下方向键
    history
    !最近一次使用的命令

    命令 --help
    man 命令

    # 目录
    /etc 存放各种系统配置文件

    ## 虚拟机的使用
    - 桥接模式 虚拟机跟真实上网环境一模一样 会竞争ip
    - Nat 虚拟机自己有个虚拟路由器

    yum install tree
    ifconfig yum -y install net-tools

    ## vi编辑器

    i insert
    Esc 退出插入模式
    shift+冒号 进入命令模式 wq!

    :set number
    :/搜索的关键词 + n(next)

    行好 + G 定位到某一行
    G 最后以后
    复制的数量 + yy + 位置 p

    2 + dd 删两行

    数量 + 方向键 左右

    【用户】
    /etc/passwd 存放用户信息
    /bin/bash 可以登陆系统
    其他的 /sbin/nologin 不能登录 /sbin/shutdown 专门用来关机

    /etc/shadow 存放用户密码

    创建用户如果没有指明所属组 系统会自动创建一个跟他名字一样组

    useradd 用户名
    passwd 用户名


    [权限]

    drwxr-xr-x. 2 root root 6 9月 7 14:48 abc
    drwxr-xr-x. 2 root root 6 9月 7 14:48 axy
    -rw-r--r--. 1 root root 4942 9月 7 14:46 man_db.conf
    -rw-r--r--. 1 root root 4942 9月 7 14:47 man.test.config

    r 读
    w 写
    x 执行

    文件 r cat more head tail
    w touch vim vi echo
    x 执行

    目录 r ls ll
    w touch mkdir
    x cd

    rwx r-x r-x
    所有者(u ser) 所属组(g roup) 其他人(o ther)
    root root

    - rw- r-- r--


    【环境】
    - root root
    - jack jack
    - demo jack

    创建 /test
    touch index.html

    总用量 4
    -rw-r--r--. 1 root root 5 9月 7 15:31 index.html

    -rw-r--r--. 1 jack root 5 9月 7 15:31 index.html

    1、换所有者
    2、所属组root + w jack加入root组
    3、其他人+w
    4、root组改成jack


    1、更改文件的所有者 chown
    chown jack index.html

    2、??
    usermod -g root jack

    3、改变用户对文件的读写执行权限 chmod change modify

    chmod o+w index.html

    tar -czvf abc.tar.gz ./abc.com

    【压缩】
    tar -czvf 包名字.tar.gz 被压缩的目录或文件

    解压缩

    tar -xvf 包名字.tar.gz


    解压缩
    tar –xvf file.tar 解压 tar包
    tar -xzvf file.tar.gz 解压tar.gz


    find /usr -name httpd.conf 查找目录

    wget https://www.php.net/distributions/php-7.2.22.tar.gz

    安装php :https://blog.csdn.net/qq_34272964/article/details/79716548
    安装前先删除 usr/local/ 下面的php

    按连接走到 复制配置文件的时候 按下面走
    # 配置文件php.ini
    cp /root/lamp/php-7.2.22/php.ini-production /usr/local/php/etc/php.ini

    # 查看php模块是否生成 libphp7.so
    cd /usr/local/apache2/modules


    # 查看Apache是否加载了php模块
    vim /usr/local/apache/conf/httpd.conf
    LoadModule php7_module modules/libphp7.so


    // 找到这一行修改
    DirectoryIndex index.php index.html index.htm

    //最后面加上
    <FilesMatch .php$>
    SetHandler application/x-httpd-php
    </FilesMatch>

    # 重启Apache
    /usr/local/apache2/bin/apachectl restart

    安装mysql :https://www.cnblogs.com/ianduin/p/7679239.html


    启动mysql

    systemctl restart mysqld.service 重启
    systemctl start mysqld.service 开启
    systemctl stop mysqld.service 退出

    sql密码:root@Admin_123

    登录mysql -u root -p
    mysql> quit 退出mysql命令

    查看mysql 运行状态 service mysqld status

    设置密码 和忘记密码 https://blog.csdn.net/lm3758/article/details/88949715

    一键安装包:https://lnmp.org/
    宝塔:https://www.bt.cn/

    Bt-Panel: http://219.134.217.201:8888/0fbfff5c
    username: stjcwisd
    password: a01d1215

    查看端口


    查看80端口:netstat -ntulp | grep 80
    查看80端口被谁占用:netstat -lnp | grep 80


    查看服务器上所有的服务跟端口 :netstat -anlp
    查看某服务占用的端口情况,比如:nginx: netstat -ntulp | grep nginx


    查看安装了哪些服务:service --status-all
    chkconfig --list


    查看某服务有没有启动 :ps aux | grep 服务名称


    apache2

    启动apache:/usr/local/apache2/bin/apachectl start apaceh

    重启:/usr/local/apache2/bin/apachectl restart

    停止:/usr/local/apache2/bin/apachectl stop

    nginx

    启动 nginx -c /usr/local/nginx/conf/nginx.conf

    停止:nginx -s stop :快速停止nginx

    查看主进程号 ps -ef | grep nginx

    从容停止Nginx:
    kill -QUIT 主进程号

    重启:/usr/nginx/sbin/nginx -s reload

    判断配置文件是否OK:nginx -t -c /usr/nginx/conf/nginx.conf


    虚拟主机配置:https://blog.csdn.net/Jhym2007/article/details/100832807

    一键安装的lnmp系统公司里面平滑重启:/etc/init.d/nginx reload

    查看项目中隐藏的受保护的文件(有i权限的) :lsattr .user.ini
    去掉i权限:chattr -i .user.ini


    https://blog.csdn.net/qq_28423997/article/details/82221916

    下载api测试工具:https://www.apipost.cn/download.html

    api:下载https://www.juhe.cn/
    扒网站:https://www.cnblogs.com/CHEUNGKAMING/p/5717429.html

  • 相关阅读:
    A physically based scene with three.js
    pbr-guide
    Art Pipeline for glTF
    GG5D
    Leetcode 146.LRU缓存机制
    Leetcode 143.重排链表
    Leetcode 142.环形链表II
    Leetcode 141.环形链表
    Leetcode 139.单词拆分
    Leetcode 138.复制带随机指针的链表
  • 原文地址:https://www.cnblogs.com/vilucky/p/12567713.html
Copyright © 2011-2022 走看看