2021-05-07

## 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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值