});

GNU/Linux (Ubuntu) Setup Log

Web & CLI Trade-off

Data preparation and visualization with Jupyter, train or deploy models with IPython/ssh.

ssh etc Win

My combo: xshell + xftp + xming

Hint:
Set: Xshell 键盘选择 Meta按键 为 Right Alt以避免按键冲突,尤其是nano
xshell-会话-属性-ssh-隧道/Tunnel-Xforward开启,设置localhost:21, 端口和xLaunch运行结果一致。
可能后续会改为xmanager,形成完整的套件(已下载安装包)
简单解释下:x11-forward可以转发服务器中选定应用的GUI, 又不像rdp那样实时转发流量。非常极致。

cmd + xming

install xming (listening port 0.0 by default, can use XLaunch to redirect).
Run cmd and use set DISPLAY=localhost:0.0 to set display output, then use ssh -Y <username>@<server IP> to redirect cmd display output to xming.

System Cmd

wget download dropbox file

tips: in DOS, use wget.exe and curl.exe

  1. Add ?dl=1 after the download page link. {StackExchange-Ref}
    It will create a temp file and wget-log in current directory.
  2. Only Buisness URL ending with ?dl=0 works
  3. Trying to know how wget can download into folder instead of single file.
    Download folder as zip then unzip it {Ref-StackOverflow}
  4. currently it works by saving the file to my dropbox to create a file-specified share link for wget.
    (can use -c for continuous partial downloading)
  5. Now it works with only the link part without ?dl=0 behind.

tips:

to read manuscripts, h for help. ‘/$KEY_WORD$’ for search

wget download dropbox file in series

Put dropbox share link in txt file, without ?dl=0

{Trying}

unzip

-q for quiet mode, and -d for extract directory
For zip file over 4GB generated by win10, fix them first with

-FF for fixing, –out for output zip file name

awk

A powerful text editor (almost a programming language)

The structure is 'Condition {Command}'
$NF is number of field, last column number
$NR is the number of row
-F set the field separator and [-.] set both _ and . as separator.
other usages are:

  1. -v OFS=',' set output field separator
  2. !~/^$/ regexp exclude empty lines, another quick way to replace is sed {link}

Note that: use single quotation mark '' for scripts part, for code, [] for list, $ for magic variables.

Can use together with uniq and sort for quick examination of file list.

sed

Never use -i and -n together, will overwrite with empty file.
And do not use substitute s//// with print //p

安装deb文件

进入.deb的对应路径,.deb后缀是由debian发行的linux版本的安装包,.rpm是redhat系列,还有.tar.gz是压缩包,解压后配置添加环境变量运行。

关于dpkg 和 apt

dpkg是底层本地包管理器,apt记录依赖关系进行更加自动化的获取和安装
https://zhuanlan.zhihu.com/p/201060276

是用于重新编译软件的,他会自动寻找Makefile路径中的文件,此外可以通过-f指定其他路径

GNU、gcc、make?

GNU 是 GNU is not Unix的递归缩写,是一个发起为了避免Unix垄断的项目
Linux其实只是kernel, 全称应为 GNU|Linux
gcc是compiler, compile scripts into binary executable files.
make is a batch run tool for gcc.

combo: find| xargs grep

重点描述 xargs的作用,他是作为一个过滤器,简单理解就是把find的stdout转换为stdin传递给下一命令。

Text editor: nano

该服务器没装vim,只有nano
nano官方documentation – shortcut:
https://www.nano-editor.org/dist/latest/cheatsheet.html
常用:
ctrl+w搜索
alt+w下一个,alt+q上一个

Bkgrd running: screen

后台运行进程,nohup 的升级版:screen
基本就是新建一个后台静默线程:
详细解说:https://blog.csdn.net/euzmin/article/details/105090217
主要命令

  1. 创建 screen -S %Session%Name
  2. 展示 screen -ls [match]
  3. 内部 ctrl+a后输入?,访问说明
  4. ctrl+a d 退出当前窗口。
    基本上常用的就只有上述4个  

    补充功能

  5. 翻页查看,ctrl+a esc进入复制模式,ctrl+d Page down, ctrl+u Page up
  6. 进入activate状态的screen, screen -D -r YOUR_SCREEN

IPython

ipython的多行输入:ctrl+o

conda

conda env quick deploy 快速配置环境

conda migrate

If you have installed the conda using default settings but now decide to move it to a new drive with more space. Instead of the prevalent uninstall & reinstall, try my process below. Leave a comment if you find it helpful. ;D
1) move the miniconda3 folder to the destination.
2) Override the export using declare as well as the .bashrc
2.1) Input export in shell, the first 2 lines should show the old path of conda
2.2) Override the old paths with declare -x as shown.
2.3) Replace the old dir in ~/.bashrc
The conda should work as before now. Have fun!

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.