Linux command === * [name=Ander Liu] ###### tags: `Linux` `TODO` [TOC] ## `man` command ```bash man ls # Display the manual page for the item (program) ls. man 7 man man man.7 man 'man(7)' ``` * The manual has 9 sections, and `man N intro` will display the introduction page for section `N` 1. Executable programs or shell commands 2. System calls (functions provided by the kernel) 3. Library calls (functions within program libraries) 4. Special files (usually found in /dev) 5. File formats and conventions 6. Games 7. Miscellaneous (including macro packages and conventions) 8. System administration commands (usually only for root) 9. Kernel routines > https://manpages.ubuntu.com/manpages/noble/en/man1/man.1.html > https://manpages.ubuntu.com/manpages/noble/en/man1/man.1posix.html ## POSIX command * cd: **c**hange **d**irectory ```bash cd # equal to `cd $HOME` ``` > https://manpages.ubuntu.com/manpages/noble/en/man1/cd.1posix.html ## package management :::info TL;DR: for user command, use `apt` ::: * dpkg: **p**ac**k**a**g**e manager for **D**ebian * `dpkg` is a medium-level tool to manage packages. The primary and more user-friendly front-end for `dpkg` is `apt(8)` > https://manpages.ubuntu.com/manpages/noble/en/man1/dpkg.1.html * apt: **A**dvanced **P**ackage **T**ool * `apt` provides a high-level CLI for the package management system. It is intended as an end user interface and better suited for interactive usage compared to more specialized APT tools like `apt-get(8)` and `apt-cache(8)` > https://manpages.ubuntu.com/manpages/noble/en/man8/apt.8.html * apt-get * `apt-get` is the command-line tool for handling packages, and is considered the user's "back-end" to other tools using the APT library > https://manpages.ubuntu.com/manpages/noble/en/man8/apt-get.8.html ## Linux command * cd: **c**hange **d**irectory 改變工作目錄 ``` cd games //進入 games 目錄 cd .. //回到上一層目錄 ``` > http://manpages.ubuntu.com/manpages/disco/en/man1/cd.1posix.html * cp: **c**o**p**y 複製檔案 ``` cp jones /home/nick/clients //複製 jones 至 /home/nick/clients ``` > http://manpages.ubuntu.com/manpages/disco/en/man1/cp.1.html * ls: **l**i**s**t 列出目錄內容 > http://manpages.ubuntu.com/manpages/disco/en/man1/ls.1.html * mkdir: **m**a**k**e **dir**ectory 建立目錄 ``` mkdir name_of_directory //建立 name_of_directory 目錄 ``` > http://manpages.ubuntu.com/manpages/disco/en/man1/mkdir.1.html * mv: **m**o**v**e 移動檔案 ``` mv myfile subdir/ //移動 myfile 到 subdir/ 目錄裡 mv myfile .. //移動 myfile 到上一層目錄裡 ``` > http://manpages.ubuntu.com/manpages/disco/en/man1/mv.1.html * pwd: **p**rint **w**orking **d**irectory 輸出目前目錄 > http://manpages.ubuntu.com/manpages/disco/en/man1/pwd.1.html * rm: **r**e**m**ove 刪除檔案或目錄 * -r: **r**ecursive * -f: **f**orce ``` rm foo //刪除 foo rm -rf foo //強制刪除 foo 目錄 ``` > http://manpages.ubuntu.com/manpages/disco/en/man1/rm.1.html * vim: 文字編輯器 ``` vim lab1.cpp //編輯 lab1.cpp 這個檔案,如果這個檔案不存在,它會自行創建一個 ``` > http://manpages.ubuntu.com/manpages/disco/en/man1/vim.1.html ### reference * https://manpages.ubuntu.com/manpages/noble/en/ * https://en.wikipedia.org/wiki/List_of_POSIX_commands ## Vim ## GCC * g++ ***file***.cpp * ./a.out ## Git ## Todo * man * printenv * export * .bashrc * .bash_profile * dpkg -i <!-- update reference when *26.04 LTS* releases --> ## See Also * [Bash / shell](/RMLrGdhFQ1muCOYBGeVoSQ) ## Homepage * [Homepage](/@NDR/Homepage) *[CLI]: command-line interface