Terminal Flashcards
How to see how much storage is left in a current directory?
df -h .
> > > Filesystem Size Used Avail Use% Mounted on
/dev/nvme0n1p5 458G 362G 73G 84% /
How to see how much storage has current directory is using
du -sh .
»»>821M .
How to generate ssh keys
ssh-keygen
How to setup passless authentication
$ ssh-keygen # for <username>@<host> $ ssh-copy-id example@niagara.scinet.utoronto.ca
What is the basic command to view all your jobs on Compute Canada?
squeue -u $USER
How do you cancel ALL your jobs at once?
scancel -u $USER
What command shows detailed information about a specific job?
scontrol show job <jobid></jobid>
How do you view only your RUNNING jobs?
squeue -u $USER -t RUNNING
How do you cancel only PENDING jobs?
scancel -t PENDING -u $USERx
How do you permanently set an environment variable for a single user?
Add ‘export VARIABLE_NAME=value’ to ~/.bashrc file.
What is the difference between a shell variable and an environment variable?
Shell variables are only available in current shell, while environment variables are available to current shell and all child processes.
What command shows all current environment variables in Linux?
The ‘printenv’ command displays all environment variables.
How do you add a new directory to the PATH variable?
Use ‘export PATH=$PATH:/new/directory’ to append a new directory to PATH.
How do you remove/unset an environment variable?
Use the ‘unset VARIABLE_NAME’ command.