Linux命令

# 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内核版本

cat   /proc/version
uname   -a
uname   -rcat   /etc/issue
man   uname

查看CPU是几核

cat /proc/cpuinfo

输出命令运行时间

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 跟踪长时间操作的进度

http://salogs.com/2009/12/%E7%94%A8-pipe-viewer-%E8%B7%9F%E8%B8%AA%E9%95%BF%E6%97%B6%E9%97%B4%E6%93%8D%E4%BD%9C%E7%9A%84%E8%BF%9B%E5%BA%A6/

 

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

http://cygwin.com.cn/view/141

 

免密码访问

# 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.


多台机器同时执行命








或者把机器名放在单独的文件中





















  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值