apt指令應用15種範例 [論壇 - Ubuntu 與工具程式及軟體推薦]


正在瀏覽:   1 名遊客


 到底部   前一個主題   下一個主題  [無發表權] 請登錄或者註冊



apt指令應用15種範例
版主
註冊日期:
2008/7/14 0:03
來自 螢幕的另一端
所屬群組:
網站管理員
已註冊使用者
討論區管理群
等級: 33
HP : 0 / 808
MP : 511 / 34694
EXP: 33
離線
各位好:

剛看到了一篇文章介紹 apt 指令的15種應用範例,本來想說是apt-get 或者是aptitude 我都很熟了,結果點進去一看,發現不是我所想的,它介紹的就是 apt 這個指令....

參考底下網頁
http://www.tecmint.com/apt-advanced-package-command-examples-in-ubuntu/



apt 這個指令,之前都沒怎麼看過,是新的工具嗎? 不知有哪些前輩可以介紹一下?

我 google 了一下,發現網路上可以查到的中文資料大多都是apt-get的資料,幾乎看不到 apt 這個指令的介紹或討論,有誰可以解惑一下?

2017/4/26 22:12
應用擴展 工具箱
回覆: apt指令應用15種範例
會員五級
註冊日期:
2010/9/16 14:08
所屬群組:
已註冊使用者
等級: 25
HP : 0 / 619
MP : 274 / 22636
EXP: 76
離線
是不是指這頁的內容???

6.2. aptitude、apt-get、與 apt 命令
https://debian-handbook.info/browse/zh-TW/stable/sect.apt-get.html


夢見草 寫到:
各位好:

剛看到了一篇文章介紹 apt 指令的15種應用範例,本來想說是apt-get 或者是aptitude 我都很熟了,結果點進去一看,發現不是我所想的,它介紹的就是 apt 這個指令....

參考底下網頁
http://www.tecmint.com/apt-advanced-package-command-examples-in-ubuntu/



apt 這個指令,之前都沒怎麼看過,是新的工具嗎? 不知有哪些前輩可以介紹一下?

我 google 了一下,發現網路上可以查到的中文資料大多都是apt-get的資料,幾乎看不到 apt 這個指令的介紹或討論,有誰可以解惑一下?

2017/4/26 23:39
----------------
個人網路文字作品集:
MacOSX10.5.8 安裝、設定、使用,個人經驗分享,正體中文版;以Windows思維用Linux,GNOME桌面篇;PDF
http://www.scribd.com/ianian1979
全字庫注音輸入法表格檔2019 (搭配CNS11643中文全字庫規格的Unicode格式傳統注音輸入法對照表)
https://sites.google.com/site/ianho7979/InputMethodTables
應用擴展 工具箱
回覆: apt指令應用15種範例
會員五級
註冊日期:
2012/4/22 10:50
所屬群組:
已註冊使用者
等級: 36
HP : 179 / 898
MP : 664 / 28641
EXP: 92
離線
夢見草 寫到:
各位好:

剛看到了一篇文章介紹 apt 指令的15種應用範例,本來想說是apt-get 或者是aptitude 我都很熟了,結果點進去一看,發現不是我所想的,它介紹的就是 apt 這個指令....

參考底下網頁
http://www.tecmint.com/apt-advanced-package-command-examples-in-ubuntu/



apt 這個指令,之前都沒怎麼看過,是新的工具嗎? 不知有哪些前輩可以介紹一下?

我 google 了一下,發現網路上可以查到的中文資料大多都是apt-get的資料,幾乎看不到 apt 這個指令的介紹或討論,有誰可以解惑一下?


關於「apt」這個指令,

以前是從另一個網友告訴我的,我才知道,在「這篇討論」,

網友告訴我在「apt 1.0」後,就有「apt」這個指令可以執行了。

可以查詢「apt 1.0」,就可以找到相關的討論文章了,

我那時候查到的一篇「參考文章」。

後來在這個論壇有幾篇討論我有提到「apt」,一時找不到那幾篇,
不過那幾篇也只是稍微提到有「apt」這個新的指令而已。

我雖然知道有「apt」這個指令,

但一直我還是習慣使用「apt-get」和「apt-cache」,只是習慣上沒改用「apt」,

還有「aptitude」以前我們有「討論過」打字的問題 ,(剛發現,這個回覆我有提到「apt」)。

另外「apt」和「apt-get」和「apt-cache」有些顯示方式不盡相同

例如可以執行下面指令對照


$ apt search vim



顯示



...略...

vim/xenial-updates,xenial-security,now 2:7.4.1689-3ubuntu1.2 amd64 [installed]
Vi IMproved - enhanced vi editor

vim-addon-manager/xenial,xenial,now 0.5.5 all [installed,automatic]
manager of addons for the Vim editor

...略...



對照


$ apt-cache search vim



顯示



...略...

vim - Vi IMproved - enhanced vi editor
vim-common - Vi IMproved - Common files
vim-doc - Vi IMproved - HTML documentation

...略...




現在(apt 1.0 後)「$ man 8 apt」,可以看到「apt」這個指令的用法,

然後以前「$ man 8 apt」得到的內容則是介紹「Advanced Package Tool」


以上我所記住印象比較深刻的,其他沒再去深究了



=========================================================

另外剛看您提供的連結,

發現在我的環境「Xubuntu 16.04 amd64」,「apt 1.2.19 (amd64)」

執行


$ apt content vim



或是執行


$ sudo apt content vim



會得到


E: Invalid operation content



然後執行


$ apt help



顯示


apt 1.2.19 (amd64)
Usage: apt [options] command

apt is a commandline package manager and provides commands for
searching and managing as well as querying information about packages.
It provides the same functionality as the specialized APT tools,
like apt-get and apt-cache, but enables options more suitable for
interactive use by default.

Most used commands:
list - list packages based on package names
search - search in package descriptions
show - show package details
install - install packages
remove - remove packages
autoremove - Remove automatically all unused packages
update - update list of available packages
upgrade - upgrade the system by installing/upgrading packages
full-upgrade - upgrade the system by removing/installing/upgrading packages
edit-sources - edit the source information file

See apt(8) for more information about the available commands.
Configuration options and syntax is detailed in apt.conf(5).
Information about how to configure sources can be found in sources.list(5).
Package and version choices can be expressed via apt_preferences(5).
Security details are available in apt-secure(8).
This APT has Super Cow Powers.





對照您給的「參考文章」的第二個項目的那張圖。

在「Ubuntu」,「apt」能使用的「command」好像比較少,不知道是不是版本的關係

現在我大概可以理解之前網友提到的了

obarisk 寫到:
apt > 1.0
用apt就可以了

只是ubuntu的apt比debian的apt來的差一點

2017/4/27 4:35
應用擴展 工具箱
回覆: apt指令應用15種範例
會員五級
註冊日期:
2012/4/22 10:50
所屬群組:
已註冊使用者
等級: 36
HP : 179 / 898
MP : 664 / 28641
EXP: 92
離線
另外題外話,

現在在網路上,還會看到其他方式來安裝軟體,有些人可能有看過了,

像是「snap」,「AppImage」,「Flatpak」。

之前本來要提,後來忙了,就又給擱置了,

剛好藉這篇來寫一下簡略的介紹,可以一起討論。

不過我也只有初步的涉略,瞭解的不多,

也可以從這些關鍵字,再找到更多的參考資料摟。


以下測試環境,「Xubuntu 16.04 amd64 英文界面」

==========================================================


## snap

* https://snapcraft.io/

執行


$ snap




或是執行


$ snap -h



顯示


Usage:
snap [OPTIONS] <command>

Install, configure, refresh and remove snap packages. Snaps are
'universal' packages that work across many different Linux systems,
enabling secure distribution of the latest apps and utilities for
cloud, servers, desktops and the internet of things.

This is the CLI for snapd, a background service that takes care of
snaps on the system. Start with 'snap list' to see installed snaps.


Application Options:
--version Print the version and exit

Help Options:
-h, --help Show this help message

Available commands:
abort Abort a pending change
ack Adds an assertion to the system
alias Enables the given aliases
aliases Lists aliases in the system
buy Buys a snap
change List a change's tasks
changes List system changes
connect Connects a plug to a slot
disable Disables a snap in the system
disconnect Disconnects a plug from a slot
download Downloads the given snap
enable Enables a snap in the system
find Finds packages to install
get Prints configuration options
help Help
info show detailed information about a snap
install Installs a snap to the system
interfaces Lists interfaces in the system
known Shows known assertions of the provided type
list List installed snaps
login Authenticates on snapd and the store
logout Log out of the store
refresh Refreshes a snap in the system
remove Removes a snap from the system
revert Reverts the given snap to the previous state
run Run the given snap command
set Changes configuration options
try Tests a snap in the system
unalias Disables the given aliases
version Help
watch Watch a change in progress




舉例,執行


$ snap find deepin



顯示


Name Version Developer Notes Summary
deepin-voice-recorder 0.1 xiaoguo - deepin-voice-recorder
deepin-image-viewer 0.1 xiaoguo - deepin-image-viewer
deepin-music 0.1 xiaoguo - deepin-music





執行


$ sudo snap install deepin-music



然後可以執行


$ snap run deepin-music



或是執行


$ deepin-music



也有相關的「desktop entry」,所以也可以在「開始功能表」上找到啟動的icon選項,直接點選就可以啟動了。


相關的路徑在

* /snap/
* /snap/bin
* /snap/deepin-music/

執行


$ cat /etc/profile.d/apps-bin-path.sh



顯示


# Expand the $PATH to include /snap/bin which is what snappy applications
# use
PATH=$PATH:/snap/bin



執行


$ cat /etc/environment



顯示


$ PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"




可以執行


$ echo $PATH




關於「PATH」的概念,可以參考「鳥哥的 Linux 私房菜 / 10.4.1 路徑與指令搜尋順序」,
最近相關的討論「回覆#13」「回覆#5」,其餘的相關連結紀錄在這個「索引

也可以執行

* $ man bash
* $ man sh

然後查詢「PATH」,可以找到相關的說明。


==========================================================

## AppImage


* http://appimage.org/


除了官網首頁提到的範例,操作方式也可以參考「KDevelop / download

執行


wget -c 'https://download.kde.org/stable/kdevelop/5.1.0/bin/linux/KDevelop-5.1.0-x86_64.AppImage' -O KDevelop.AppImage
chmod u+x KDevelop.AppImage
./KDevelop.AppImage




然後在「這一頁」,可以找到其他有採用的軟體。

==========================================================

## Flatpak

* http://flatpak.org/

尚未實際去操作過,待路過的大德補充,感恩先

或是可以先參考

* http://flatpak.org/hello-world.html


==========================================================


以上簡略介紹


2017/4/27 6:37
應用擴展 工具箱
回覆: apt指令應用15種範例
版主
註冊日期:
2008/7/14 0:03
來自 螢幕的另一端
所屬群組:
網站管理員
已註冊使用者
討論區管理群
等級: 33
HP : 0 / 808
MP : 511 / 34694
EXP: 33
離線
感謝 IanHo 和 samwhelp 提供這麼好的參考資料

2017/4/27 14:41
應用擴展 工具箱
回覆: apt指令應用15種範例
版主
註冊日期:
2008/7/14 0:03
來自 螢幕的另一端
所屬群組:
網站管理員
已註冊使用者
討論區管理群
等級: 33
HP : 0 / 808
MP : 511 / 34694
EXP: 33
離線
我發現我的 apt 指令好象沒有底下這篇文章裡所提到的那麼多的參數可用

http://www.tecmint.com/apt-advanced-package-command-examples-in-ubuntu/

不知是不是我的版本比較舊,我apt的參數可用的只有底下這些

$apt help
apt 1.0.9.8.4 是用於 amd64 並在 Dec 11 2016 09:48:19 上編譯的
Usage: apt [options] command

CLI for apt.
Basic commands:
list - list packages based on package names
search - search in package descriptions
show - show package details

update - update list of available packages

install - install packages
remove - remove packages

upgrade - upgrade the system by installing/upgrading packages
full-upgrade - upgrade the system by removing/installing/upgrading packages

edit-sources - edit the source information file

2017/4/28 15:47
應用擴展 工具箱
回覆: apt指令應用15種範例
會員五級
註冊日期:
2012/4/22 10:50
所屬群組:
已註冊使用者
等級: 36
HP : 179 / 898
MP : 664 / 28641
EXP: 92
離線
可能要參考原始碼,以下是執行步驟,提供您參考

我的測試環境,「Xubuntu 16.04 amd64 英文界面」

執行


$ apt-cache showsrc apt | grep '^Vcs'



顯示


Vcs-Browser: https://anonscm.debian.org/cgit/apt/apt.git
Vcs-Git: git://anonscm.debian.org/apt/apt.git





可以找到「https://anonscm.debian.org/cgit/apt/apt.git」這個連結


然後執行下面的指令,可以下載「apt」的「Source Package



$ apt-get source apt




然後執行下面的指令,觀看「apt-1.2.20/cmdline/apt.cc」這個檔案的內容


$ vi apt-1.2.20/cmdline/apt.cc



大概就可以看到支援的command名稱。


先到下面這個連結

* https://anonscm.debian.org/cgit/apt/apt.git/refs/tags

您的是「apt 1.0.9.8.4」 ,所以找到下面的連結

* https://anonscm.debian.org/cgit/apt/apt.git/tree/cmdline/apt.cc?h=1.0.9.8

也就是接近您的版本的「cmdline/apt.cc」。

## 其他相關連結

* [索引] 套件操作實務


以上提供參考


2017/4/28 16:36
應用擴展 工具箱


 [無發表權] 請登錄或者註冊


可以查看帖子.
不可發帖.
不可回覆.
不可編輯自己的帖子.
不可刪除自己的帖子.
不可發起投票調查.
不可在投票調查中投票.
不可上傳附件.
不可不經審核直接發帖.