-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLinuxBasicCommands
More file actions
63 lines (54 loc) · 2.47 KB
/
Copy pathLinuxBasicCommands
File metadata and controls
63 lines (54 loc) · 2.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
### Here are some basic shell scripts/commands for everyday jobs.
## log into ssh
# 'ssh username@ssh.ccv.brown.edu' - to log into ssh then type in your password
## interactive jobs - for running serial programs/debugging codes
# 'interact [-t walltime] [-m memory]'
# by default, 1 core, 4GB, 30 minutes
# i.e. 'interact -n 20 -t 01:00:00 -m 10g'
## Navigating OSCAR
# 'pwd' - to print out the current directory and its absolute path
# 'll' or 'ls -1' - lists all the files that are located in the working directories
# with additional data arranged by time they were opened.
# 'cd yourDestination' - takes you to the destination directory
## Handling Files
# 'mkdir directoryName' - makes a new directory (directory shows up in BLUE)
# 'vi fileName' - opens the file in the text editor Vi or 'vim fileName'
# 'mv /source/directory/fileName /target/destination/' - to move the file from source to target
# alternatively 'mv /source/directory/fileName .' - to move the file to the current directory
# 'less fileName' - to inspect the file - press 'q' to exit
## File Transference (Remote - Local)
# from Oscar to local
# 'scp /path/to/source/file <username>@transfer.ccv.brown.edu:/path/to/destination/'
# from local to Oscar
# 'scp <username>@transfer.ccv.brown.edu:/path/to/source/file /path/to/destination/'
# transfer multiple files
# 'scp source/file1 file2 file3 <username>@transfer.ccv.brown.edu:/destination'
# transfer a directory (recursive)
# scp -r /source/directory/ <username>@transfer.ccv.brown.edu:/destination'
# Alternative for copying multiple files
# Try look up 'rsync' (never tried)
## Copy files
# copy a file
# 'cp /path/to/source/file /path/to/destination'
# copy multiple files - for more applications, look up 'brace expansion'
# 'cp /path/to/source/{file1,file2} /path/to/destination'
# copy a directory
# 'cp -R /source/directory /path/to/destination'
#
## Execute Scripts
# 'chmod +x myScript' - make the file executable
# 'python fileName.py' - to run a python script
# 'sbatch fileName.sh' - to submit job as the shell script
# squeue -u Username'
## Basic Commands in Vi/Vim
# 'i' - insert before curor
# press Esc. to leave insert mode
# ':w name" - write edit buffer to file name
# ':wq' - write to file and quit
# ':q!' - quit without saving changes
# ':sh' - execute shell commands
# '/string' - search forward
# 'G' - go to last line
# 'nG' or ':n' - go to line n
## Random Tips
# to close the split plane from accidental 'cmd D' is 'shift cmd D'