發表文章

目前顯示的是有「linux」標籤的文章

Markdown

Start a Linux Process / Command in Background

Start a Linux Process / Command in Background #一般執行 cepar@DESKTOP-H3LUMQB MINGW64 ~/Desktop $ sleep 300 #背景執行 cepar@DESKTOP-H3LUMQB MINGW64 ~/Desktop $ sleep 300 & [1] 2524 #背景執行 cepar@DESKTOP-H3LUMQB MINGW64 ~/Desktop $ sleep 400 & [2] 2528 #查看背景工作 cepar@DESKTOP-H3LUMQB MINGW64 ~/Desktop $ jobs [1]- Running sleep 300 & [2]+ Running sleep 400 & cepar@DESKTOP-H3LUMQB MINGW64 ~/Desktop $ jobs -l [1]- 2524 Running sleep 300 & [2]+ 2528 Running sleep 400 & #帶回 foreground cepar@DESKTOP-H3LUMQB MINGW64 ~/Desktop $ fg %1 sleep 300 # ctrl + z 暫停並放到 background [1]+ Stopped sleep 300 cepar@DESKTOP-H3LUMQB MINGW64 ~/Desktop $ # ctrl + z # 此時背景中 pid 2524 狀態是 Stopped cepar@DESKTOP-H3LUMQB MINGW64 ~/Desktop $ jobs -l [1]+ 2524 Stopped sleep 300 [2]- 2528 Running sleep 400 & # 使用 bg 讓 process 重新再背景執行 cepar@DESKTOP-H3LUMQB MINGW64 ~/D...

[Linux] 開機服務設定

開機服務 http://fecbob.pixnet.net/blog/post/38143113-linux服務自動啟動功能 # vim /etc/rc.local touch /var/lock/subsys/local 14 15 /bin/systemctl start nginx.service 16 17 /bin/systemctl start redis.service ~ http://blog.topspeedsnail.com/archives/10459

[Linux] ApacheBench 效能優化 與 sysctl 設定

1.socket: Too many open files (24) 解决(在测试服务器操作): 1、查看当前系统设置:open files (-n) 1024为1024 [root@localhost ~]# ulimit -a core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited scheduling priority (-e) 0 file size (blocks, -f) unlimited pending signals (-i) 7844 max locked memory (kbytes, -l) 64 max memory size (kbytes, -m) unlimited open files (-n) 1024 pipe size (512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200 real-time priority (-r) 0 stack size (kbytes, -s) 10240 cpu time (seconds, -t) unlimited max user processes (-u) 1024 virtual memory (kbytes, -v) unlimited file locks (-x) unlimited 2、修改默认值: 临时生效: [root@localhost ~]# ulimit -n 65536 永久生效: /etc/security/limits.conf文件中添加以下两行后重新登陆 soft nofile 65536 hard nofile 65536 3、查看修改结果 [root@localhost ~]# ulimit -n 65536 2.apr_socket_recv: Connection reset by peer (104) 网上有一个解决办法是修改内核参数(被测试服务器): net.ipv4.conf.default.rp_filter = 1 net.ipv4.conf.all.rp_filter = 1 net.ipv4.tcp_syncooki...

[Linux] NTP

set date 如何校時 sudo yum install ntp Dependencies Resolved ============================================================================================================================================================================================================================================================================== Package Arch Version Repository Size ============================================================================================================================================================================================================================================================================== Installing: ntp x86_64 ...

[Linux] How To CURL with JSON

register curl -H "Content-Type: application/json" -X POST -d '{"username":"xyz","password":"xyz"}' http://127.0.0.1:8000/bank/register SERACH curl -H "Content-Type: application/json" -X POST -d '{"id":"1","behavior":"deposit","from":"0","to":"100"}' http://127.0.0.1:8000/bank/serach deposit curl -H "Content-Type: application/json" -X POST -d '{"id":"1","amount":"100"}' http://127.0.0.1:8000/bank/deposit withdrawals curl -H "Content-Type: application/json" -X POST -d '{"id":"1","amount":"100"}' http://127.0.0.1:8000/bank/withdrawals

[Linux] Http Method & Ajax

https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html 9.3  GET The GET method means retrieve whatever information (in the form of an entity) is identified by the Request-URI. If the Request-URI refers to a data-producing process, it is the produced data which shall be returned as the entity in the response and not the source text of the process, unless that text happens to be the output of the process. The semantics of the GET method change to a "conditional GET" if the request message includes an If-Modified-Since, If-Unmodified-Since, If-Match, If-None-Match, or If-Range header field. A conditional GET method requests that the entity be transferred only under the circumstances described by the conditional header field(s). The conditional GET method is intended to reduce unnecessary network usage by allowing cached entities to be refreshed without requiring multiple requests or transferring data already held by the client. The semantics of the GET method change to a ...

[Linux] XShell 技巧分享

http://www.cnblogs.com/greenerycn/archive/2010/05/01/xshell_tips.html

[Linux] 如何使用CURL去測試API

curl  http://test123/bank/register  -X POST -i -H “Content-Type:application/json” -H “Accept:application/json” -d ‘{“username” : hi, “password” : “16500asdas65”}’ REF: http://blog.kent-chiu.com/2013/08/14/testing-rest-with-curl-command.html https://curl.haxx.se/docs/manpage.html https://www.lifewire.com/curl-definition-2184508

[Linux] 使用 curl 命令 發送 http request

curl -X PUT "http://test123/api/edit/111" 回傳 GG

[Linux] 如何查看已安裝的軟體

http://linux.vbird.org/linux_basic/0520rpm_and_srpm.php [root@study ~]# rpm -qa                              <==已安裝軟體 [root@study ~]# rpm -q[licdR] 已安裝的軟體名稱       <==已安裝軟體 [root@study ~]# rpm -qf 存在於系統上面的某個檔名     <==已安裝軟體 [root@study ~]# rpm -qp[licdR] 未安裝的某個檔案名稱  <==查閱RPM檔案 選項與參數: 查詢已安裝軟體的資訊: -q  :僅查詢,後面接的軟體名稱是否有安裝; -qa :列出所有的,已經安裝在本機 Linux 系統上面的所有軟體名稱; -qi :列出該軟體的詳細資訊 (information),包含開發商、版本與說明等; -ql :列出該軟體所有的檔案與目錄所在完整檔名 (list); -qc :列出該軟體的所有設定檔 (找出在 /etc/ 底下的檔名而已) -qd :列出該軟體的所有說明檔 (找出與 man 有關的檔案而已) -qR :列出與該軟體有關的相依軟體所含的檔案 (Required 的意思) -qf :由後面接的檔案名稱,找出該檔案屬於哪一個已安裝的軟體; -q --scripts:列出是否含有安裝後需要執行的腳本檔,可用以 debug 喔! 查詢某個 RPM 檔案內含有的資訊: -qp[icdlR]:注意 -qp 後面接的所有參數以上面的說明一致。但用途僅在於找出    某個 RPM 檔案內的資訊,而非已安裝的軟體資訊!注意!         可以搭配gerp 使用 [eric_tu@localhost eric_tu]$ rpm -qa|grep php php56w-pdo-5.6.30-1.w7.x86_64 php56w-gd-...

[vim] setting

排版 由于在.vimrc文件中设置了 filetype plugin indent on 和 set cindent shiftwidth=4 在SecureCRT中使用鼠标复制-粘贴时,代码的自动缩进导致每一行都比上一行缩进一个tab,手工调整很麻烦,幸好发现了vim的自动排版方法: 在命令行模式下,首先使用“gg”将光标移动到文档开头,然后使用“v”切换到可视模式,再用“G”将光标移动到文档尾部(相当于全选),最后使用“=”,即可完成整个文档的自动排版。 http://blog.csdn.net/jianfyun/article/details/6594930 Vim Bundle sudo apt-get install git curl git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle vim ~/.vimrc set nocompatible " be iMproved, required filetype off " required " set the runtime path to include Vundle and initialize set rtp+=~/.vim/bundle/vundle/ call vundle#rc() " alternatively, pass a path where Vundle should install plugins "let path = '~/some/path/here' "call vundle#rc(path) " let Vundle manage Vundle, required Plugin 'gmarik/vundle' " The following are examples of different formats supported. " Keep Plugin commands between here and filetype plugin indent on. " scri...