0%

VMware & Ubuntu

设置Vmware自动调整窗口大小

  1. 安装Vmware Tools,重启无效,则:

  2. 手工安装Vmware tools:终端窗口命令如下:
    sudo apt-get autoremove open-vm-tools
    sudo apt-get install open-vm-tools
    sudo apt-get install open-vm-tools-desktop

  3. 如果上面的命令执行并重启之后仍然没有效果:关机–>设置–>硬件–>显示器:

    指定监视器设置:数量设为1,分辨率为主机(我是win)的分辨率,关闭拉伸模式。开机,在“查看”中可以进行屏幕自适应设置。

Write a “Hello World” program, compile it, then run it under GNU/Linux.

输入 gcc hell.c
输入 ./a.out

Write a Makefile to compile the “Hello World” program

1
2
3
4
5
6
7
8
9
10
11
12
13
14
CC      = gcc
CFLAGS = -g
RM = rm -f


default: all

all: Hello

Hello: Hello.c
$(CC) $(CFLAGS) -o Hello Hello.c

clean veryclean:
$(RM) Hello

GDB的基本使用

next和 step类似于vs中的f10和f11

基本命令:

1
2
3
4
5
6
gdb <executable name>   开始调试
break <source code line number> 打断点
run 运行
continue
watch <var> 当变量值改变时会被通知
quit 退出

git log –name=1711436 过滤查看手动修改过的记录

how to use tmux

tmux一种需要学习成本的Linux终端的分屏方式。

All commands in Tmux start with a prefix, which by default is ctrl+b.

离开tmux返回shell:Ctrl+b d

get a list of the currently running sessions type:tmux ls

attach to session 0: tmux attach-session -t 0

  • Ctrl+b c Create a new window (with shell)
  • Ctrl+b w Choose window from a list
  • Ctrl+b 0 Switch to window 0 (by number )
  • Ctrl+b , Rename the current window
  • Ctrl+b % Split current pane horizontally into two panes
  • Ctrl+b " Split current pane vertically into two panes
  • Ctrl+b o Go to the next pane
  • Ctrl+b ; Toggle between the current and previous pane
  • Ctrl+b x Close the current pane

git

When you want to commit the change, type

1
2
git add .
git commit --allow-empty

The --allow-empty option is necessary, because usually the change is already committed by development tracing system. Without this option, git will reject no-change commits.

ctags

vim提供了强有力的函数跳转的插件功能

首先要安装ctags, 在ubuntu下直接输入

1
sudo apt-get install exuberant-ctags

接着,在源文件目录树执行如下命令:

1
ctags -R

即可在目录下生成一个tags文件, 这个文件就是所有函数和变量的索引列表。(通过ls可以看见)

若E257:cstag:找不到tag,解决:在.vimrc中增加:

1
2
set tags=tags;
set autochdir

make的时候可以make -j4,4线程编译可以加快速度