linux的一些常用命令和emacs的一些快捷键

本人是linux新手,把一些常用的命令记在这里。

查看ubuntu版本 sudo lsb_release -a

安装软件 sudo apt-get install ***   eg:sudo apt-get install apt-file

删除软件 sudo apt-get remove ***

查找文件 

dpkg -s glfw.h  只能找已经存在的package

apt-file search glfw.h 

locate glfw.h

改名字

mv oldfilename newfilename

查看权限

ls -l filename

ls -l|more filename (查看你当前的权限)

修改权限

chmod 755 twitter

chmod 644 twitter/*.*  

显示文件

cat filename

压缩当前文件夹的所有文件

zip  -r  ./project.zip ./*

unzip  project.zip

unzip -d -o project.zip ./project (-d表示解压路径,-o不提示的情况下覆盖文件)


其他压缩和解压

unzip: gunzip project.gz 

   gzip -d project.gz

   tar -zxvf project.tar.gz 

   tar -xvf  project.tar

zip: gzip project.tar.gz

       gzip project.tgz

tar -zcvf project.tar.gz

        tar -cvf project.tar

查看文件多少行

wc -l edit.txt

查看文件具体的某一行

sed -n '190,196p' a.txt 查看的是190到196

sed -n '190,1p' a.txt  查看190那一行

批量删除文件夹里同一后缀名的文件

find -name "*.s" -exec rm -f {} \; 


快捷键

打开新的终端 ctrl+alt+t

切换界面 alt+tab 

杀死进程 ctrl+c




emacs 


ctrl+@ set mark

alt+w copy

ctrl+y paste

ctrl+/ cancel

ctrl+x s save

ctrl+x c quit

C-x 0 : 关闭当前窗口

C-x 1 : 将当前窗口最大化

C-x 2 : 垂直分割窗口

C-x 3 : 水平分割窗口

C-x o: 不同窗口间移动光标

从缓存中恢复原文件 M-x recover file<Return> (M:ESC)

查找 M-x grep-find ***



• To exit emacs editor:

CTRL-x CTRL-c

Manipulating files with emacs

CTRL-x CTRL-f read a file into an emacs buffer

CTRL-x CTRL-s save file to disk

CTRL-x i inserts another file into this file

CTRL-x CTRL-w writes buffer to a file you name (use this like "save as")

Moving around in emacs

CTRL-f move forward one character

CTRL-b move backward one character

CTRL-n move forward one line

CTRL-p move backward one line

M-f move forward one word

M-b move backward one word

CTRL-a move to the beginning of line

CTRL-e move to the end of the line

CTRL-v scroll to next screen

M-v scroll to previous screen

CTRL-x b move to another buffer

Changing and moving text

Backspace, or CTRL-d : delete the character behind or at the cursor

M-d : delete the next word

CTRL-k : delete to the end of the line

CTRL-@ or CTRL-SPC : mark the beginning of a region

CTRL-w : cut (wipe) from here to beginning of the region

CTRL-y : insert here what you last deleted/cut/copied

M-w : copy from here to beginning of the region (same effect as CTRL-w CTRL-y)

Abort and undo

CTRL-g aborts a partially typed or executing command

CTRL- _(underscore) undoes the last change (repeatedly using undo will undo the last several changes)

Using two windows

• Create two windows:

CTRL-x 2 (this will split your screen into two windows)

CTRL-x o (move in the bottom window; use the same command to get back into the

upper window; here o is the letter not zero)

CTRL-x 1 (to kill one window)

Other Editors 0r Help with unix



  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值