Linux Command
壓縮與解壓
tar壓縮 : tar czvf filename.tgz data/
tar解壓 : tar xzvf filename.tgz
zip壓縮 : zip -r filename data/*
zip解壓 : unzip filename.zip
尋找
1.which:用於尋找可直接執行的指令,只在$PATH路徑中尋找
ex:
$ which python
/usr/bin/python
2.whereis:可尋找命令和大多數man文件,在$PATH路徑與系統目錄尋找
ex:
$ whereis python
python: /usr/bin/python3.8-config /usr/bin/python3.8 /usr/bin/python2.7 /usr/bin/python /usr/bin/python2.7-config /usr/lib/python3.8 /usr/lib/python3.9 /usr/lib/python2.7 /usr/lib/python3.6 /etc/python3.8 /etc/python2.7 /etc/python /etc/python3.6 /usr/local/lib/python3.8 /usr/local/lib/python2.7 /usr/include/python3.8 /usr/include/python2.7 /usr/share/python
3.find:直接搜尋整個文件目錄,預設從根目錄搜尋
ex:sudo find / -name 'keyword'
systemctl常用指令
顯示所有已啟動的服務:
systemctl list-units --type=service
顯示所有服務:
systemctl list-units --type=service --all
systemctl enable [service]:使某服務自動啟動
systemctl disable [service]:使某服務不自動啟動
systemctl status [service]:服務詳細信息
systemctl is-active [service]:顯示是否啟動
systemctl start [service]:啟動某服務
systemctl stop [service]:停止某服務
systemctl restart [service]:重啟某服務
pip
pip -V
pip install [package_name]
pip install [package_name] -U
pip install [package_name]==x.x.x -U
pip uninstall [package_name]
pip show [package_name]
apt
apt update 負責使用源列表中定義的URL更新包的資訊。
資訊更新後,apt upgrade 接管並使用最新版本升級所有已安裝的軟件包。
在安裝工具之前運行 apt update 可確保獲得要安裝的工具的最新版本
apt 常用命令
列出可更新清單:sudo apt update
升級套裝軟體:sudo apt upgrade
安裝指定軟體:sudo apt install <package_name>
安裝多個軟體:sudo apt install <package_1> <package_2> <package_3>
更新指定的軟體命令:sudo apt update <package_name>
移除套裝軟體及設定檔: sudo apt purge <package_name>
刪除套裝軟體:sudo apt remove <package_name>
列出已安裝軟體:sudo apt list
查找套裝軟體: sudo apt search <keyword>
顯示套裝軟體具體資訊,例如:版本號,安裝大小,依賴關係等等:sudo apt show <package_name>
清理不再使用的依賴和庫檔: sudo apt autoremove
編輯軟體庫設定檔:sudo apt edit-sources
升級套裝軟體,升級前先刪除需要更新軟體包:sudo apt full-upgrade
查詢安裝路徑: dpkg -L <package_name>
pipx
#安裝
python3 -m pip install pipx
#加入路徑
python3 -m pipx ensurepath
#安裝套件
pipx install [package_name]
pipx uninstall [package_name]
Kali linux
中文化
sudo apt update
sudo dpkg-reconfigure locales
輸入法
sudo apt install ibus-chewing
VNC
sudo apt update
sudo apt install -y novnc x11vnc
x11vnc -display :0 -autoport -localhost -nopw -bg -xkb -ncache -ncache_cr -quiet -forever
noVNC
/usr/share/novnc/utils/novnc_proxy --listen 8081 --vnc localhost:5900