Terminal Flashcards

1
Q

How to see how much storage is left in a current directory?

A

df -h .

> > > Filesystem Size Used Avail Use% Mounted on
/dev/nvme0n1p5 458G 362G 73G 84% /

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How to see how much storage has current directory is using

A

du -sh .
»»>821M .

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How to generate ssh keys

A

ssh-keygen

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How to setup passless authentication

A
$ ssh-keygen
# for <username>@<host>
$ ssh-copy-id example@niagara.scinet.utoronto.ca
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the basic command to view all your jobs on Compute Canada?

A

squeue -u $USER

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How do you cancel ALL your jobs at once?

A

scancel -u $USER

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What command shows detailed information about a specific job?

A

scontrol show job <jobid></jobid>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How do you view only your RUNNING jobs?

A

squeue -u $USER -t RUNNING

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How do you cancel only PENDING jobs?

A

scancel -t PENDING -u $USERx

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How do you permanently set an environment variable for a single user?

A

Add ‘export VARIABLE_NAME=value’ to ~/.bashrc file.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the difference between a shell variable and an environment variable?

A

Shell variables are only available in current shell, while environment variables are available to current shell and all child processes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What command shows all current environment variables in Linux?

A

The ‘printenv’ command displays all environment variables.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How do you add a new directory to the PATH variable?

A

Use ‘export PATH=$PATH:/new/directory’ to append a new directory to PATH.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How do you remove/unset an environment variable?

A

Use the ‘unset VARIABLE_NAME’ command.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly