linux一些操作,记着给自己用的

1.解压tar.bz2

tar jxvf android-ndk-r5c-linux-x86.tar.bz2

2.linux IP可以访问域名无法访问

vi /etc/resolv.conf

添加,

nameserver 202.106.46.151

3.linux 安装deb文件

sudo dpkg -i ibus-sogoupycc_0.2.5-1_i386.debibus-sogoupycc-data_0.2.5-1_all.deb

4.UBUNTU清理内存(sudo su下执行)

echo 1 > /proc/sys/vm/drop_caches

5.UBUNTU查看内存

free -m

6.给VMWARE虚拟机硬盘瘦身

sudo vmware-toolbox之后在shrink标签中进行


--------------------------------

http://www.linuxcast.net 不错的linux学习网站,最近看视频才想起这个博客,继续记录吧


7,程序暂停,前台,后台执行的问题

正在执行的进程可以使用Ctrl+Z暂停掉

jobs看后台作业,带序号的

可以使用fg <序号>将暂停的jobs前台运行

bg <序号>将暂停的Jobs后台运行


8.ESC+.可以得到上次命令的参数
9.创建硬盘分区

使用fdisk /dev/vdb,对vdb做操作,进入操作界面按m根据提示操作即可,创建主分区,创建扩展分区,在扩展分区基础上创建逻辑分区

10.创建逻辑卷

1.需要创建物理卷(PV),会分成若干物理扩展PE(4M大小),使用命令pvcreate /dev/vdb,使用pvs/pvdisplay查看
2.在该物理卷上创建逻辑卷组(VG) test,vgcreate test /dev/vdb,创建完使用vgs/vgdisplay查看下
3.在该卷组中创建2G大小的逻辑卷(LV) test-1, lvcreate -n test-1 -L 2G test ,使用lvs/lvdisplay查看
4.之后mkfs再mount即可使用,路径是/dev/{vg-name}/{lv-name}
5.umount之后删除逻辑卷,lvremove /dev/{vg-name}/{lv-name}
6.删除卷组, vgremove /dev/{vg-name}
7.清除物理卷,pvremove /dev/vdb


11.screen的使用

  
  
  
  
  • screen创建一个会话
  • screen -ls 列出已存在的会话
  • screen -r {id} 切换到指定id的会话
  • Ctrl+a d 退出当前的会话,但会话还在后台,可以resume
  • 在会话中Ctrl+d则完全结束会话
  • 在会话中Ctrl+a c可创建新窗口
  • 在会话中Ctrl+a S可以横向分屏,Ctrl+a |可竖向分屏
  • 在会话中Ctrl+a tab可以再分屏中切换
  • 在会话中Ctrl+a {数字}可以切换窗口,即Ctrl+a c创建的,Ctrl+a n是下一个窗口,Ctrl+a p是前一个窗口
  • 在会话中Ctrl+a A可以设定窗口名
  • Ctrl+a ?查看帮助
  • screen用vi打开退出后依然保留,http://stackoverflow.com/questions/9979318/how-to-avoid-emacs-or-vi-remaining-on-your-screen-after-closing-when-using-gnu,在~/.screenrc增加altscreen on,再ctrl+a :source ~/.screenrc

12.missing LSB tags

最近在debian上安装screen出现这个问题导致安装不完整,出现类似下面的问题
insserv: warning: script 'K01monitor' missing LSB tags and overrides
insserv: warning: script 'monitor' missing LSB tags and overrides
insserv: Starting monitor depends on stop-bootlogd and therefore on system facility `$all' which can not be true!
insserv: Starting monitor depends on stop-bootlogd and therefore on system facility `$all' which can not be true!
insserv: Starting monitor depends on stop-bootlogd and therefore on system facility `$all' which can not be true!
insserv: Starting monitor depends on stop-bootlogd and therefore on system facility `$all' which can not be true!
insserv: Starting monitor depends on stop-bootlogd and therefore on system facility `$all' which can not be true!
insserv: Starting monitor depends on stop-bootlogd and therefore on system facility `$all' which can not be true!
insserv: Starting monitor depends on stop-bootlogd and therefore on system facility `$all' which can not be true!
insserv: Starting monitor depends on stop-bootlogd and therefore on system facility `$all' which can not be true!
insserv: Starting monitor depends on stop-bootlogd and therefore on system facility `$all' which can not be true!
insserv: Starting monitor depends on stop-bootlogd and therefore on system facility `$all' which can not be true!

解决见 http://forum.directadmin.com/showthread.php?t=42174
与其他的服务脚本对比,需要对应服务/etc/init.d/monitor加上(因为这里是monitor服务,其他服务也对应文件加就行)
### BEGIN INIT INFO
# Provides:             monitor
# Required-Start:       $syslog
# Required-Stop:        $syslog
# Should-Start:         #named
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start and stop directadmin
# Description: DirectAdmin
### END INIT INFO

你可能感兴趣的:(linux,Deb)