Linux中常用的操作指令(随时更新)
生活随笔
收集整理的這篇文章主要介紹了
Linux中常用的操作指令(随时更新)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
注:本文的所有內容都來源于網絡,是本人再使用過程中遇到的一些不太常用、經常忘記的指令,出處太分散,無法標注。如有問題,請在下方留言,本人會及時更正或刪除。謝謝!
CentOS
防火墻放開端口
#sudo /sbin/iptables -I INPUT -p tcp --dport 3690 -j ACCEPT //開啟防火墻端口: #/etc/init.d/iptables save //保存修改 service iptables restart // 重啟防火墻,修改生效?添加和刪除用戶
//root賬戶下添加用戶為test的用戶,非root賬戶下需要加sudo #useradd test // 輸入回車后會緊接著要求你輸入該賬戶的密碼#passwd test//修改用戶名為test的的賬戶的密碼//刪除 用戶名為test的賬戶 #userdel test //刪除名為test的賬戶以及刪除/home/test/目錄以及目錄下的文件夾 #userdel -r test刪除非空目錄
我們都知道刪除文件用rm+路徑,刪除目錄用rmdir,但是如果目錄下有文件就會提示Directory is not Empty。那該如何刪除非空目錄呢。
在命令行里面輸入 rm --help 如下
[root@localhost ~]# rm --help Usage: rm [OPTION]... FILE... Remove (unlink) the FILE(s).-f, --force ignore nonexistent files, never prompt-i prompt before every removal-I prompt once before removing more than three files, orwhen removing recursively. Less intrusive than -i,while still giving protection against most mistakes--interactive[=WHEN] prompt according to WHEN: never, once (-I), oralways (-i). Without WHEN, prompt always--one-file-system when removing a hierarchy recursively, skip anydirectory that is on a file system different fromthat of the corresponding command line argument--no-preserve-root do not treat `/' specially--preserve-root do not remove `/' (default)-r, -R, --recursive remove directories and their contents recursively-v, --verbose explain what is being done--help display this help and exit--version output version information and exit如果確定要刪除文件目錄以及該目錄下面的所有文件的話可以用一下指令
rm -rf /home/test //用rm -r 會讓你挨個確認是否刪除文件目錄下的每一個文件,所以加上 -f 強制刪除。不再確認ubuntu下 在右鍵菜單中添加在此打開終端 選項
sudo apt-get install nautilus-open-terminal//重新加載文件管理器nautilus -q//或注銷再登錄?
轉載于:https://www.cnblogs.com/jonzone/p/4651997.html
總結
以上是生活随笔為你收集整理的Linux中常用的操作指令(随时更新)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Object-C 类,对象,运行时,is
- 下一篇: Java的LockSupport.par