# ps aux|grep nc
# netstat -tlen | grep nc
screen
http://www.ibm.com/developerworks/cn/linux/l-cn-screen/
1. screen, 启动screen。
2. Ctrl-a d, 离开screen。
3. exit,退出screen。或执行命令Ctrl-a k。
4. screen -ls,列出scrren会话。
5. screen -r pid,恢复ID是pid的会话,只有一个会话则不需要pid。
6. screen -x,网络中断等非正常离开后重新控制该会话。
7. Ctrl-a c,创建窗口。
8. Ctrl-a Ctrl-a窗口切换。
Ctrl-a n,切换到下一个窗口。
Ctrl-a p,返回上一个窗口。
9. Ctrl-a ",显示窗口列表,用方向键选择后回车。
10. Ctrl-a ?,列出所有快捷命令。
11. Ctrl-a m,查看活动状态;Ctrl-a _,后台查看。
查看Linux发行版本
lsb_release -a
查看Linux内核版本
查看CPU是几核
输出命令运行时间
time command
peak memory measurement of long running process in linux
http://stackoverflow.com/questions/1080461/peak-memory-measurement-of-long-running-process-in-linux
用Pipe Viewer 跟踪长时间操作的进度
nc(netcat)
监听接收文件:
netcat -l -p 1234 > file
发送文件:
cat file | netcat hostname 1234
3)扫描远程主机,例子:
格式:nc -nvv -w2 -z 192.168.x.x 80-445
讲解:扫描192.168.x.x的TCP80到TCP445的所有端口
SSH
Cygwin安装SSH Server
免密码访问
# Change to your user mode
su - username
# Create an RSA key pair with an empty password
ssh-keygen -t rsa -P ""
# Enable SSH access to your local machine with this newly created key
cat $HOME/.ssh/id_rsa.pub >> $HOME/.ssh/authorized_keys
# Can can test by
ssh localhost
# Add this publick SSH key to the authorized_keys files of other machine
ssh-copy-id -i $HOME/.ssh/id_rsa.pub user@machine
# You can test by
ssh master
后台运行
http://www.21andy.com/blog/20071121/677.html
使用 & 结尾,但是如果终端关闭,那么程序也会被关闭。
使用 jobs 查看任务。
使用 fg %n 关闭。
查看文件编码
http://mindspill.net/computing/linux-notes/determine-and-change-file-character-encoding.html
Vim
open the file, then
:set fileencoding
Use vim to change a file's encoding
If you use the vim text editor, you can configure it to save files as utf-8. Place the following in your /etc/vim/vimrc or ~/.vimrc file:
set encoding=utf-8
set fileencoding=utf-8
Change a file's encoding from the command line
To convert the file contents to from ASCII to UTF-8:
Or
To convert the file contents from UTF-8 to ASCII:
Because UTF-8 can contain characters that can't be encoded with ASCII, this command will generate an error unless you tell it to strip non-ASCII characters using the -c flags:
A similar thing can be achieved using the -f flag with the recode command.
多台机器同时执行命
或者把机器名放在单独的文件中