Linux常用命令

Posted TSCCG

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Linux常用命令相关的知识,希望对你有一定的参考价值。

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常用命令的主要内容,如果未能解决你的问题,请参考以下文章

linux常用命令多少个

Linux第二章-Linux常用命令

Linux文本操作常用命令

:常用工具命令第23节:常用命令 - Linux命令

Linux常用命令

Linux部署项目常用命令