2012年(23)
分类: LINUX
2012-01-26 10:20:53
可以手动添加repository(), 在更改/etc/apt/sources.list or /etc/apt/preferences 后需要用sudo apt-get update来更新sources.list
apt-get 命令解释
安装软件:
apt-get install 软件包的名字
apt-get build-dep 软件包的名字;安装软件包的依赖包
apt-get -s install 软件包名;可以看到安装的细节
aptitude 与apt-get 用法差不多,可以用man aptitude 来查看用法。
auto-apt run
apt-get upgrade ;更新已安装的软件包
apt-get dist-upgrade; 升级系统到更高版本
apt-get check;获取更新目录和检查有无依赖包错误。
apt-get remove
apt-get purge
apt-get purge remove
apt-cache search
dpkg -l *
apt-cache show
dpkg -L
dlocate
apt-file search
apt-cache search filename | grep -w filename;will show only the files that contain filename as a whole word
Ubuntuhelp上的例子;
Typical usage example
I want to feel the wind in my hair, I want the adrenaline of speed. So lets install a racing game. But what racing games are available?
apt-cache search racing gameIt gives me a lot of answers. I see a game named "torcs". Lets get some more information on this game.
apt-cache show torcsHmmm... it seems interesting. But is this game not already installed on my computer? And what is the available version? Is it from Universe or main?
apt-cache policy torcsOk, so now, let's install it!
apt-get install torcsWhat is the command I must type in the console to launch this game? In this example, it's straightforward ("torcs"), but that's not always the case. One way of finding the name of the binary is to look at what files the package has installed in "/usr/bin". For games, the binary will be in "/usr/games". For administrative programs, it's in "/usr/sbin".
dpkg -L torcs | grep /usr/games/The first part of the command display all files installed by the package "torcs" (try it). With the second part, we ask to only display lines containing "/usr/games/". Hmmm, that game is cool. Maybe there are some extra tracks?
apt-cache search torcsBut I'm running out of space. I will delete the apt cache!
apt-get cleanOh no, my mother asked me to remove all games from this computer. But I want to keep the configuration files so I can simply re-install it later.
apt-get remove torcsIf I want to also remove config files :
apt-get purge torcs