簡單的常用 linux命令與操作

2021-10-17 11:29:17 字數 1489 閱讀 5482

系統命令

登入 :使用者 密碼

登出:logout

重啟: reboot

關機: shutdown

檢視程序:ps -ef | grep 名稱

殺死程序: kill -9 pid pid pid…

清屏:clear

列印:echo

檢視歷史命令:history

防火牆命令

red hat:

檢視防火牆狀態:systemctl status firewalld

暫時關閉:systemctl stop firewalld

永久關閉:systemctl disable firewalld

重啟防火牆:systemctl enable firewalld

centos7

檢視防火牆狀態:service iptables status

暫時關閉:service iptables stop

永久關閉:chkconfig iptables off

重啟防火牆:service iptables restart

永久關閉後重啟:chkconfig iptables on

檔案與目錄命令

建立資料夾:mkdir 資料夾名

建立檔案:touch 檔名

列出檔案列表命令:

ls(list)當前目錄檔案喝子目錄列表

ls -a 顯示以 . 開頭的檔案

ls -s 顯示 所有空間 ls -s -s 按空間大小排序

ll 顯示詳細資訊

切換目錄

cd  (根目錄一定加斜槓 )

. 當前目錄

.. 上級目錄

... 或者

/ 根目錄

檔案/資料夾操作

刪除:rm -rf  要刪除的資料夾或檔名

刪除資料夾 : rmdir -rf 不加-rf 智慧型刪除空目錄

複製檔案的 cp 命令:

cp 原始檔名稱   複製到位址加檔名.格式

cp -v 顯示 複製過程

cp -v -r* 資料夾路徑 將所有檔案遞迴複製到資料夾下

檢視

cat 檔名(路徑加檔名)
編輯檔案

vi(無格式)  vim
壓縮與解壓

zip解壓: unzip 壓縮包名   

zip壓縮:zip -r 壓縮的名稱.zip 壓縮的檔案 或者資料夾名

配置環境變數

切換root使用者,執行 vi /etc/profile 或者 vim /etc/profile

i編輯 檔案 export 名稱大寫=路徑(一搬)

退出儲存修改 esc :wq

重新整理檔案 source /etc/profile

Linux常用簡單命令

系統根目錄 當前使用者家目錄 其他普通目錄 cd 目錄 絕對路徑 相對路徑 返回上一級 清屏 clear 或 ctrl l 檢視當前絕對路徑 pwd 檢視當前目錄下內容 ls a i l 增 mkdir 目錄路徑 刪 rmdir 目錄路徑 改 mv 原路徑 新路徑 增 touch 檔案路徑 刪 rm...

Linux檔案與目錄常用的操作命令

常用的目錄操作命令 功能分類 命令建立,刪除目錄 mkdir,rmdir 顯示,改變當前目錄 pwd,cd 顯示目錄內容ls 注 pwd present working directory cd change directory pwd命令 功能 顯示當前目錄的絕對路徑 格式 pwd cd命令 功能...

Linux 常用的操作命令

檢視當前目錄 pwd 修改密碼 passwd 更換模式 csh,bash 遠端登陸 telnet 伺服器ip 回到上級目錄 cd 檢視該目錄下的資料夾 ls 開啟檔案 vi 資料夾 檔案 檔案顯示的格式 root x 0 root root bin bash 使用者名稱,加密,序號,組,預設路徑 退...