Skip to content

Commit 30eb7a6

Browse files
completing FDO1
1 parent 9dcc557 commit 30eb7a6

File tree

10 files changed

+1085
-0
lines changed

10 files changed

+1085
-0
lines changed

FDO1/cat/index.html

+140
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>cat Command Explanation</title>
7+
<link rel="stylesheet" href="style.css">
8+
</head>
9+
<body>
10+
<div class="container">
11+
<h1>Understanding the <code>cat</code> Command</h1>
12+
13+
<section>
14+
<h2>Basic Usage of <code>cat</code></h2>
15+
<p>The <code>cat</code> command (short for "concatenate") is used to read, combine, and display the contents of files. It can be used to display the contents of one or more files on the standard output (usually the terminal).</p>
16+
<div class="code-block">
17+
<code>cat [file_name]</code>
18+
</div>
19+
<p>This will display the contents of <code>file_name</code> to the terminal.</p>
20+
</section>
21+
22+
<section>
23+
<h2>Options Available with <code>cat</code></h2>
24+
25+
<h3><code>cat -n</code> (Number All Lines)</h3>
26+
<p>Displays all lines of the file(s) with line numbers:</p>
27+
<div class="code-block">
28+
<code>cat -n file.txt</code>
29+
</div>
30+
<p>This will display each line of <code>file.txt</code> prefixed with its line number.</p>
31+
32+
<h3><code>cat -b</code> (Number Non-Empty Lines)</h3>
33+
<p>Similar to the <code>-n</code> option, but it only numbers non-empty lines:</p>
34+
<div class="code-block">
35+
<code>cat -b file.txt</code>
36+
</div>
37+
<p>This will display <code>file.txt</code> with non-empty lines numbered, while empty lines remain unnumbered.</p>
38+
39+
<h3><code>cat -s</code> (Suppress Repeated Empty Lines)</h3>
40+
<p>Suppresses repeated empty lines in the output:</p>
41+
<div class="code-block">
42+
<code>cat -s file.txt</code>
43+
</div>
44+
<p>This will remove any consecutive empty lines in <code>file.txt</code>.</p>
45+
46+
<h3><code>cat -v</code> (Show Non-Printable Characters)</h3>
47+
<p>Displays non-printing characters (except for tabs and line endings) as visible characters:</p>
48+
<div class="code-block">
49+
<code>cat -v file.txt</code>
50+
</div>
51+
<p>Non-printing characters in <code>file.txt</code> will be shown in a human-readable form.</p>
52+
53+
<h3><code>cat -T</code> (Show Tabs as ^I)</h3>
54+
<p>Displays tab characters as <code>^I</code>:</p>
55+
<div class="code-block">
56+
<code>cat -T file.txt</code>
57+
</div>
58+
<p>All tab characters in <code>file.txt</code> will be displayed as <code>^I</code>.</p>
59+
60+
<h3><code>cat -E</code> (Show End of Line)</h3>
61+
<p>Displays a dollar sign (<code>$</code>) at the end of each line:</p>
62+
<div class="code-block">
63+
<code>cat -E file.txt</code>
64+
</div>
65+
<p>This adds a <code>$</code> symbol to indicate where each line in <code>file.txt</code> ends.</p>
66+
67+
<h3><code>cat file1 file2 &gt; output_file</code> (Concatenate Files)</h3>
68+
<p>Concatenates multiple files and outputs the result to another file:</p>
69+
<div class="code-block">
70+
<code>cat file1.txt file2.txt &gt; combined.txt</code>
71+
</div>
72+
<p>This command will merge the contents of <code>file1.txt</code> and <code>file2.txt</code> into <code>combined.txt</code>.</p>
73+
74+
<h3><code>cat --help</code></h3>
75+
<p>Displays help information for the <code>cat</code> command:</p>
76+
<div class="code-block">
77+
<code>cat --help</code>
78+
</div>
79+
</section>
80+
81+
<section>
82+
<h2>Summary of Options</h2>
83+
<table>
84+
<thead>
85+
<tr>
86+
<th>Option</th>
87+
<th>Description</th>
88+
</tr>
89+
</thead>
90+
<tbody>
91+
<tr>
92+
<td><code>cat [file]</code></td>
93+
<td>Display the contents of a file.</td>
94+
</tr>
95+
<tr>
96+
<td><code>cat -n [file]</code></td>
97+
<td>Number all lines in the output.</td>
98+
</tr>
99+
<tr>
100+
<td><code>cat -b [file]</code></td>
101+
<td>Number only non-empty lines.</td>
102+
</tr>
103+
<tr>
104+
<td><code>cat -s [file]</code></td>
105+
<td>Suppress repeated empty lines.</td>
106+
</tr>
107+
<tr>
108+
<td><code>cat -v [file]</code></td>
109+
<td>Show non-printing characters (except tabs and line endings).</td>
110+
</tr>
111+
<tr>
112+
<td><code>cat -T [file]</code></td>
113+
<td>Show tab characters as <code>^I</code>.</td>
114+
</tr>
115+
<tr>
116+
<td><code>cat -E [file]</code></td>
117+
<td>Show a dollar sign <code>$</code> at the end of each line.</td>
118+
</tr>
119+
<tr>
120+
<td><code>cat file1 file2 &gt; output_file</code></td>
121+
<td>Concatenate multiple files and redirect the output to another file.</td>
122+
</tr>
123+
<tr>
124+
<td><code>cat --help</code></td>
125+
<td>Display help information for the <code>cat</code> command.</td>
126+
</tr>
127+
</tbody>
128+
</table>
129+
</section>
130+
131+
<section>
132+
<h2>Manual Pages</h2>
133+
<p>For more detailed information, use the manual page for the <code>cat</code> command:</p>
134+
<div class="code-block">
135+
<code>man cat</code>
136+
</div>
137+
</section>
138+
</div>
139+
</body>
140+
</html>

FDO1/cat/style.css

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
* {
2+
margin: 0;
3+
padding: 0;
4+
box-sizing: border-box;
5+
}
6+
7+
body {
8+
font-family: Arial, sans-serif;
9+
background-color: #f9f9f9;
10+
color: #333;
11+
line-height: 1.6;
12+
}
13+
14+
.container {
15+
max-width: 800px;
16+
margin: 40px auto;
17+
padding: 20px;
18+
background-color: #fff;
19+
border-radius: 8px;
20+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
21+
}
22+
23+
h1 {
24+
color: #1e90ff;
25+
margin-bottom: 20px;
26+
}
27+
28+
h2 {
29+
color: #1e90ff;
30+
margin-top: 20px;
31+
}
32+
33+
h3 {
34+
margin-top: 15px;
35+
color: #444;
36+
}
37+
38+
p {
39+
margin-bottom: 15px;
40+
}
41+
42+
ul {
43+
margin-top: 10px;
44+
padding-left: 20px;
45+
}
46+
47+
li {
48+
margin-bottom: 10px;
49+
}
50+
51+
.code-block {
52+
background-color: #f4f4f4;
53+
padding: 10px;
54+
border-left: 3px solid #1e90ff;
55+
margin: 10px 0;
56+
font-family: monospace;
57+
}
58+
59+
code {
60+
font-family: monospace;
61+
color: #c7254e;
62+
background-color: #f9f2f4;
63+
padding: 2px 4px;
64+
border-radius: 4px;
65+
}
66+
67+
table {
68+
width: 100%;
69+
border-collapse: collapse;
70+
margin-top: 15px;
71+
}
72+
73+
thead {
74+
background-color: #1e90ff;
75+
color: #fff;
76+
}
77+
78+
th, td {
79+
padding: 10px;
80+
border: 1px solid #ddd;
81+
text-align: left;
82+
}
83+
84+
tbody tr:nth-child(even) {
85+
background-color: #f4f4f4;
86+
}

FDO1/cp/index.html

+159
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>cp Command Explanation</title>
7+
<link rel="stylesheet" href="style.css">
8+
</head>
9+
<body>
10+
<div class="container">
11+
<h1>Understanding the <code>cp</code> Command</h1>
12+
13+
<section>
14+
<h2>Basic Usage of <code>cp</code></h2>
15+
<p>The <code>cp</code> command is used to copy files and directories in Linux. The most basic usage is:</p>
16+
<div class="code-block">
17+
<code>cp [source_file] [destination]</code>
18+
</div>
19+
<p>This will copy the specified file from the source to the destination.</p>
20+
</section>
21+
22+
<section>
23+
<h2>Options Available with <code>cp</code></h2>
24+
25+
<h3><code>cp</code> (Basic Copy)</h3>
26+
<p>Copies a file or directory from one location to another:</p>
27+
<div class="code-block">
28+
<code>cp file1.txt /home/user/directory/</code>
29+
</div>
30+
31+
<h3><code>cp -r</code> (Recursive Copy)</h3>
32+
<p>Copies directories recursively (i.e., it copies the directory along with all its files and subdirectories):</p>
33+
<div class="code-block">
34+
<code>cp -r directory1/ /home/user/directory2/</code>
35+
</div>
36+
37+
<h3><code>cp -f</code> (Force Overwrite)</h3>
38+
<p>Forces the overwrite of existing files without confirmation:</p>
39+
<div class="code-block">
40+
<code>cp -f file1.txt /home/user/directory/</code>
41+
</div>
42+
43+
<h3><code>cp -i</code> (Interactive Mode)</h3>
44+
<p>Prompts the user for confirmation before overwriting files:</p>
45+
<div class="code-block">
46+
<code>cp -i file1.txt /home/user/directory/</code>
47+
</div>
48+
49+
<h3><code>cp -u</code> (Update Only)</h3>
50+
<p>Copies only when the source file is newer than the destination file or if the destination file does not exist:</p>
51+
<div class="code-block">
52+
<code>cp -u file1.txt /home/user/directory/</code>
53+
</div>
54+
55+
<h3><code>cp -v</code> (Verbose Output)</h3>
56+
<p>Displays detailed information about the copying process:</p>
57+
<div class="code-block">
58+
<code>cp -v file1.txt /home/user/directory/</code>
59+
</div>
60+
61+
<h3><code>cp -p</code> (Preserve File Attributes)</h3>
62+
<p>Preserves file attributes such as modification time, access time, and file permissions:</p>
63+
<div class="code-block">
64+
<code>cp -p file1.txt /home/user/directory/</code>
65+
</div>
66+
67+
<h3><code>cp -a</code> (Archive Mode)</h3>
68+
<p>Preserves the original file structure, attributes, and symbolic links while copying directories recursively:</p>
69+
<div class="code-block">
70+
<code>cp -a directory1/ /home/user/directory2/</code>
71+
</div>
72+
73+
<h3><code>cp --parents</code></h3>
74+
<p>Copies the file along with its parent directory structure:</p>
75+
<div class="code-block">
76+
<code>cp --parents dir1/dir2/file.txt /destination/</code>
77+
</div>
78+
79+
<h3><code>cp -n</code> (No Overwrite)</h3>
80+
<p>Prevents overwriting existing files at the destination:</p>
81+
<div class="code-block">
82+
<code>cp -n file1.txt /home/user/directory/</code>
83+
</div>
84+
85+
<h3><code>cp --help</code></h3>
86+
<p>Displays the help manual for the <code>cp</code> command:</p>
87+
<div class="code-block">
88+
<code>cp --help</code>
89+
</div>
90+
</section>
91+
92+
<section>
93+
<h2>Summary of Options</h2>
94+
<table>
95+
<thead>
96+
<tr>
97+
<th>Option</th>
98+
<th>Description</th>
99+
</tr>
100+
</thead>
101+
<tbody>
102+
<tr>
103+
<td><code>cp [source_file] [destination]</code></td>
104+
<td>Basic file copy.</td>
105+
</tr>
106+
<tr>
107+
<td><code>cp -r [directory]</code></td>
108+
<td>Recursively copies directories and their contents.</td>
109+
</tr>
110+
<tr>
111+
<td><code>cp -f [file]</code></td>
112+
<td>Forces overwriting of existing files.</td>
113+
</tr>
114+
<tr>
115+
<td><code>cp -i [file]</code></td>
116+
<td>Prompts for confirmation before overwriting files.</td>
117+
</tr>
118+
<tr>
119+
<td><code>cp -u [file]</code></td>
120+
<td>Copies only if the source file is newer or the destination file doesn't exist.</td>
121+
</tr>
122+
<tr>
123+
<td><code>cp -v [file]</code></td>
124+
<td>Verbose mode, showing details during the copy process.</td>
125+
</tr>
126+
<tr>
127+
<td><code>cp -p [file]</code></td>
128+
<td>Preserves file attributes like timestamps and permissions.</td>
129+
</tr>
130+
<tr>
131+
<td><code>cp -a [directory]</code></td>
132+
<td>Preserves the file attributes, symbolic links, and structure while copying.</td>
133+
</tr>
134+
<tr>
135+
<td><code>cp --parents [file]</code></td>
136+
<td>Copies the file along with its parent directory structure.</td>
137+
</tr>
138+
<tr>
139+
<td><code>cp -n [file]</code></td>
140+
<td>Prevents overwriting existing files.</td>
141+
</tr>
142+
<tr>
143+
<td><code>cp --help</code></td>
144+
<td>Displays help information.</td>
145+
</tr>
146+
</tbody>
147+
</table>
148+
</section>
149+
150+
<section>
151+
<h2>Manual Pages</h2>
152+
<p>For more detailed information, use the manual page for the <code>cp</code> command:</p>
153+
<div class="code-block">
154+
<code>man cp</code>
155+
</div>
156+
</section>
157+
</div>
158+
</body>
159+
</html>

0 commit comments

Comments
 (0)