-
Notifications
You must be signed in to change notification settings - Fork 4
/
unix_guide.html
115 lines (94 loc) · 3.13 KB
/
unix_guide.html
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link href="style.css" rel="stylesheet" type="text/css"/>
<title>
Short and Sweet Guide to the UNIX Command Line
</title>
</head>
<body>
<h1>
Short and Sweet Guide to the UNIX Command Line
</h1>
<p>
This is intended as a very minimal guide to getting around the UNIX
command line with minimum pain.
<br>
Here are the commands we feel will be most useful to you in our
classes and projects:
</p>
<ul>
<li>
<code>ls</code>: lists files in the
current directory (folder)
</li>
<li>
<code>ls -a</code>: list all files, including hidden
ones
</li>
<li>
<code>pwd</code>: print working
directory (tells you where you are!)
</li>
<li>
<code>cd [dirname]</code>: change directory to [dirname]
</li>
<li>
<code>cp [file1] [file2]</code>: copies [file1] to [file2]
</li>
<li>
<code>mv [file1] [file2]</code>: move [file1] to [file2] (file1
will be gone!)
</li>
<li>
<code>rm [file]</code>: remove [file]
</li>
<li>
<code>cat [file]</code>: dumps file to stdout
</li>
<li>
<code>echo $var</code>: displays value of $var
</li>
<li>
<code>find . -name [file]</code>: look for [file] in
or under current directory
</li>
<li>
<code>grep <pattern> [files]</code>: search for
<pattern> in [files]
<br />
<strong>Example:</strong> <code>grep [a-z][0-9] *.py</code>
<br />
Finds strings like 'h1' or 'z9' in python files.
</li>
</ul>
<h4>
Some <code>git</code> specific commands:
</h4>
<ul>
<li>
<code>git init</code>: create a new <code>git</code>
repository (repo)
</li>
<li>
<code>git add [files...]</code>: adds a list of files to the
repo you are currently in -- will fail if you are not in a repo
folder!
</li>
<li>
<code>git commit -a -m "Your message here."</code>: commits all
changed files to the current repo.
</li>
<li>
<code>git push origin master</code>: pushes your changes to the
"origin" repo: in our case, that is GitHub
</li>
<li>
<code>git pull origin master</code>: pull changes from the
origin repo (in our case GitHub) to the machine you
are on
</li>
</ul>
</body>
</html>