{"action":"opened","issue":{"url":"https://api.github.com/repos/Wellaiyo/notes/issues/20","repository_url":"https://api.github.com/repos/Wellaiyo/notes","labels_url":"https://api.github.com/repos/Wellaiyo/notes/issues/20/labels{/name}","comments_url":"https://api.github.com/repos/Wellaiyo/notes/issues/20/comments","events_url":"https://api.github.com/repos/Wellaiyo/notes/issues/20/events","html_url":"https://github.com/Wellaiyo/notes/issues/20","id":187957080,"number":20,"title":"Linux 常用命令","user":{"login":"Wellaiyo","id":10163680,"avatar_url":"https://avatars.githubusercontent.com/u/10163680?v=3","gravatar_id":"","url":"https://api.github.com/users/Wellaiyo","html_url":"https://github.com/Wellaiyo","followers_url":"https://api.github.com/users/Wellaiyo/followers","following_url":"https://api.github.com/users/Wellaiyo/following{/other_user}","gists_url":"https://api.github.com/users/Wellaiyo/gists{/gist_id}","starred_url":"https://api.github.com/users/Wellaiyo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Wellaiyo/subscriptions","organizations_url":"https://api.github.com/users/Wellaiyo/orgs","repos_url":"https://api.github.com/users/Wellaiyo/repos","events_url":"https://api.github.com/users/Wellaiyo/events{/privacy}","received_events_url":"https://api.github.com/users/Wellaiyo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-11-08T10:37:28Z","updated_at":"2016-11-08T10:37:28Z","closed_at":null,"body":"`cd` `ls` `pwd` `cp` `mv` `mkdir` `vi` `cat` `touch` `rm` 这些最基本的命令就不提了，用过 `Unix` 的都记得死死地\r\n\r\n### ps\r\n\r\n查看进程信息\r\n\r\n```bash\r\n# 查看端口是否已占用\r\nps -aux | grep 8080\r\n\r\n// 杀死进程\r\nkill -9 pID\r\n```\r\n\r\n### grep\r\n\r\n做条件筛选\r\n\r\n```bash\r\n# 筛选出所有带file字符的文件\r\nls -l | grep -i file\r\n```\r\n\r\n### scp\r\n\r\n复制文件\r\n\r\n```bash\r\n# 复制本地文件到远程\r\nscp -rf ./file.js root@115.28.10.196:/root\r\n```\r\n\r\n### chmod\r\n\r\n更改用户权限\r\n\r\n```bash\r\nchmod [-R] xyz 文件或目录\r\n# -R：进行递归的持续更改，即连同子目录下的所有文件都会更改\r\n\r\n# 把file的文件权限改变为-rxwr-xr-x\r\nchmod 0755 file\r\n```\r\n\r\n### tar\r\n\r\n对文件做压缩、解压处理\r\n\r\n```bash\r\n-c ：新建打包文件  \r\n-t ：查看打包文件的内容含有哪些文件名  \r\n-x ：解打包或解压缩的功能，可以搭配-C（大写）指定解压的目录，注意-c,-t,-x不能同时出现在同一条命令中  \r\n-j ：通过bzip2的支持进行压缩/解压缩  \r\n-z ：通过gzip的支持进行压缩/解压缩  \r\n-v ：在压缩/解压缩过程中，将正在处理的文件名显示出来  \r\n-f filename ：filename为要处理的文件  \r\n-C dir ：指定压缩/解压缩的目录dir\r\n```\r\n\r\n```bash\r\n# 压缩\r\ntar -jcv -f filename.tar.bz2 要被处理的文件或目录名称\r\n# 查询\r\ntar -jtv -f filename.tar.bz2  \r\n# 解压\r\ntar -jxv -f filename.tar.bz2 -C 欲解压缩的目录\r\n```\r\n\r\n### 系统状态管理\r\n\r\n```bash\r\n# 关闭系统(1) \r\nshutdown -h now\r\n# 关闭系统(2) \r\ninit 0\r\n# 关闭系统(3) \r\ntelinit 0\r\n# 按预定时间关闭系统\r\nshutdown -h hours:minutes & \r\n# 取消按预定时间关闭系统 \r\nshutdown -c\r\n# 重启(1) \r\nshutdown -r now\r\n# 重启(2) \r\nreboot\r\n# 注销 \r\nlogout\r\n```\r\n\r\n### ln\r\n\r\n链接两个文件或目录，默认为物理链接（以文件副本形式存在，不占实际空间）\r\n\r\n```bash\r\nln [参数] [源文件或目录] [目标文件或目录]\r\n# -s 软链接（以路径形式存在，类似于Windows上的快捷方式）\r\n```"}}
{"actor":{"display_login":"Wellaiyo"}}