## ubuntu创建文件、文件夹以及一些基本操作
基本操作
pwd 查看当前所在位置
cd 路径 进入文件夹
mkdir 文件名称 创建文件夹
touch 文件名称 创建txt文件
mv 文件名称 路径 剪切某文件放到其他路径中
cp 文件名称 路径/新名称 复制某个文件到某个路径并且可以改变文件名称
rm 文件名称 删除文件
rm -r 文件夹 递归删除文件夹
sudo 提升权限
指令 - -help 帮助告诉指令用法
一、ubuntu16.04更换国内源
1.备份原始源文件source.list
桌面打开终端,执行命令:sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
2.修改源文件sources.list
(1)终端执行命令:sudo chmod 777 /etc/apt/sources.list 更改文件权限使其可编辑;
(2)执行命令: sudo gedit /etc/apt/sources.list 打开文件进行编辑;
(3)删除原来的文件内容,复制下面的任意一个到其中并保存(常用的是阿里源和清华源,推荐阿里源)
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
创建cpp文件
~$ touch main.cpp
在gedit中打开这个文件
gedit main.cpp
输入以下命令编译:
~$ g++ main.cpp
或者
g++ -o hello hello.cpp //如果是.c文件,则gcc -o hello hello.c,下一步执行命令跟下面一样
输入以下命令运行程序:
~$ ./a.out