哇塞!原来Linux要这么用!快来围观!

简介: 1.Linux:免费,开源,稳定高效--->更安全2.阿里云,腾讯云,亚马逊aws业务,说白了就是给企业提供Linux后台云服务的。(一般中小型公司不会自建机房,成本太高。

 

前言:

📕作者简介:热爱编程的敖云岚,致力于C、Java、Python等多编程语言,热爱编程和长板的运动少年!

📘相关专栏Java基础语法,JavaEE初阶,数据库,数据结构和算法系列等,大家有兴趣的可以看一看。

️😇😇😇有兴趣的话关注博主一起学习,一起进步吧!

一、什么是Linux

1.1前端VS后端

image.gif编辑

1.2企业为何选择使用Linux作为后台服务器

1.Linux:免费,开源,稳定高效--->更安全

2.阿里云,腾讯云,亚马逊aws业务,说白了就是给企业提供Linux后台云服务的。(一般中小型公司不会自建机房,成本太高。)

1.3就个人找工作/能力提升来说,该如何看待Linux

Linux是一堆能力的集合,主要包括,日常使用,操作系统,计算机网络,部分组成原理,C语言,系统编程,网络编程,自动化脚本,问题解决与定位,资料查找。所以,Linux无论就业还是晋升都是 “技术职业人” 的底层核心能力之一。

1.4常见发行版本

    • Ubuntu

    Ubuntu是Debian的一款衍生版,也是当今最受欢迎的免费操作系统。Ubuntu侧重于它在这个市场的应用,在服务器、云计算、甚至一些运行Ubuntu Linux的移动设备上很常见。Ubuntu是新手用户肯定爱不释手的一款操作系统。

      • CentOS

      CentOS是一款企业级Linux发行版,它使用红帽企业级Linux中的免费源代码重新构建而成。这款重构版完全去掉了注册商标以及Binary程序包方面一个非常细微的变化。有些人不想支付一大笔钱,又能领略红帽企业级Linux;对他们来说,CentOS值得一试。此外,CentOS的外观和行为似乎与母发行版红帽企业级Linux如出一辙。 CentOS使用YUM来管理软件包。


      二、搭建Linux环境

      2.1Linux 环境的搭建方式

      1. 直接安装在物理机上. 但是由于 Linux 桌面使用起来非常不友好, 不推荐。

      2. 使用虚拟机软件, 将 Linux 搭建在虚拟机上. 但是由于当前的虚拟机软件(如 VMWare 之类的)存在一些 bug , 会导致环境上出现各种莫名其妙的问题, 比较折腾。

      3. 使用云服务器, 可以直接在 腾讯云, 阿里云或华为云 等服务器厂商处直接购买一个云服务器.

      使用云服务器不仅环境搭建简单, 避免折腾, 同时还有一个最大的好处, 部署在云服务器上的项目可以直接被外网访问到, 这个时候就和一个公司发布一个正式的网站没有任何区别. 也就能让我们自己写的程序真的去给别人去使用.(博主本人是在Shell上运行)

      2.2Linux内核版本与源码下载

      Linux --Centos下载指南:Centos-Linux下载与安装

      Centos连接Xshell方法:连接Xshell

      (Xshell 下:复制: ctrl + insert (有些同学的 insert 需要配合 fn 来按) , 粘贴: shift + insert)

      linux内核官网:https://www.kernel.org/

      国内还行的Linux社区:

      http://www.178linux.com/

      https://linux.cn/

      2.3Linux好玩的指令

      2.3.1配置相关文件

      1.将我们的用户切换为超级用户(root权限)

      超级用户和普通用户的区别:用户权限

      首先通过命令:

      [jj@localhost ~]$ sudo -s
      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.
      [sudo] password for jj: 
      jj is not in the sudoers file.  This incident will be reported.

      image.gif

      image.gif编辑

      解决办法:普通用户提权

      2.配置yum源

      # epel-release是Linux中的第三方非正版的应用商店,一般官网没有的这里都有
      [root@localhost ~]# yum install -y epel-release
      ...
      # 下载 sl 指令-->可以跑小火车
      [root@localhost ~]# yum install sl
      # 执行指令 sl
      [root@localhost ~]# sl
      -----------------------------
      小伙伴安装出现问题私信我

      image.gif

      image.gif编辑

      # 好玩的小指令:小猪
      [root@localhost ~]# yum install -y cowsay
      # 小猪说:你好,敖云岚!
      [root@localhost ~]# cowsay hello aoyunlan!
       _________________
      < hello aoyunlan! >
       -----------------
              \   ^__^
               \  (oo)\_______
                  (__)\       )\/\
                      ||----w |
                      ||     ||

      image.gif

      # 好玩的小指令 黑箱子
      [root@localhost ~]# yum install -y boxes
      # 管道指令,先不用理解
      [root@localhost ~]# echo "cat" | boxes -d cat
                  /\             /\
                 |`\\_,--="=--,_//`|
                 \ ."  :'. .':  ". /
                ==)  _ :  '  : _  (==
                  |>/O\   _   /O\<|
                  | \-"~` _ `~"-/ |
                 >|`===. \_/ .===`|<
           .-"-.   \==='  |  '===/   .-"-.
      .---{'. '`}---\,  .-'-.  ,/---{.'. '}---.
       )  `"---"`     `~-===-~`     `"---"`  (
      (  cat                                  )
       )                                     (
      '---------------------------------------'
      [root@localhost ~]# echo "dog" | boxes -d dog
                __   _,--="=--,_   __
               /  \."    .-.    "./  \
              /  ,/  _   : :   _  \/` \
              \  `| /o\  :_:  /o\ |\__/
               `-'| :="~` _ `~"=: |
                  \`     (_)     `/
           .-"-.   \      |      /   .-"-.
      .---{     }--|  /,.-'-.,\  |--{     }---.
       )  (_)_)_)  \_/`~-===-~`\_/  (_(_(_)  (
      (  dog                                  )
       )                                     (
      '---------------------------------------'

      image.gif

      # 黑色背景版本的天气预告:大家自己尝试一下
      [root@localhost ~]# curl http://wttr.in
      #linux_logo的企鹅logo展示,我觉得不像企鹅
      [root@localhost ~]# yum install linux_logo
      [root@localhost ~]# linux_logo
                   ,        ,
                  /(        )`
                  \ \___   / |
                  /- _  `-/  '
                 (/\/ \ \   /\
                 / /   | `    \
                 O O   ) /    |
                 `-^--'`<     '
                (_.)  _  )   /
                 `.___/`    /
                   `-----' /
      <----.     __ / __   \
      <----|====O)))==) \) /====
      <----'    `--' `.__,' \
                   |        |
                    \       /       /\
               ______( (_  / \______/
             ,'  ,-----'   |
             `--{__________)

      image.gif

      2.3.2Linux查看网络连接

      # ping 是网络中检测连通性的命令
      # -c3 表示只 ping 三次
      [root@localhost ~]# ping -c3 baidu.com
      PING baidu.com (39.156.66.10) 56(84) bytes of data.
      64 bytes from 39.156.66.10 (39.156.66.10): icmp_seq=1 ttl=128 time=29.4 ms
      64 bytes from 39.156.66.10 (39.156.66.10): icmp_seq=2 ttl=128 time=29.5 ms
      64 bytes from 39.156.66.10 (39.156.66.10): icmp_seq=3 ttl=128 time=29.1 ms
      # 有tt1,说明处于联网状态

      image.gif

      2.3.3查看网络接口

      # 查看若干接口:网络连接情况
      [root@localhost ~]# ifconfig
      ...
      lo:表示本地环回接口
      xxx:
      ...
      # 关网指令:
      [root@localhost ~]# sudo ifdown ens33
      # 联网指令
      [root@localhost ~]# sudo ifup ens33

      image.gif

      查看本地公网 i p :

      C:\Users\L>ipconfig
      image.gif

      image.gif编辑

      2.3.2在Linux中编译第一个C语言程序

      # 创建一个文件夹(目录):mkdir指令
      [root@localhost MyLinux]# mkdir Practice
      # 进入该文件夹 cd xx
      [root@localhost MyLinux]# cd Practice
      # 通过vim编辑test.c的内容
      [root@localhost Practice]# vim test.c
      #include<stdio.h>
      int main()
      {
        printf("Hello Linux!");
        return 0;
      }
      #退出程序:按 esc 后按 shift+; 输入wq退出vim编辑器
      # gcc -o 自定义名 目标文件 -》:gcc是一款编译器(需要有C语言的基础)
      [root@localhost Practice]# gcc -o test test.c
      # .表示当前目录,/ 表示分隔符 :运行当前目录test文件
      [root@localhost Practice]# ./test
      Hello Linux!
      # 如果大家使用gcc或者vim报错,通过yum install -y gcc/vim进行安装

      image.gif

      目录
      相关文章
      |
      8月前
      |
      Shell Linux C语言
      linux2022正式课程开班-预科001
      linux2022正式课程开班-预科001
      27 0
      |
      11月前
      |
      Linux
      鸟哥的Linux私房菜PDF
      鸟哥的Linux私房菜PDF
      111 0
      |
      12月前
      |
      消息中间件 存储 网络协议
      《硬核linux攻略》读书笔记更新中
      《硬核linux攻略》读书笔记更新中
      |
      数据可视化 Linux 开发工具
      冬季实战营学习记录之linux
      冬季实战营学习记录之linux
      115 0
      |
      Linux
      《Linux就是这个范儿》试读有感
      《Linux就是这个范儿》试读有感
      118 0
      |
      运维 Linux 云计算
      Linux体验感悟--《我的linux初体验》
      云起实验室----Linux指令入门-文件与权限
      14377 0
      Linux体验感悟--《我的linux初体验》
      |
      运维 监控 安全
      Linux怎么讲?你说了算!——Linux系列课程首发内测
      Linux学习成长路线图谱开始内测!进群看更多关于Linux路径课程最新资讯!
      83826 0
      Linux怎么讲?你说了算!——Linux系列课程首发内测
      |
      运维 Linux 程序员
      专访笨叔叔:2019年可能是Linux年?
      来源 | 异步专访 | 审校 张爽 ​ ​ 2017年9月《奔跑吧 Linux内核》一书出版后得到了广大Linux从业人员和爱好者(特别是从事Linux相关产品开发的工程师)的好评,也有不少高校采用该书作为研究生的Linux内核课程的参考书目。
      2420 0