Welcome 微信登录

首页 / 操作系统 / Linux / Ubuntu日常技巧

我其实不算是SA,很多时候Ubuntu很多命令记不住。所以也就找一个地方记录一下。长期更新。未来3个月,可能都要和ubuntu打交道。这个文档,希望可以长期更新。 1:彩色查看log如何可以做到看log,显示的更好需要安装两个包apt-get install -y tmux ccze 这个时候就可以看logtail -f /var/log/syslog | cczetail -f /var/log/squid/access.log | ccze
 2:使用IPMItoolapt-get -y install ipmitool2:加载IMPIhttp://wiki.adamsweet.org/doku.php?id=ipmi_on_linuxmodprobe ipmi_msghandler
modprobe ipmi_devintf
modprobe ipmi_si这个时候就可以查看到ipmi的信息。# ipmitool lan prinet 3:tasksel --list-tasksubuntu 安装的时候,有一个软件包的选择。如果装完以后,还想看到底有哪些软件包的选择呢?# tasksel -h
Unknown option: h
Usage:
tasksel install <task>
tasksel remove <task>
tasksel [options]
        -t, --test          test mode; don"t really do anything
            --new-install   automatically install some tasks
            --list-tasks    list tasks that would be displayed and exit
            --task-packages list available packages in a task
            --task-desc     returns the description of a task

tasksel --list-tasks这个就可以列出所有的组合。到底里面包含那几个包呢?tasksel --task-packages dns-serverThe output of the command should list:
bind9-doc
bind9utils
bind9 如果希望安装tasksel install dns-server 4:搜索软件这是一个google搜索软件的技巧,我经常使用,也就记录在这里。httpd-2.2.8.tar.gz intitle:index 5:加载iso文件mount -t auto -o loop /downloads/CentOS-6.2-x86_64-core.iso /mnt/如果是光驱,那就简单多mount /dev/cdrom /mnt 6:查询包如果希望查询源里包的情况。当你不太清楚包的名字的情况下。 # apt-cache search openstack7:查看服务器主板型号服务器是超微的,不过我不知道具体型号是多少,也就无法升级。通过命令行是可以查看到。# dmidecode |grep -A16 "System Information$"
System Information
        Manufacturer: Supermicro
        Product Name: X8DT3
        Version: 1234567890
        Serial Number: 1234567890
        UUID: 3B703625-21C8-F25D-475C-0025902EF986
        Wake-up Type: Power Switch
        SKU Number: To Be Filled By O.E.M.
        Family: 1234567890

Handle 0x0002, DMI type 2, 15 bytes
Base Board Information
        Manufacturer: Supermicro
        Product Name: X8DT3
        Version: 2.0
        Serial Number: OM16S33000
        Asset Tag: 1234567890 8:VI里替换经常需要批量替换文本。我一般就只用全文替换。(参考http://apps.hi.baidu.com/share/detail/16718996):g/str1/s//str2/g 用字符串 str2 替换正文中所有出现的字符串 str1  9:dpkg用法dpkg平常用的不多,不过还是很实用。有时候需要确认某个文件是哪个软件包装上的。# dpkg --search /etc/nova/nova.conf
nova-common: /etc/nova/nova.conf查看已经安装包的情况 dpkg --status nova-common列出已经安装的包#dpkg --list要想统计一下已经安装包的数量#dpkg --list | wc -l 10 : 全文搜索这个经常要用到,搜索/etc 目录下,找配置文件,两个命令,达到相同的效果。# grep -lr "NOVA_API_KEY" /opt/stack/# find /opt/stack | xargs grep "NOVA_API_KEY" 11:查看端口这个命令我老是记不住ps aux | grep vnc 12: apt-get 安装的包存放在哪里?
默认ubuntu安装完的包是保存在
/var/cache/apt/archives
你可以备份这个目录,下次安装,就不需要联网,直接从这里安装
如果要清除缓存文件夹,可以执行
sudo apt-get clean13: VI很难使用?默认vi,用起来是很不爽。你需要安装vim,就好很多。ubuntu12.04,你只需要装完vim就可以。用vi打开文件,就会显示颜色。14:设置静态IP地址一个例子,设置静态IP,默认经常都是dhcp。# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
        address 172.16.10.51
        netmask 255.255.0.0
        network 172.16.0.0
        broadcast 172.16.255.255
        gateway 172.16.10.1
        # dns-* options are implemented by the resolvconf package, if installed
        dns-search test.com更多Ubuntu相关信息见Ubuntu 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=2Ubuntu update 报key错误Ubuntu的preseed文件相关资讯      Ubuntu安装教程 
  • 平板电脑安装Ubuntu教程  (今 08:25)
  • 给Ubuntu安装HTC样式的My Weather   (12/24/2012 16:02:28)
  • Ubuntu 通过 PPA 安装 Komodo Edit  (12/03/2012 22:21:14)
  • Ubuntu安装软件提示“无法打开锁文  (01/14/2013 09:50:19)
  • Ubuntu下如何用命令行运行deb安装  (12/23/2012 19:51:35)
  • Ubuntu下安装壁纸切换工具Variety  (11/29/2012 10:34:27)
本文评论 查看全部评论 (0)
表情: 姓名: 字数