目前使用的是VMware,安装了ubuntu 12.04.3版本的server。
先进入,
ubuntu:~$ ifconfig得到IP地址。
目前本机上还安装了一个putty。putty.exe,输入ip,open.
login as: dream410
dream410@192.***.***.***’s password:
Welcome to Ubuntu 12.04.3 LTS (GNU/Linux 3.8.0-29-generic x86_64)
* Documentation: https://help.ubuntu.com/
System information as of Sun Dec 8 22:11:35 CST 2013
System load: 0.13 Processes: 82
Usage of /: 6.2% of 19.07GB Users logged in: 1
Memory usage: 31% IP address for eth0: 192.***.***.***
Swap usage: 0%
Graph this data and manage this system at https://landscape.canonical.com/
86 packages can be updated.
49 updates are security updates.
Last login: Sun Dec 8 22:09:23 2013
dream410@ubuntu-test:~$ vim
dream410@ubuntu-test:~$ sudo su
[sudo] password for dream410:
//获得管理员权限
root@ubuntu-test:/home/dream410# cd /var/www
//默认的web目录
root@ubuntu-test:/var/www# vi test.php
//进入
<?php
if($_POST['username']){
echo $_POST['username'].”, welcome.”;
}else{
?>
<form action=”" method=”post”>
<input name=”username” type=”text”>
<input type=”submit”>
</form>
<?php
}
~
~
“test.php” 12L, 188C 1,1 All
一些基础操作:
h:同一行中上一个字符
j:上一行
k:下一行
l:同一行中的下一个字符
i:进入insert模式
w:移动到下一个单词的首字母
W:移动到下一个空格的后面的那个字母(如果有连续的空格则移动到下一个不是空格的字母)
esc:退出insert模式
冒号:进入命令模式
保存并退出: wq(enter)
不保存并退出: q!(enter)
root@ubuntu-test:/var/www#
关于 chmod:
root@ubuntu-test:/var/www# chmod -x test.php
root@ubuntu-test:/var/www# ll
total 16
drwxr-xr-x 2 root root 4096 Dec 8 22:55 ./
drwxr-xr-x 13 root root 4096 Dec 8 21:55 ../
-rw-r–r– 1 root root 177 Dec 8 21:56 index.html
-rw-r–r– 1 root root 188 Dec 8 22:26 test.php
root@ubuntu-test:/var/www# chmod +x test.php
root@ubuntu-test:/var/www# ll
total 16
drwxr-xr-x 2 root root 4096 Dec 8 22:55 ./
drwxr-xr-x 13 root root 4096 Dec 8 21:55 ../
-rw-r–r– 1 root root 177 Dec 8 21:56 index.html
-rwxr-xr-x 1 root root 188 Dec 8 22:26 test.php*
/*
d(文件夹) rwx (用户权限) r-x(用户所在组权限) r-x(访客权限)
chmod -x test.php
这样修改会根据访问者权限的不同而不同
同理还有chmod +x test.php
此外 chmod 777 test.php
这样则根据2进制使得所有制1即:
- rwx rwx rwx(7,7,7)
同理 chmod 124 test.php
- –x -w- r– (1,2,4)
*/
PS:对于安装一个东西时,一下输出的太多,则可以用:|more实现分屏。
按空格键则看下一面代码。
ctrl+C强制停止