Command line cheatsheets
Cheatsheets for CLI commands I use.
NOTE: The brackets are not literal, but the curly brackets are.
ssh [user]@[host] ls -lNHha --color DIR
: Remote lsssh [user]@[host] "cat [file]" | diff - [local_file]
: Remote diffssh -Y -l [user] [host] -p [PORT]
: Port Forwarding (X11)scp -pr [user]@[host]:[REMOTE_PATH] [LOCAL_PATH]
: Download file(s) from serverscp -pr [LOCAL_PATH] [user]@[host]:[REMOTE_PATH]
: Upload file(s) to serverShift
+Middle Click
or Shift
+Insert
: Paste from clipboard to serverNOTE: [user]@[host]
can be simplified by using aliased in $HOME/.ssh/config
file
qsub [script]
: Submit a job that will execute the specified scriptqsub [script] [arguments]
: Submit a job that will execute the specified script with the specified argumentsqsub [script] [arguments]
: Submit a job that will execute the specified script with the specified argumentsqsub -N [job_name] [script]
: Submit a job that will execute the specified script with the specified job nameqsub -hold_jid [dependency_job] [script]
: Submit a job that will execute the specified script but depends on the execution of another jobqdel [job_id]
: Delete the job with the specified job_idqdel {[job_id_i]..[job_id_j]}
: Delete jobs in the specified range (including both ends)qstat -f
: Display “full” information on all queues for all usersqstat -j [job_list]
: Display information for the specified jobs (comma separated)qstat -u [user_name]
: Display information on all queues for the specified userqstat -q [queue_name]
: Display information on the specified queueqstat -f -u [user_name] -q [queue_name]
srun -u --pty --gres=gpu:1 bash -i
: Allocate 1 GPU (--gres=gpu:1
) and run bash interactively (bash -i
)srun -u --pty --gres=gpu:1 -t 2-0 bash -i
: Allocate 1 GPU and run bash interactively for 2 days (-t 2-0
)srun -u --pty --gres=gpu:1 -t 2
00 bash -i
: Allocate 1 GPU and run bash interactively for 2 and a half hours (-t 2
00
)srun -u --pty --gres=gpu:1 -C [constraint] bash -i
: Allocate 1 GPU and run bash interactively when the constraint (e.g. TitanX) is metsrun -u --pty --gres=gpu:1 [script]
: Allocate 1 GPU (--gres=gpu:1
) and run the specified scriptsbatch [script]
: Submit a script job (using SBATCH commands in the script to specify options)squeue
: View information about jobs from all userssqueue -u [user]
: View information about jobs submitted from the specified userscontrol show job
: View configuration for all jobsscontrol show job [job_id]
: View configuration for the specified jobPrefix
+Ctrl-s
: Save tmux session that persists through reboots (requires tmux-resurrect)Prefix
+Ctrl-r
: Restore tmux session, even after reboot (requires tmux-resurrect)Prefix
+?
: HelpPrefix
+/
: Searchwatch -t [command]
: Execute command periodically every 2 seconds and display output without the command title (-t
option)watch -t -n [seconds.deciseconds] [command]
: Execute command periodically using the specified interval and display outputwatch -t -d [command]
: Execute command periodically and display output, highlighting the differences