Linux下C编程入门(1)

时间:2023-03-09 08:28:16
Linux下C编程入门(1)

Linux系统的介绍(以下以Manjaro最新版为例子):

一、系统的安装:

  1、可以直接使用U盘做一个live usb的启动盘,在bios中设置从U盘启动即可拥有linux系统,如果是新式bios需要将secrut boot设置项关掉,按照向导操作即可。

  2、可以借助虚拟机体验,安装virtual box最新版本,注意系统的版本(32位还是64位),倒入我给你们的安装好的镜像文件,直接导入,启动运行即可。

  3、可以安装win10的linux子系统,简单体验即可,只是以后的命令稍有不同。

  4、可以使用物理机直接安装,这个可以向周围人求助,也可以到网上求助,我的学生可以直接找我,安装加配置过程大概需要1~2个小时即可。

二、系统配置:

  1、配置软件的命令,须使用root权限:

    (1)、vi  /etc/pacman.d/mirrorlist 文件,大概如下:                    配置软件源,加快下载和安装的速度,选择自己最快的软件源即可。

   ##
## Manjaro Linux default mirrorlist
## Generated on -- :
##
## Please use 'pacman-mirrors -f NUMBER' to modify mirrorlist
## (Use for all mirrors)
## ## Country : China
Server = http://mirrors.tuna.tsinghua.edu.cn/manjaro/stable/$repo/$arch ## Country : China
Server = https://mirrors.ustc.edu.cn/manjaro/stable/$repo/$arch ## Country : Japan
Server = http://ftp.tsukuba.wide.ad.jp/Linux/manjaro/stable/$repo/$arch ## Country : France
Server = http://kibo.remi.lu/stable/$repo/$arch ## Country : Australia
Server = http://manjaro.mirror.serversaustralia.com.au/stable/$repo/$arch ## Country : United_Kingdom
Server = http://manjaro.mirrors.uk2.net/stable/$repo/$arch ## Country : Belarus
Server = http://mirror.datacenter.by/pub/mirrors/manjaro/stable/$repo/$arch ## Country : United_States
Server = http://mirror.dacentec.com/manjaro/stable/$repo/$arch ## Country : United_States
Server = http://mirror.solarvps.com/manjaro/stable/$repo/$arch ## Country : Hungary
Server = http://mirror.infotronik.hu/mirrors/pub/manjaro/stable/$repo/$arch ## Country : Indonesia
Server = http://kambing.ui.ac.id/manjaro/stable/$repo/$arch ## Country : Portugal
Server = http://manjaro.barata.pt/stable/$repo/$arch ## Country : *
Server = http://free.nchc.org.tw/manjaro/stable/$repo/$arch ## Country : Bulgaria
Server = http://manjaro.telecoms.bg/stable/$repo/$arch ## Country : Austria
Server = http://mirror.inode.at/manjaro/stable/$repo/$arch ## Country : Indonesia
Server = http://kartolo.sby.datautama.net.id/manjaro/stable/$repo/$arch ## Country : Germany
Server = http://mirror.ragenetwork.de/manjaro/stable/$repo/$arch ## Country : United_Kingdom
Server = http://mirror.catn.com/pub/manjaro/stable/$repo/$arch ## Country : Spain
Server = http://ftp.caliu.cat/manjaro/stable/$repo/$arch ## Country : Hong_Kong
Server = http://ftp.cuhk.edu.hk/pub/Linux/manjaro/stable/$repo/$arch ## Country : Australia
Server = http://manjaro.melbourneitmirror.net/stable/$repo/$arch ## Country : South_Africa
Server = http://mirror.is.co.za/mirrors/manjaro.org/stable/$repo/$arch ## Country : United_States
Server = https://mirrors.ocf.berkeley.edu/manjaro/stable/$repo/$arch ## Country : Germany
Server = https://mirror.netcologne.de/manjaro/stable/$repo/$arch ## Country : United_States
Server = https://mirror.clarkson.edu/manjaro/stable/$repo/$arch ## Country : United_Kingdom
Server = https://www.mirrorservice.org/sites/repo.manjaro.org/repos/stable/$repo/$arch ## Country : Netherlands
Server = https://manjaro.mirror.wearetriple.com/stable/$repo/$arch ## Country : United_States
Server = https://mirror.math.princeton.edu/pub/manjaro/stable/$repo/$arch ## Country : Chile
Server = http://manjaro.dcc.uchile.cl/stable/$repo/$arch ## Country : Denmark
Server = https://www.uex.dk/repos/manjaro/stable/$repo/$arch ## Country : Bulgaria
Server = https://manjaro.ipacct.com/manjaro/stable/$repo/$arch ## Country : Germany
Server = https://mirror.alpix.eu/manjaro/stable/$repo/$arch ## Country : Canada
Server = https://osmirror.org/manjaro/stable/$repo/$arch ## Country : Belgium
Server = https://manjaro.cu.be/stable/$repo/$arch ## Country : Netherlands
Server = https://nl.mirror.babylon.network/manjaro/stable/$repo/$arch ## Country : France
Server = https://fr.mirror.babylon.network/manjaro/stable/$repo/$arch ## Country : Russia
Server = https://mirror.yandex.ru/mirrors/manjaro/stable/$repo/$arch ## Country : Czech
Server = https://mirror.dkm.cz/manjaro/stable/$repo/$arch ## Country : Romania
Server = http://mirrors.serverhost.ro/manjaro/packages/stable/$repo/$arch ## Country : Ecuador
Server = https://mirror.cedia.org.ec/manjaro/stable/$repo/$arch ## Country : Costa_Rica
Server = https://mirrors.ucr.ac.cr/manjaro/stable/$repo/$arch ## Country : United_Kingdom
Server = http://repo.manjaro.org.uk/stable/$repo/$arch ## Country : Germany
Server = https://manjaro-mirror-a.alpix.eu/stable/$repo/$arch ## Country : Denmark
Server = https://mirrors.dotsrc.org/manjaro/stable/$repo/$arch ## Country : Germany
Server = https://repo.rhindon.net/manjaro/stable/$repo/$arch ## Country : Germany
Server = http://babyname.tips/mirrors/manjaro/stable/$repo/$arch ## Country : Germany
Server = http://ftp.tu-chemnitz.de/pub/linux/manjaro/stable/$repo/$arch ## Country : Singapore
Server = https://download.nus.edu.sg/mirror/manjaro/stable/$repo/$arch ## Country : France
Server = http://ftp.free.org/mirrors/repo.manjaro.org/repos/stable/$repo/$arch ## Country : Netherlands
Server = https://mirror.koddos.net/manjaro/stable/$repo/$arch ## Country : Germany
Server = https://ftp.halifax.rwth-aachen.de/manjaro/stable/$repo/$arch ## Country : Turkey
Server = http://ftp.linux.org.tr/manjaro/stable/$repo/$arch ## Country : Ireland
Server = https://ftp.heanet.ie/mirrors/manjaro/stable/$repo/$arch ## Country : Portugal
Server = http://ftp.dei.uc.pt/pub/linux/manjaro/stable/$repo/$arch ## Country : Netherlands
Server = https://ftp.nluug.nl/pub/os/Linux/distr/manjaro/stable/$repo/$arch ## Country : Netherlands
Server = http://ftp.snt.utwente.nl/pub/linux/manjaro/stable/$repo/$arch ## Country : Sweden
Server = https://ftp.lysator.liu.se/pub/manjaro/stable/$repo/$arch ## Country : Germany
Server = https://mirror.netzspielplatz.de/manjaro/packages/stable/$repo/$arch

  文件说明:

    (1)、以#开始的行都是被注释掉的,文件在被解析时是无用的

    (2)、容易看出前7行都为注释

    (3)、第9行## Country : China虽然是注释行,表明以下是中国的内容

    (4)、第10行Server = http://mirrors.tuna.tsinghua.edu.cn/manjaro/stable/$repo/$arch文件主要有

      a、Server=设置Server变量,内容在赋值符号右边

      b、http://mirrors.tuna.tsinghua.edu.cn说明使用清华大学的的镜像服务,九江的访问不够稳定

      c、manjaro对应的linux镜像名称与发行版本名称一致

      d、stable说明使用的稳定源,可以是testing或unstable源,有风险

      e、后面的$repo/$arch就是套路,知道有这个内容就行了

    (5)、我一般使用中国科大的软件源,但是清华的源是第一个,只要将第10行注释掉,也就是在行首加上个#就好了

    (6)、这样实际起作用的就是第13行代码,其他依次类推,更加激进的是将不需要的行全部删除即可。

  2、软件更改(需要有root的权限):

    (1)、在线安装软件:pacman -S vim

    (2)、离线安装软件:pacman -U vim

    (3)、查询系统软件:pacman -Q vim

    (4)、删除已装软件:pacman -R vim

    (5)、升级全部软件:pacman -Syyu

  3、安装必备的软件:

    (1)、开发工具:gcc make gdb 前面三个必须,kdgb netbeans  okteta  bless选装等

    (2)、编辑工具:vim kate atom vscode等任选一个即可

    (3)、其他工具:qstardict字典翻译  kicad电路制版  umlet uml设计工具 arduino世界级的单片机开发工具 Fritzing开源的软件仿真工具

    (4)、教育软件:Ktouch Ktuitle step等

    (5)、游戏软件:0AD实时战争类 Wesnoth策略类 Chromium-bsu射击类游戏 SuperTux竞速类游戏 Ksudoku 数独游戏  pingus儿童类游戏 frozen bubble泡泡龙,assaultcube枪战类游戏相当不错 Xonotic也不错

    (6)、其他推荐:chromium游览器的王者 firefox浏览器的万能 smplay看电影和听音乐的选择  kodi linux下的多媒体中心  VLC也不错  deepin-screen-recorder深度录屏工具也不错  simplescreenrecorder也不错