My blog - Shortcut command

  1. VS code
  2. OUTLOOK
  3. Python3
  4. Anaconda
  5. Linux
    1. find
    2. grep
    3. To see
    4. write to file
    5. chmod command
    6. delete or add something on file
    7. Unzip command
    8. cp command
    9. mv command
    10. For internet
    11. Storage
    12. Slurm
      1. 运行时间
  6. Git
    1. alias
  7. Para

It's never the umbrella that can get out of the rainy season, but the one who is not afraid of the wind and rain.

能走出雨季的从来不是雨伞,而是不惧风雨的自己。

Updated time: 06/30 2025.

VS code

Shift whole left: shift + Tab
		   Right: Tab

Batch annotation: Ctrl + K + C
          Cancel: Ctrl + K + U

COMMAND: Ctrl + Shift + P

Global Search: Ctrl+T
jump to function definition: F12
vs code 左侧工具栏自带全局 search
Ctrl+Shift+O 当前文件大纲
左侧工具栏自带的OUTLINE也可以查看当前文件大纲更方便

# VS Code 全局搜索快捷键大全

## 1. 核心全局搜索快捷键

| 快捷键 (Windows/Linux) | 快捷键 (Mac) | 功能描述 | 适用场景 |
|-----------------------|-------------|---------|---------|
| `Ctrl+T` | `Cmd+T` | 搜索**工作区所有符号**(函数名、类名、变量等) | 快速跳转到定义 |
| `Ctrl+P` | `Cmd+P` | 搜索**文件名** | 快速打开文件 |
| `Ctrl+Shift+F` | `Cmd+Shift+F` | 全局**文本搜索**(文件内容) | 搜索代码片段 |
| `Ctrl+Shift+P` | `Cmd+Shift+P` | 搜索**命令面板**(所有可执行命令) | 执行VS Code操作 |

## 2. 符号(Symbol)精准搜索技巧

在 `Ctrl+T`/`Cmd+T` 符号搜索中:
- **`#` + 符号名**:搜索当前文件的符号(等价于 `Ctrl+Shift+O`)
- **`@` + 符号名**:在已打开的文件中搜索符号(TypeScript/JavaScript专用)
- **`:` + 行号**:跳转到指定行(如 `:120`)

![符号搜索演示](https://code.visualstudio.com/assets/docs/editor/editingevolved/opensymbolquickaccess.gif)

## 3. 进阶搜索组合技

| 快捷键 (Windows/Linux) | 快捷键 (Mac) | 功能描述 |
|-----------------------|-------------|---------|
| `Ctrl+Shift+O` | `Cmd+Shift+O` | 当前文件的**大纲视图** |
| `F12` 或 `Ctrl+Click` | `F12` 或 `Cmd+Click` | 跳转到定义 |
| `Ctrl+Shift+.` | `Cmd+Shift+.` | 跳转到下一个符号 |
| `Ctrl+Shift+,` | `Cmd+Shift+,` | 跳转到上一个符号 |

## 4. 搜索范围控制技巧

在全局文本搜索 (`Ctrl+Shift+F`/`Cmd+Shift+F`) 中:
- **`↑`/`↓`**:在搜索结果间导航
- **`*`**:通配符匹配(如 `*.py` 只搜Python文件)
- **`🔍`图标**:展开高级选项(支持正则表达式、排除文件夹等)

![高级搜索面板](https://code.visualstudio.com/assets/docs/editor/codebasics/search.png)

## 5. 实用场景示例

1. **快速找到函数定义**
   - 按下 `Ctrl+T`/`Cmd+T` → 输入 `move_atoms` → 直接跳转定义文件

2. **全局替换变量名**
   - `Ctrl+Shift+F`/`Cmd+Shift+F` → 输入旧变量名 → 点击替换 → 输入新变量名

3. **批量修改API调用**
   - 开启正则模式 → 搜索 `old_function\((.*?)\)` → 替换为 `new_function($1)`

## 6. 推荐扩展增强

| 扩展名称 | 功能 |
|---------|------|
| **GitLens** | 在搜索结果中显示Git历史 |
| **Todo Tree** | 全局搜索TODO/FIXME注释 |
| **REST Client** | 全局搜索API端点 |

OUTLOOK

Emoij: Windows + Dot

Python3

python3 -m venv /path/name
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

1、添加源
比如添加清华源https://pypi.tuna.tsinghua.edu.cn/simple:

pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
如果set多次,似乎只能保存最后一次set的镜像源。

2、删除源
pip config unset global.index-url

3、查看现在用的哪个源
pip config list

Anaconda

conda activate ...
conda env list
conda list -e > requirement.txt
conda create -n ... python=3.11
conda env remove -n ...

1、添加源
比如清华源:
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes
2、删除源
conda config --remove-key channels
3、查看现在用的是哪些源
conda config --show channels
也可以使用
conda config --show-sources

Linux

find

% find
% delete all files despite of 'relax.bash'
find . -type f ! -name 'relax.bash' -exec rm -f {} +
find . -type f ! \( -name 'POSCAR' -o -name 'INCAR' \) -print
find . -type f ! \( -name 'POSCAR' -o -name 'INCAR' -o -name 'POTCAR' \) -exec rm -f {} +

grep

% grep
% what line up and after around the line contained 'format'
grep -A 6 -B 6 'format' file
% grep energy
grep  without OUTCAR | tail -n 1
grep '  without' OUTCAR | tail -n 1  # 本人常用的是这个
grep sigma OUTCAR | tail -n 1 

To see

% to see
diff file1 file2
more sub.vasp
cat sub.vasp
% to see the line number
cat -n filename.txt
% tail
tail -f slurm.txt

write to file

%create a file
cat > file.txt
Ctrl + D
% write content
echo ' ' >  file.txt
         >>              % append

chmod command

% for run script
chmod u+x sub.vasp

delete or add something on file

% delete specified line of the file
sed -i '10, 20d' filename.txt

% cat command
a = '$(cat POSCAR)'
echo '$a'

% add file to another file
sed -i 'N r tmp_file' filename.txt
% N - line

% delete file
rm -f /../../*.log

% delete directory
rm -rf /root/log/game

Unzip command

unzip .../*.zip
tar -zxvf .../*.tar.gz

cp command

% transfer the entirely directory
cp  -r /home/downloads/phpcms_v9_UTF8/install_package/ /opt/lampp/htdocs/

mv command

% move directory
mv ../../  ../

For internet

# all up
ip addr
# restart network
sudo systemctl restart networking
# if down, set up
sudo ip link set ens33 up
sudo dhclient ens33

Storage

lfs quota -uh $USER ~

Slurm

运行时间

目的 命令
查看历史任务时间 sacct -j <job_id>
正在运行任务时间 squeue -j <job_id>
总结资源使用率 seff <job_id>
日志文件末尾查看 tail slurm-<jobid>.out
自己记录时间 start=$(date +%s)

Git

# 配置Git用户信息
git config --global user.name "Your Name"  # 设置全局用户名
git config --global user.email "youremail@example.com"  # 设置全局邮箱地址
# SSH to cennected between git and github

# 初始化一个新的Git仓库
git init  # 在当前目录初始化新的Git仓库

# 克隆一个现有的仓库 # http / SSH (recommended)
git clone https://github.com/username/repository.git  # 克隆远程仓库到本地
git clone git@github.com:ShengLin1001/hetbuilder.git

# 查看状态
git status  # 查看当前工作目录和暂存区的状态

# 添加和提交更改
git add .  # 将所有修改和新文件添加到暂存区
git commit -m "Commit message"  # 提交暂存区到仓库区

# 推送更改到远程仓库
git push origin main  # 将本地的更改推送到远程仓库的main分支

# 更新你的本地仓库
git pull origin main  # 从远程仓库的main分支拉取最新更改并合并到本地

# 分支操作
git branch branchname  # 创建一个新分支
git checkout branchname  # 切换到指定分支
git merge branchname  # 将指定分支合并到当前分支

# 查看提交历史
git log  # 查看提交历史记录

alias

# see alias
git config --get-regexp alias

# 设置 'co' 为 'checkout' 的别名 git co branch-name
git config --global alias.co checkout

# 设置 'br' 为 'branch' 的别名
git config --global alias.br branch

# 设置 'ci' 为 'commit' 的别名
git config --global alias.ci commit

# 设置 'st' 为 'status' 的别名
git config --global alias.st status

# 设置 'lg' 为更美观的日志输出格式
git config --global alias.lg "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"

# 设置 'unstage' 作为撤销暂存的别名
git config --global alias.unstage 'reset HEAD --'

# 设置 'last' 为查看最后一次提交的别名
git config --global alias.last 'log -1 HEAD'

# git ac ""
git config --global alias.ac '!git add -A && git commit -m'

# push and pull on main
git config --global alias.push 'push origin main'
git config --global alias.pull 'pull origin main'

Para

papp_cloud 是一个登录超算的命令行工具,具备ssh,scp,rsync, sftp, sshfs 等基础功能。

o 支持的操作系统

  - Linux x86_64/i686
  - Darwin x86_64

Flags:
  -h, --help     Show context-sensitive help (also try --help-long and --help-man).
  -V, --version  Show application version.
  -D, --debug    Enable debug mode.
  -s, --select   select a vpn link route.

Commands:
  help [<command>...]
    Show help.

  ssh [<flags>] <destination> [<command>...]
    Ssh is a sub command for logging into a remote machine and for executing commands on a remote machine.

    example:

      1. 使用paratera帐号登录广州超算(IPv4)

      $ papp_cloud ssh paratera@gz                                                   

      2. 使用paratera帐号登录广州超算(IPv6)

      $ papp_cloud ssh -6 paratera@gz                                                   


  sshfs [<flags>] <source ... target>...
    SSHFS - filesystem client based on SSH.

    example:


       1.挂载广州超算目录/home/paratera到本地挂载点/localdir

       $ papp_cloud sshfs paratera@gz:/home/paratera /localdir

  scp [<flags>] <source ... target>...
    Scp copies files between hosts on a network.

    example:

      o Upload

      1. 使用paratera帐号上传file1,file2文件到广州超算的paratera用户家目录(IPv4)

      $ papp_cloud scp file1 file2 paratera@gz:/home/paratera           

      2. 使用paratera帐号上传file1,file2文件到广州超算的paratera用户家目录(IPv6)

      $ papp_cloud scp -6 file1 file2 paratera@gz:/home/paratera           

      o Download

      1. 使用paratera帐号下载广州超算paratera用户家目录下的file1 文件到本地的/data
      目录(IPv4)

      $ papp_cloud scp paratera@gz:/home/paratera/file1 /data           

      2. 使用paratera帐号下载广州超算paratera用户家目录下的file1 文件到本地的/data
      目录(IPv6)

      $ papp_cloud scp -6 paratera@gz:/home/paratera/file1 /data           


  sftp [<flags>] <destination>...
    Sftp is a file transfer program, similar to ftp.

    example:

      1. 使用paratera帐号登录广州超算(IPv4)

      $ papp_cloud sftp paratera@gz                           

      2. 使用paratera帐号登录广州超算(IPv6)

      $ papp_cloud sftp -6 paratera@gz                           


  rsync [<flags>] <source ... target>...

    Rsync copies files either to or from a remote host, or locally on the current host (it does not support copying files between two remote hosts

    example:

      o Upload

      1. 使用paratera帐号同步file1,file2文件到广州超算的paratera用户家目录(IPv4)

      $ papp_cloud rsync file1 file2 paratera@gz:/home/paratera         

      2. 使用paratera帐号同步file1,file2文件到广州超算的paratera用户家目录(IPv6)

      $ papp_cloud rsync -6 file1 file2 paratera@gz:/home/paratera         

      o Download

      1. 使用paratera帐号下载广州超算paratera用户家目录下的file1 文件到本地的/data
      目录(IPv4)

      $ papp_cloud rsync paratera@gz:/home/paratera/file1 /data         

      2. 使用paratera帐号下载广州超算paratera用户家目录下的file1 文件到本地的/data
      目录(IPv6)

      $ papp_cloud rsync -6 paratera@gz:/home/paratera/file1 /data         

  login --user=USER --[no-]password
    Login paratera cloud service.

    example:

      $ papp_cloud login -u user@paratera.com -p

  logout
    Logout paratera cloud service.

    example:

      $ papp_cloud logout

  lsc
    list super computer centers.

  accounts
    list super computer center accounts

papp_cloud ssh scg6928@zc-m6

Please indicate the source when reprinting. Please verify the citation sources in the article and point out any errors or unclear expressions.