Linux常用命令(帶詳細操作截圖及說明)


一般在實際操作過程中都是在公司服務器上操作,很少有人會專門在家連接服務器學習linux。那么在家如何學習Linux呢?

簡單,虛擬機就可以,還不用裝雙系統。我們可以在windows系統裝安裝vmWare,然后使用Liunx系統鏡像就可以學習了,可以使用的Linux版本很多,Fedora、Suse、RedHat、Ubuntu等,我選用的是Fedora。

首先:連接服務器【本地操作不涉及,但是我們還是按照實戰環境做下演練】

涉及兩點:使用哪個用戶,何種連接方式

linux中有一個超級用戶root,權限最大,這個一般不會放開root遠程登錄的權限的,都是使用普通用戶連接登錄;連接方式一般是:SSH

假如使用的用戶為admin,那么我們使用連接工具時在命令行中輸入:ssh admin@服務器IP,然后輸入密碼即可

另外我們剛說到一般不會放開root遠程登錄權限,那要是二班呢,好吧,那就說下如何放開root遠程登錄權限

一般系統相關的配置都放在etc目錄中,要開啟遠程權限就是修改/etc/ssh下的sshd_config文件。修改如下配置項為yes,如果首字符有#號注釋還要去掉#。

PermitRootLogin yes

有的操作系統可能還需要在AllowsUser后添加 root,具體情況具體看,這里不做展開。

登錄服務器之后,我們就可以“為所欲為”了,哈哈,開個玩笑,操作服務器還是要謹慎再謹慎的。此時,我們肯定是迫不及待的使用命令解決問題呀,但是不巧,命令的一些參數和說明記不起來了怎么辦,怎么辦呀,沒事,系統有相應的幫助文檔哦,如何使用呢?

命令 --help
man 命令      //man是manual的縮寫
info 命令    //info是information的縮寫

第一種方式多個系統驗證是沒有問題的,后兩種方式在Fedora也是沒有問題的,在其他的系統有的不支持。

[root@localhost ssh]# cp --help
Usage: cp [OPTION]... [-T] SOURCE DEST
  or:  cp [OPTION]... SOURCE... DIRECTORY
  or:  cp [OPTION]... -t DIRECTORY SOURCE...
Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.

Mandatory arguments to long options are mandatory for short options too.
  -a, --archive                same as -dR --preserve=all
      --attributes-only        don't copy the file data, just the attributes
      --backup[=CONTROL]       make a backup of each existing destination file
  -b                           like --backup but does not accept an argument
      --copy-contents          copy contents of special files when recursive
  -d                           same as --no-dereference --preserve=links
  -f, --force                  if an existing destination file cannot be
                                 opened, remove it and try again (this option
                                 is ignored when the -n option is also used)
  -i, --interactive            prompt before overwrite (overrides a previous -n
                                  option)
  -H                           follow command-line symbolic links in SOURCE
  -l, --link                   hard link files instead of copying
  -L, --dereference            always follow symbolic links in SOURCE
  -n, --no-clobber             do not overwrite an existing file (overrides

  now,查看cp命令的幫助文檔,只截取了一部分參數。

現在命令也想起來了,我突然忘了我在系統那個位置了,這個可咋整?不要慌,要查看在那個路徑下,使用pwd命令

[root@localhost ssh]# pwd
/etc/ssh

  輸入pwd,系統回復你:傻子,你在/etc/ssh目錄下,你剛修改root的遠程登錄了。哦my god。你看我這腦子。。。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM