1.安装环境xshell
进入下面的网址,下载xshell
https://www.netsarang.com/products/xsh_overview.html
2.购买云服务器
学生推荐腾讯云,学生认证购买服务器一年65元左右
3使用xshell登陆主机
ssh root@公网ip
例如
我输入ssh root@1.12.74.51
输入密码后显示下面一串表示你成功连接
[C:\~]$ ssh root@1.12.74.51
Connecting to 1.12.74.51:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.
WARNING! The remote SSH server rejected X11 forwarding request.
Last failed login: Fri Oct 14 08:20:11 CST 2022 from 185.246.130.20 on ssh:notty
There were 53 failed login attempts since the last successful login.
Last login: Thu Oct 13 15:17:31 2022
[root@VM-12-8-centos ~]#
01. ls 指令
语法
:
ls [
选项
][
目录或文件
]
功能
:对于目录,该命令列出该目录下的所有子目录与文件。对于文件,将列出文件名以及其他信息。
[root@VM-12-8-centos ~]# ls
111 centos7.sh home new txcdn.sh
a cosfs.sh install_panel.sh new.c x.txt
b dnspod.sh install.sh newclass zxs
1.ls -a表示列出目录下的所有文件,包括以 . 开头的隐含文件
[root@VM-12-8-centos ~]# ls -a
. .bashrc install_panel.sh .pydistutils.cfg
.. .cache install.sh .ssh
111 centos7.sh .lesshst .tcshrc
a .config new txcdn.sh
b cosfs.sh new.c .viminfo
.bash_history .cshrc newclass x.txt
.bash_logout dnspod.sh .pip zxs
.bash_profile home .pki
2.ls -l 表示列出文件的详细信息。
[root@VM-12-8-centos 109]# ls -l
total 4
drwxr-xr-x 2 root root 4096 Oct 8 15:43 108
对比一下ls
[root@VM-12-8-centos 109]# ls
108
发现信息多了很多,至于什么后面再谈。
3.ls -1 一行只输出一个文件。
ls-1的效果一行只显示一个文件。
[root@VM-12-8-centos 109]# ls -1
108
a.c
b.c
new.c
对比ls
[root@VM-12-8-centos 109]# ls
108 a.c b.c new.c
4.指令可以组合使用
比如我可以显示全部文件的详细信息并且一行输出一个
[root@VM-12-8-centos 109]# ls -al1
total 12
drwxr-xr-x 3 root root 4096 Oct 14 14:30 .
dr-xr-xr-x. 24 root root 4096 Oct 14 14:32 ..
drwxr-xr-x 2 root root 4096 Oct 8 15:43 108
-rw-r--r-- 1 root root 0 Oct 14 14:30 a.c
-rw-r--r-- 1 root root 0 Oct 14 14:30 b.c
-rw-r--r-- 1 root root 0 Oct 14 14:30 new.c
02.pwd指令
语法
: pwd
功能
:显示用户当前所在的目录
[root@VM-12-8-centos 108]# pwd
/109/108
03.cd指令
语法
:cd
目录名
功能
:改变工作目录。将当前工作目录改变到指定的目录下。
1.cd ..
进入上级目录
[root@VM-12-8-centos 108]# pwd
/109/108
[root@VM-12-8-centos 108]# cd ..
[root@VM-12-8-centos 109]# pwd
/109
2.cd ~ 表示进入用户家目录
[root@VM-12-8-centos 109]# pwd
/109
[root@VM-12-8-centos 109]# cd ~
[root@VM-12-8-centos ~]# pwd
/root
3.cd ../目录 相对路径
[root@VM-12-8-centos 111]# cd ./109
[root@VM-12-8-centos 109]# pwd
/root/111/109
[root@VM-12-8-centos 109]# cd ../110
[root@VM-12-8-centos 110]# pwd
/root/111/110
[root@VM-12-8-centos 110]# tree ..
..
├── 109
│ └── 108
│ └── 107
└── 110