1c7 / VideoList

:us: -> :cn: @糖醋陈皮 翻译的视频列表
https://weibo.com/2004104451
57 stars 11 forks source link

Linux 笔记 #66

Open 1c7 opened 8 years ago

1c7 commented 8 years ago



1. Ubuntu

Ctrl+Alt+F1会切换到命令行界面 F1~F6 分别是6个不同的终端窗口(和图形界面里的terminal有啥区别) Ctrl+Alt+F7会返回图形界面

Ctrl + D: 退出当前终端,同样你也可以输入exit。 Ctrl + Z: 暂停当前进程,比如你正运行一个命令,突然觉得有点问题想暂停一下,就可以使用这个快捷键。暂停后,可以使用fg 恢复它。 Ctrl + L: 清屏,使光标移动到第一行。

ls = list man = manual


2. whereis

whereis ruby

whereis - locate the binary, source, and manual page files for a com‐ mand


3. which

which ruby

which - locate a command


4. History 命令 - 查看最近运行过的命令

history 10 查看最近10条


5. 如果想记录命令运行结果,可以用

command >>file.txt 2>&1

http://askubuntu.com/questions/136689/how-can-i-see-a-history-of-the-terminal-output-not-just-commands-entered


6. who - show who is logged on


7. Ubuntu 跑 Node.js 然后用 Windows 看

7.1 先看看自己的 IP

    ifconfig

image

7.2 运行 Node.js

image

7.3 现在IP和端口都知道了,在 Windows 里访问即可

image


8. Windows SSH 访问 Ubuntu (用PuTTY)

8.1 首先 ifconfig 找到自己的 IP

8.2 运行一遍

sudo apt-get install openssh-server openssh-client

安装 openssh

8.3 然后在 Windows 这边打开 PuTTY

image 输入IP,Saved Session 这边输个名字然后 Save,这样就不用每次打开都手动输一遍IP。 然后点击Open: image

参考资料:http://www.apelearn.com/study_v2/chapter6.html


9.

1c7 commented 8 years ago

1. env 查看系统预设的环境变量

image

2. echo $PATH

image

1c7 commented 8 years ago

1. Ubuntu 配置 NFS (没写完)

NFS = Network File System 用于分享文件用


服务端要安装 nfs-kernel-server

sudo apt-get update
sudo apt-get install nfs-kernel-server


客户端要安装 nfs-common

sudo apt-get update
sudo apt-get install nfs-common


服务端这边建个文件夹用于共享

sudo mkdir share-haha


改变这个文件夹的权限

 sudo chown nobody:nogroup share-haha


配置 NFS

sudo nano /etc/exports

nano 是文本编辑器,比vim简单


写入如下内容 /home 192.168.0.105(rw,sync,no_root_squash,no_subtree_check) /home/user1/Desktop 192.168.0.105(rw,sync,no_subtree_check)


然后运行

sudo exportfs -a


运行 NFS 服务

sudo service nfs-kernel-server start


1.1 现在配置客户端

sudo mkdir -p /mnt/nfs/home
sudo mkdir -p /mnt/nfs/var/nfs


然后

sudo mount 1.2.3.4:/home /mnt/nfs/home
sudo mount 1.2.3.4:/var/nfs /mnt/nfs/var/nfs

注意 IP 要改成服务端的 IP


参考资料:

https://www.digitalocean.com/community/tutorials/how-to-set-up-an-nfs-mount-on-ubuntu-14-04



Windows 怎么访问 Ubuntu 的 NFS?

1c7 commented 8 years ago

df - 显示硬盘空间用了多少

image

image

1c7 commented 8 years ago

1. Ubuntu 14.04 配置 FTP

记住 FTP 是明文传输的

1.1 安装 vsftpd

apt-get update
apt-get -y install vsftpd

1.2 配置


参考资料:

1c7 commented 8 years ago

FTPS (FTP over SSL) vs. SFTP (SSH File Transfer Protocol)