本文介绍 Ubuntu/Debian 系 Linux 系统的基本管理技巧。
使用 Ubuntu/Debian 最先应该配好的是 Synaptic,即软件升级中心。
所有的源都在文件
/etc/apt/sources.list里定义了。
当然,也有 GUI 界面的包管理中心:
Ubuntu/Debian 通过用 Deb 包的方式,能够方便地进行软件安装与更新。除了可以联网安装 deb 包外,我们还可以把 deb 包下载到本地再进行安装。
1. 菜单 -> 系统 -> 系统管理 -> 新立得软件包管理器 或 Alt+F2(运行窗口)输入
sudo synaptic
2. 点击 [来源] 在左侧的选择框中选择 [本地/main] 再在右侧的选择框中查找需要卸载的deb包
如果知道deb包名,直接点击 [搜索]输入包名
3.选择要删的包,右击,选择[标记以便删除]
4.选择完后,单击[应用]
如果是用命令的话,要移除的软件包名
sudo apt-get autoremove
要安装的软件包名
sudo apt-get install
要安装下载到本地的 .deb 套件包时
sudo dpkg -i package_file.deb
要反安装 .deb 套件包时
sudo dpkg -r package_name
用下面的命令即可查看系统现在的 CPU 和内存条型号:
cat /proc/meminfo cat /proc/cpuinfo
一般的deb包(包括新立得或者 apt-get 下载的)都装在 /usr/bin 目录下。自己下载的压缩包或者编译的包,有些可以选择安装目录,默认一般放在 /usr/local/ 里,也有在 /opt 里的。
如果想知道具体位置,用命令
dpkg -L xxx.deb
注意, xxx 是 deb 包的名称,也可以用新立得来查看。
Environment variables in the bash shell help you in several ways. Certain built-in variables change the shell in ways that make your life a little easier, and you can define other variables to suit your own purposes. Here are some examples of built-in s hell variables:
To list the current values of all environment variables, issue the command
$ env
or list a specific variable with the echo command, prefixing the variable n ame with a dollar sign (the second line shows the result of the echo command):
echo $HOME /home/water
A variable assignment like this will work just fine, but its scope (visibility) is limited to the current shell. If you launch a program or enter another shell, that child task will not know about your environment variables unless you export them first.
Unless you know for sure that an environment variable will have meaning only in the current shell, it's a good idea to always use export when creating variables to ensure they will be global in scope—for example,
export PS1="\u \$ " export code=$HOME/projects/src/spew
And be sure to add these commands to your .profile file so you won't have to retype them eac h time you log in.
如果需要在已有的环境变量后面追加路径值,比如说我要在 GTAGSLIBPATH 变量后面添加一个 /usr/include,现在能怎么呢?
$ export GTAGSLIBPATH=$GTAGSLIBPATH:/usr/include
这样就可以在原来的值后面追加多一个路径。
如果需要开机自动启动某应用程序,例如 skype 等,是 gnome 桌面可以在“系统 ==> 首选项 ==> 启动应用程序“里进行设置。
官方文档:https://wiki.ubuntu.com/Fonts
个人总结:http://blog.waterlin.org/articles/install-new-fonts-under-ubuntu.html
用命令
$ passwd username
即可以修改用户密码。
1. 首先需要在 Ubuntu 下安装 ssh 这个服务,用新立得安装即可;
2. 对SSH服务器进行配置
#vi /etc/ssh/sshd_config
打开服务器端SSH的22端口,让SSH服务器端监听所有的网卡ListenAddress 0.0.0.0.即把这行前的注释删掉。
这些应该都是默认开启的,你只需要检查一下就好了。
3. 开启SSH服务
# /usr/sbin/sshd
如果你不知道 sshd 安装在哪里了,你可以用whereis这个命令去查找一下。
大部分的项目管理工作都是在 Windows 下完成的,可是经常又需要上 Linux 服务器检查一下有关项目代码的情况,甚至于自己亲手试一把。
这个时候,很有必要装一个 VirtualBox 虚拟机,然后在里面装一个 Ubuntu,在里面进行调试即可。
这样操作起来,有点卡,我们可以开启虚拟机里的 ssh 服务,然后在从 Windows 桌面上远程连接过去,即可顺利地完全相关的任务。
要实现这样一个工作环境,对 VirtualBox 里的 Ubuntu 需要进行一些设置。
默认情况下,VirtualBox 里的 Guest 机器的网络连接被设置为NAT(Network Address Translation),我们可以修改为 Bridged 网络连接方式;设成 Bridger 模式,这样 VirtualBox 里的 Ubuntu 就有自己的 IP了,可以开启服务了。
然后按上面讲的开启 Ubuntu ssh 服务的方法,即可从 Windows 远程连接。