• 微信公众号:美女很有趣。 工作之余,放松一下,关注即送10G+美女照片!

Linux常用命令

开发技术 开发技术 4小时前 2次浏览

Linux常用命令

0 设定root密码:

sudo passwd root

1.新建命令

1.1新建文件

touch new filename
vi filename

1.2新建文件夹

mkdir /home filename

2.删除命令

2.1删除文件:

rm filename

2.2删除文件夹

rm -rf dirname

3.移动文件

cd 到文件所在目录,mv filename 指定目录
例子:
mv test.txt /home/Downloads

4.查看虚拟机ip地址

ipconfig
inet后就是ip地址

5.打开二进制文件

bless filename

6.更换镜像源

更换源步骤如下:

6.1备份源列表:

sudo cp /etc/apt/sources.list /etc/apt/sources.list.old

6.2命令行打开sources.list文件:

sudo gedit /etc/apt/sources.list

6.3修改sources,list文件【本例更改为阿里镜像源】

6.3.1阿里镜像源

deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src 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-backports main restricted universe multiverse

6.3.2 中科大镜像源

deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

6.3.3 清华镜像源

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

6.3.4 163镜像源

deb http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse

6.4更新并升级:

sudo apt-get update && sudo apt-get upgrade

7.赋予软件安装包权限

sudo chmod a+x qt-opensource-linux-x64-5.12.8.run

8.SSH服务的启动与关闭

8.1启动SSH命令

sudo /etc/init.d/ssh start

8.2停止SSH命令

sudo /etc/init.d/ssh stop

8.3启动SSH命令

sudo /etc/init.d/ssh restart

8.4系统默认端口为22,修改可执行以下命令:

sudo vim /etc/ssh/sshd_config

8.5卸载SSH服务:

sudo /etc/init.d/ss stop
卸载sftp服务
sudo apt-get remove openssh-sftp-server
卸载openssh-server服务
sudo apt-get remove openssh-server


程序员灯塔
转载请注明原文链接:Linux常用命令
喜欢 (0)