使用XP系统提供的命令提示符功能在FAT32格式下把分区无损转换为NTFS格式
开始–程序–附件-命令提示符
进入DOS状态
输入命令:convert空格*:/fs:ntfs回车
*代表你将要转换的逻辑盘盘符
比如要想转换D盘为NTFS分区格式就输入convert d:/fs:ntfs回车
注意系统盘一般就是C盘要最后转换
Author: jpuyy
-
xp下变fat32为ntfs
-
linux工具之Screen/byobu
安装screen
#apt-get install screen
安装byobu
#apt-get install byobu
接下来主要讲screen Detached表示会话处于挂起状态,Attached表示有终端在连接会话,Dead状态为死掉状态 清理screen的Dead会话,可以查看到此会话的进程号,然后kill -9,之后再screen -wipe
[detached from 10054.pts-0.www] jpuyy@www:~$ kill -9 10054 jpuyy@www:~$ screen -ls There is a screen on: 10054.pts-0.www (2012年03月03日 21时09分03秒) (Dead ???) Remove dead screens with 'screen -wipe'. 1 Socket in /var/run/screen/S-jpuyy.
jpuyy@www:~$ screen -wipe There is a screen on: 10054.pts-0.www (2012年03月03日 21时09分04秒) (Removed) 1 socket wiped out. No Sockets found in /var/run/screen/S-jpuyy.
screen 新建screen并登陆到其中 screen -t win 创建一个以win作为默认窗口标题的screen并登陆到其中 screen -list 列出screen列表 screen -wipe 清理僵死的screen窗口 screen -r [pid] 连接到当前无用户在连接的对应pid的screen,pid可以通过screen -list获得 screen -x [pid] 连接到对应pid的screen,不论当前有无用户已连接其中 screen窗口内部常用命令: 先按CTRL+a,然后松开再按下面的键: c 创建新的screen窗口并切换到其中 K 杀死当前screen窗口 ” 列出当前screen窗口列表 ‘ 输入screen窗口号码或名称的提示符 0 选择0号窗口 … 9 选择9号窗口 A 设置当前screen窗口的标题 d 断开与当前scree终端的连接 DD 断开与当前screen终端的连接并注销 –added in 20121204 用无线连接时,正在使用screen,突然网断了,然后重新连到服务器上
root@ibm:~# screen -r There is a screen on: 24643.pts-0.ibm (11/27/2012 07:50:06 PM) (Attached) There is no screen to be resumed.
发现不能回到原来的screen,从网上查得使用如下命令,踢掉上次中断的用户,并接管screen:
screen -D -r <session-id>
如上面的例子就是 :
screen -D -r 24643
使用node js版的shadowsocks时,会自动挂掉,所以把它放到screen中,用crontab每45分钟重开启一下
*/45 * * * * /usr/bin/killall screen; /usr/bin/screen -dmS node /usr/local/bin/node /usr/local/shadowsocks-nodejs/server.js
参考文章: http://www.ibm.com/developerworks/cn/linux/l-cn-screen/
使用screen翻屏
Ctrl+A, Esc 进入 C/P 模式,然后用Page Up/Down 翻页 还能用?<string> 查找
使用screen的时候,通用配置文件在/etc/screenrc,可以新建
~/.screenrc从而使用定制化的screen配置。 add @2014-05-15 启动screen的时候,直接连接多个ssh,用tab区分screen -dmS sshmulti -c sshmulti.conf
原理是将ssh的命令和名称写到sshmulti.conf,启动时指定配置文件,配置文件如下
escape ^Xx autodetach on # default: on crlf off # default: off hardcopy_append on # default: off startup_message off # default: on termcap xterm 'AF=\E[3%dm:AB=\E[4%dm' terminfo xterm 'AF=\E[3%p1%dm:AB=\E[4%p1%dm' vbell off # default: ??? defscrollback 1000 # default: 100 silencewait 15 # default: 30 caption always "%{wk}%?%-Lw%?%{bw}%n*%f %t%?(%u)%?%{wk}%?%+Lw%? %= %{= kw}%110`%109`%111`" hardstatus string '%99`%{= kw} %100`%112`%= %102`%101`%114`%115`%108`%113`%119`%117`%118`%116`%106`%104`%103`%105`%107`%Y-%m-%d %0c:%s' activity "activity in %n (%t) [%w:%s]~" bell "bell in %n (%t) [%w:%s]~" pow_detach_msg "BYE" vbell_msg " *beep* " screen -t server88 ssh 192.168.1.88 screen -t server99 ssh 192.168.1.99参考:http://askubuntu.com/questions/49245/start-multiple-apps-running-in-shells-split-in-one-console
有时在 screen 里会要看很长的历史,则需要把 buffer 加大,要看的时候按 ctrl-a 再按 {,再按 u 上翻, d 下翻
对 session 重命名
screen -list There are screens on: 2580.pts-0.centos7-work (Detached) 2478.pts-0.centos7-work (Detached) 2 Sockets in /var/run/screen/S-vagrant. # 重命名 -S 当前名 -X sessionname 要修改的名字 screen -S 2580.pts-0.centos7-work -X sessionname backend-service创建新的 tab
press Ctrl+A+c to create a new virtual console
切换
press Ctrl+A+n to switch to next tab press Ctrl+A+p to switch to previous tab
-
pstree清楚看清运行进程的关系
CentOS 这样安装
yum install psmisc
看看我的vps上
init─┬─console-kit-dae───2*[{console-kit-da}]
├─courierlogger───authdaemond───5*[authdaemond]
├─2*[courierlogger───couriertcpd]
├─cron───4*[cron───sh───python]
├─dbus-daemon
├─7*[getty]
├─master─┬─pickup
│ ├─proxymap
│ ├─qmgr
│ └─tlsmgr
├─mongod───7*[{mongod}]
├─mysqld───20*[{mysqld}]
├─nginx───2*[nginx]
├─openvpn
├─php5-fpm───3*[php5-fpm]
├─pptpd
├─2*[python───5*[{python}]]
├─rsyslogd───3*[{rsyslogd}]
├─snmpd
├─sshd───sshd─┬─bash───top
│ └─bash───pstree
├─udevd───2*[udevd]
└─upstart-udev-brpstree -p 可同时显示进程号
-
linux下用rtorrent挂pt,bt
在centos 6.2 64bit 下面安装rtorrent方法:
cd /etc/yum.repos.d wget http://yum.aclub.net/pub/linux/centos/6/umask/umask.repo rpm --import http://yum.aclub.net/pub/linux/centos/6/umask/RPM-GPG-KEY-umask yum install rtorrent screen
在个人文件夹中,创建需要的目录
cd ~ mkdir watch # 用于存放.torrent文件 mkdir ptfiles # 用于存放下载的资料 mkdir session # 存放session
编写适用于本人的rtorrent配置文件
vim ~/.rtorrent.rc
写入
# This is an example resource file for rTorrent. Copy to # ~/.rtorrent.rc and enable/modify the options as needed. Remember to # uncomment the options you wish to enable. # Maximum and minimum number of peers to connect to per torrent. min_peers = 40 max_peers = 100 # Same as above but for seeding completed torrents (-1 = same as downloading) min_peers_seed = 10 max_peers_seed = 50 # Maximum number of simultanious uploads per torrent. max_uploads = 15 # Global upload and download rate in KiB. "0" for unlimited. download_rate = 0 upload_rate = 0 # Default directory to save the downloaded torrents. directory = ./ptfiles # Default session directory. Make sure you don't run multiple instance # of rtorrent using the same session directory. Perhaps using a # relative path? session = ./session # Watch a directory for new torrents, and stop those that have been # deleted. schedule = watch_directory,5,5,load_start=./watch/*.torrent schedule = untied_directory,5,5,stop_untied= # Close torrents when diskspace is low. schedule = low_diskspace,5,60,close_low_diskspace=100M # The ip address reported to the tracker. #ip = 127.0.0.1 #ip = rakshasa.no # The ip address the listening socket and outgoing connections is # bound to. #bind = 127.0.0.1 #bind = rakshasa.no # Port range to use for listening. port_range = 6890-6999 # Start opening ports at a random position within the port range. #port_random = no # Check hash for finished torrents. Might be usefull until the bug is # fixed that causes lack of diskspace not to be properly reported. check_hash = yes # Set whetever the client should try to connect to UDP trackers. #use_udp_trackers = yes # Alternative calls to bind and ip that should handle dynamic ip's. #schedule = ip_tick,0,1800,ip=rakshasa #schedule = bind_tick,0,1800,bind=rakshasa # Encryption options, set to none (default) or any combination of the following: # allow_incoming, try_outgoing, require, require_RC4, enable_retry, prefer_plaintext # # The example value allows incoming encrypted connections, starts unencrypted # outgoing connections but retries with encryption if they fail, preferring # plaintext to RC4 encryption after the encrypted handshake # # encryption = allow_incoming,enable_retry,prefer_plaintext # Enable DHT support for trackerless torrents or when all trackers are down. # May be set to "disable" (completely disable DHT), "off" (do not start DHT), # "auto" (start and stop DHT as needed), or "on" (start DHT immediately). # The default is "off". For DHT to work, a session directory must be defined. # dht = auto # UDP port to use for DHT. # # dht_port = 6881 # Enable peer exchange (for torrents not marked private) # # peer_exchange = yes # # Do not modify the following parameters unless you know what you're doing. # # Hash read-ahead controls how many MB to request the kernel to read # ahead. If the value is too low the disk may not be fully utilized, # while if too high the kernel might not be able to keep the read # pages in memory thus end up trashing. #hash_read_ahead = 10 # Interval between attempts to check the hash, in milliseconds. #hash_interval = 100 # Number of attempts to check the hash while using the mincore status, # before forcing. Overworked systems might need lower values to get a # decent hash checking rate. #hash_max_tries = 10
到这里,rtorrent已经配置完成,为了端口正常使用,centos的iptables里需加:
iptables -A INPUT -p tcp --dport 6890:6900 -j ACCEPT iptables -A INPUT -p udp --dport 6890 -j ACCEPT
rtorrent完全基于文本并在终端中运行,不可能每时每刻都开tty。所以,配合screen来,效果很好(screen -dmS name cmd )
screen -dmS rtorrent-name rtorrent
在rtorrent的界面,常执行的操作是
Ctrl-s
Start download. Runs hash first unless already done. 定位到一个种子后,会先检查hash开始下载,一般是自动下载的
Ctrl-d
Stop an active download or remove a stopped download,按一次暂停,再按一次删除此任务及torrent文件(不会删除对应的下载文件)
a/s/d 增大下载速度限制分别为 1/5/50 KB.
z/x/c 减少下载速度限制分别为 1/5/50 KB.
A/S/D 增大上传速度限制分别为 1/5/50 KB.
Z/X/C 减少上传速度限制分别为 1/5/50 KB.Ctrl-q
Quit application 退出rtorrent
官方文档
https://wiki.archlinux.org/index.php/RTorrent
当正常下载之后,使用screen的如下组合键:
(ctrl + a ) +d
使当前screen会话detached,常用,简单的来说就是把rtorrent放入后台。
下载 magnet 链接:
https://openwares.net/2016/12/04/rtorrent-magnet-download/ load 加载输入 magnet 链接即可
-
2012读书清单
1 文学
1.1 顾准文集
2 传记
2.1 随遇而安
2.2 胡雪岩的启示3 心理效率
3.1 社会心理学
3.2 战胜拖拉
3.3 把信送给加西亚(应该说是一篇文章)
3.4 How to Ask Questions The smart way. URL: http://www.catb.org/esr/faqs/smart-questions.html
3.5 How to Report Bugs Effectively. URL: http://www.chiark.greenend.org.uk/~sgtatham/bugs.html4 技术
4.1 iptables pocket
4.2 计算机网络(第4版)
4.3 Blog启示录-wordpress博客建设与经营(2012-09-06)
4.4 Pro Puppet
4.5 Vim and Vi Tips: Essential Vim and Vi Editor Skills, 2nd ed.
4.6 笨方法学python5 小说
5.1 1Q84-1
5.2 1Q84-2
5.3 1Q84-3
5.4 nothing to envy
5.5 蛙(2012年10月21日读完)
5.6 生死疲劳
5.7 丰乳肥臀
5.8 檀香刑6 生存
6.1 公务员申论
6.2 公务员行测7 经济
7.1 富爸爸 穷爸爸
7.2 国富论
7.3 战胜华尔街
7.4 世界是平的
7.5 十亿消费者红色的没有读完,2013年继续
-
python中DNS查询和反向查询
用到的还是python的socket库,用到函数getaddrinfo()
定义如下:
getaddrinfo(host, port, family=0, socktype=0, proto=0, flags=0)
例:#!/usr/bin/env python import sys, socket result = socket.getaddrinfo("jpuyy.com", 80, 0, 0, socket.SOL_TCP) print result返回结果是
[(10, 1, 6, ”, (‘2604:6600:1059::5810:3a0a’, 80, 0, 0)), (2, 1, 6, ”, (‘216.24.201.107’, 80))]
执行反向查询
gethostbyaddr(ip_address)
查询主机名的详细信息
getfqdn([name]) #Return a fully qualified domain name for name.
http://docs.python.org/library/socket.html
在debian下面安装PyDNS( python-dns )进行DNS的高级查询
apt-get install python-dns
程序中,import DNS,先进行 DNS.DiscoverNameServers(),然后建立一个请求对象 DNS.Request()。请求后PyDNS会返回包含结果的对象。