[关闭]
@hshustc 2017-04-21T08:21:15.000000Z 字数 1917 阅读 2229

Linux常用命令(不定时更新)

Linux

为知笔记里面记录的东西越来与多,有时候为了查阅某条linux而进行全局查找反而不太方便,因此才有了这篇博客的诞生,主要记录linux下常用又不容易记住的命令(针对作者而言),方便查阅。

convert ipynb to script

  1. jupyter nbconvert --to script [YOUR_NOTEBOOK].ipynb

git submodule

  1. git clone --recursive https://github.com/yjxiong/anet2016-cuhk
  2. #If you happen to forget adding --recursive to the command. You can still go to the project directory and issue
  3. git submodule update --init

rar解压

  1. rar x file.tar(带路径解压)

Shell以及Maltab中创建log时使用系统时间

Shell

  1. touch test_$(date +%F-%T).txt
  2. touch test_$(date +%F-%H-%M).txt

Matlab

  1. timestamp = datestr(datevec(now()), 'dd.mmm.yyyy:HH.MM.SS');
  2. diary_file = fullfile('log', [opts.dataset, '_cnn_train_seed-', num2str(opts.seed), '_', timestamp, '_log.txt']);
  3. diary(diary_file);
  4. fprintf('Logging output in %s\n', diary_file);
  5. diary on;
  6. imdb_cnn_triain(imdb, opts); %code
  7. diary off

winedt更改快捷键

  1. Options->Option interface
  2. Menus and Toolbar:Main Menu
  3. //3400行 Latex编译快捷键(shift+ctrl+L)
  4. 3520 PDFTeXify编译快捷键(shift+ctrl+P
  5. 3960 Help快捷键(F1
  6. 两者互换,然后右键main menu.ini点击load script使之立即生效
  1. Options->Execution Modes->Tex Options 可以自定义PDFTeXify Method

grep搜索排除目录

  1. grep -E "http" ./ -R --exclude-dir=.git
  2. grep -E "http" ./ -R --exclude-dir={.git, res, bin}

tmux分屏

  1. ctrl+b % 左右分屏
  2. ctrl+b 上下分屏

Windows下删除大文件

  1. rd /s /q 目录名 #这个有点乱入了。。。不过删除硬盘中大文件确实好用

查看linux发行版本

  1. lsb_release -a

查看GPU占用情况

  1. nvidia-smi [-q]
  2. watch -n 10 nvidia-smi #每10s先是一次显存的情况

sed替换文本

sed 's/source/OKSTR/' tmp.txt 将tmp.txt中的source替换成OKSTR

VIM多行缩进

shift+V选中多行后shift+>多行缩进,写python代码时十分有用

tar压缩命令

  1. tar -cf all.tar *.jpg
  2. #将所有的jpg文件打包成all.tar, -c压缩,-f指定包的文件名
  3. tar -xf all.tar -C /tmp
  4. #将all.tar解压到/tmp目录

SVN

https://114.214.166.119/svn/hsh/

latex字体

  1. \tiny
  2. \scriptsize
  3. \footnotesize
  4. \small
  5. \normalsize
  6. \large
  7. \Large
  8. \LARGE
  9. \huge
  10. \Huge
  11. 使用方法:可以通过如下方式设置文章正文的字体大小,\begin{document} \small
  12. 采用默认的时候,正文肢体的大小是\normalsize

文件大小

df -h:所有文件系统的可用空间以及使用情形
du -h --max-depth=1 ./:当前目录下所有文件夹大小,--max-depth指定深入目录层次
du -h --max-depth=1 ./*:同上,但包含文件

智能缩进

适用于当复制代码时经常会造成缩进混乱的情形
Vim:gg=G
Matlab:ctrl+i
VS2013:ctrl+k+f

挂载硬盘

vimgpu上新加的1T硬盘每次重启后手动挂载
fdisk -l #查看硬盘信息(/dev/sda)
sudo mount $硬盘目录 $挂在目录

统计文件中某单词的数目

grep -o "unix" aaa.txt | wc -l (-o means "only matching")

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注