-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e0a916f
commit 40b7489
Showing
11 changed files
with
1,222 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,389 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"\n", | ||
"\n", | ||
"<h1><div align=\"left\">Introduction and brif history of Unix </div></h1>" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/html": [ | ||
"\n", | ||
"<div align=\"center\"><iframe src=\"https://docs.google.com/presentation/d/1wK2-Kt7WfePq9aADqTB1yggx8r5Qr0mGeZdbH3VC6lw/edit?usp=sharing\" frameborder=\"0\" width=\"900\" height=\"550\" allowfullscreen=\"false\" mozallowfullscreen=\"true\" webkitallowfullscreen=\"false\"></iframe></div>" | ||
], | ||
"text/plain": [ | ||
"<IPython.core.display.HTML object>" | ||
] | ||
}, | ||
"metadata": {}, | ||
"output_type": "display_data" | ||
} | ||
], | ||
"source": [ | ||
"%%HTML\n", | ||
"\n", | ||
"<div align=\"center\"><iframe src=\"https://docs.google.com/presentation/d/1wK2-Kt7WfePq9aADqTB1yggx8r5Qr0mGeZdbH3VC6lw/edit?usp=sharing\" frameborder=\"0\" width=\"900\" height=\"550\" allowfullscreen=\"false\" mozallowfullscreen=\"true\" webkitallowfullscreen=\"false\"></iframe></div>" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"\n", | ||
"# Practical\n", | ||
"\n", | ||
"Let's get hands on with some basic linux commands. As they say practice makes perfect. Most of this notebook is comprized of elements from the *Linux for Robotics* course offered by the construct linked here: " | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"Open up a shell and execute the following to change into the 'src' folder in catkin directory\n", | ||
"\n", | ||
"```console\n", | ||
"cd /home/user/catkin_ws/src/\n", | ||
"```\n", | ||
"\n", | ||
"Then use git to clone inot the previously mentione directory\n", | ||
"\n", | ||
"```console\n", | ||
"git clone https://bitbucket.org/theconstructcore/linux_course_files.git\n", | ||
"```\n", | ||
"\n", | ||
"From there you should see the following displayed:\n", | ||
"\n", | ||
"\n", | ||
"<img src=\"https://drive.google.com/uc?id=1KqAWzx092-vXeRHhs-hQp2csyedB54uZ\" width=\"350\" align=\"center\">" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"## 'tree' command to see directory tree\n", | ||
"\n", | ||
"Open up a shell and execute the following to change into the 'src' folder in catkin directory\n", | ||
"\n", | ||
"```console\n", | ||
"tree\n", | ||
"```\n", | ||
"\n", | ||
"You should see the very same directory structure as in the text editor above:\n", | ||
"\n", | ||
"<img src=\"https://drive.google.com/uc?id=1Dpi2jv-E7LpWqlGo6JBUkzvy760j4A0j\" WIDTH=\"300\" align=\"center\">" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"## 'cd' command with absolute path\n", | ||
"\n", | ||
"The cd command is one of the most important ones in Linux. It allows you to go into a specific directory. For instance, let's execute the following command:\n", | ||
"\n", | ||
"```console\n", | ||
"cd /home/user/catkin_ws/src/linux_course_files/move_bb8_pkg/src/\n", | ||
"```\n", | ||
"\n", | ||
"The command you executed has taken you directly to the folder named src, passing though many different folders on its way (user, catkin_ws, src, linux_course_files, move_bb8_pkg...)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"## 'pwd' command\n", | ||
"\n", | ||
"pwd stands for print working directory\n", | ||
"\n", | ||
"```consoole\n", | ||
"pwd\n", | ||
"```\n", | ||
"\n", | ||
"Should result in the following:\n", | ||
"\n", | ||
"\n", | ||
"<img src=\"https://drive.google.com/uc?id=1amRyTHMLu9xHMTq4dV8FBTITKc_7-JcZ&export=download\" align=\"center\">" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"## 'cd' command with relative path\n", | ||
"\n", | ||
"The cd command can also be used to move up a directory tree using a relative path.\n", | ||
"Using two single dots (periods) can be used to move one directory behind relative to the directory that you are currently located.\n", | ||
"\n", | ||
"```console\n", | ||
"cd ../\n", | ||
"```\n", | ||
"\n", | ||
"You should now be in the following directory\n", | ||
"\n", | ||
"<img src=\"https://drive.google.com/uc?id=1NcpLROJf4NBN6guYjgX4fGQtAAU2c_bd&export=download\" width=\"500\" align=\"center\">" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"### Chaining relative paths\n", | ||
"\n", | ||
"It is also possible to chain the paths as following:\n", | ||
"\n", | ||
"```console\n", | ||
"cd ../../\n", | ||
"```\n", | ||
"\n", | ||
"<img src=\"https://drive.google.com/uc?id=16NKqVTnbhozWhwdQV7-i3J18dS-aZBbH&export=download\" width=\"500\" align=\"center\">" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"## 'ls' list directory contents \n", | ||
"\n", | ||
"The simple command ls stands for list and should give you a list of files currently in directory\n", | ||
"\n", | ||
"```console\n", | ||
"ls\n", | ||
"```\n", | ||
"\n", | ||
"<img src=\"https://drive.google.com/uc?id=12Z2CUE4CK5_u2-sa8rwEDb_Gip13qLrL&export=download\" width=\"500\" align=\"center\">" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"## 'ls -l' long list of directory contents \n", | ||
"\n", | ||
"The simple command ls stands for list and should give you a list of files currently in directory\n", | ||
"\n", | ||
"```console\n", | ||
"ls -l\n", | ||
"```\n", | ||
"\n", | ||
"The above command also has an alias or a shortcut command that can also be called to do the same thing.\n", | ||
"\n", | ||
"```console\n", | ||
"ll\n", | ||
"```\n", | ||
"\n", | ||
"<img src=\"https://drive.google.com/uc?id=15cX4p_WGocKn4DDj0npTbOY0lJVXdxw3&export=download\" width=\"500\" align=\"center\">" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"## 'ls -la' long list hidden files\n", | ||
"\n", | ||
"First let's go back to our home directory.\n", | ||
"Either using cd along with a tilde or by itself and pressing enter will work.\n", | ||
"\n", | ||
"**Option 1:**\n", | ||
"```console\n", | ||
"cd ~\n", | ||
"```\n", | ||
"\n", | ||
"**Option 2:**\n", | ||
"```console\n", | ||
"cd\n", | ||
"```\n", | ||
"\n", | ||
"Now that you are in your home directory please type in ls by itself then type in the following command:\n", | ||
"\n", | ||
"```console\n", | ||
"ls -la\n", | ||
"```\n", | ||
"\n", | ||
"<img src=\"https://drive.google.com/uc?id=1lFlW_brQu0WRNVK4uuj34Zn-1OlyD9WW&export=download\" width=\"500\" align=\"center\">" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"## 'mkdir' command\n", | ||
"\n", | ||
"\n", | ||
"It allows you to create a new directory. Again, let's first let's go back to our home directory.\n", | ||
"Then type in the following:\n", | ||
"\n", | ||
"```console\n", | ||
"mkdir my_folder\n", | ||
"```\n", | ||
"\n", | ||
"<img src=\"https://drive.google.com/uc?id=1FwmuLoYvdAhOfQ231f7cvqtlvfwWF07e&export=download\" width=\"500\" align=\"center\">" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"## \"touch\" command\n", | ||
"\n", | ||
"There are a few ways that you can create a file within a linx operating system, however the most commonly used is with the touch command. Go inside the folder you created in the previous section, and create a new file named **my_file.txt**\n", | ||
"\n", | ||
"**Step 1**\n", | ||
"```\n", | ||
"cd ~/my_folder\n", | ||
"```\n", | ||
"\n", | ||
"**Step 2**\n", | ||
"```console\n", | ||
"touch my_file.txt\n", | ||
"```\n", | ||
"\n", | ||
"If you are cheeky you can also do both at once in the following manner.\n", | ||
"\n", | ||
"**Option 1**\n", | ||
"```console\n", | ||
"mkdir my_folder; cd ~/my_folder; touch my_file.txt\n", | ||
"```\n", | ||
"\n", | ||
"**Option 2**\n", | ||
"```console\n", | ||
"cd ~/my_folder| touch my_file.txt\n", | ||
"```" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"## \"vi\" visual editor\n", | ||
"\n", | ||
"We will use a command line editor that is native to Unix systems called 'vi' to edit the 'my_file.txt\" that we just created.\n", | ||
"Type in the following command in your shell and pay attention to the very bottom of it.\n", | ||
"\n", | ||
"```console\n", | ||
"vi my_file.txt\n", | ||
"```\n", | ||
"\n", | ||
"<img src=\"https://drive.google.com/uc?id=1sdsKdHEnzXtAQzTMnbdBcjn2VoZzfKgG&export=download\" width=\"350\" align=\"center\">" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"## \"vi\" insert mode\n", | ||
"\n", | ||
"To actually entert text into your file you need to be in insert mode.\n", | ||
"To get into inset mode please type the letter 'i' and that should be reflected at the very bottom also.\n", | ||
"\n", | ||
"<img src=\"https://drive.google.com/uc?id=1OHFcrnBhQ-uEDGmFAdaBSF_GXr4XlVTZ&export=download\" width=\"350\" align=\"center\">" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"## \"vi\" save and exit\n", | ||
"\n", | ||
"Once in \"insert mode\" please type in \"Autonomous Air Vehicle Racing\" then exit the insert mode by clicking the escape key on your keyboard.\n", | ||
"Type the following commands to exit and save the file.\n", | ||
"\n", | ||
"```console\n", | ||
":wq\n", | ||
"```\n", | ||
"\n", | ||
"or\n", | ||
"```console\n", | ||
":x\n", | ||
"```\n", | ||
"\n", | ||
"<img src=\"https://drive.google.com/uc?id=1po8qw_JaaC7kCdshdjanHZbiXWLEhi42&export=download\" width=\"350\" align=\"center\">" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"### 'mv' to move/ rename a file\n", | ||
"\n", | ||
"The 'mv' command quite literally stands for move and has the following structure.\n", | ||
"This command can also be used to rename files.\n", | ||
"\n", | ||
"```\n", | ||
"mv <file/folder we want to move> <destination>\n", | ||
"```\n", | ||
"\n", | ||
"To re-name the file\n", | ||
"```\n", | ||
"mv my_file.txt renamed_file.txt\n", | ||
"```\n", | ||
"\n", | ||
"Move the renamed file:\n", | ||
"\n", | ||
"```\n", | ||
"mv renamed_file.txt ~/catkin_ws/src/linux_course_files/move_bb8_pkg/src\n", | ||
"```\n", | ||
"\n", | ||
"Change directory into the desired workspace:\n", | ||
"```\n", | ||
"cd ~/catkin_ws/src/linux_course_files/move_bb8_pkg/sr\n", | ||
"```\n", | ||
"\n", | ||
"Do both by chaining commands\n", | ||
"```\n", | ||
"mv renamed_file.txt ~/catkin_ws/src/linux_course_files/move_bb8_pkg/src;cd ~/catkin_ws/src/linux_course_files/move_bb8_pkg/sr\n", | ||
"```\n", | ||
"\n", | ||
"Please type in the **ls -l** command again in order to see the files.\n", | ||
"You'll notice that there is a difference between the colors of the files.\n", | ||
"\n", | ||
"\n", | ||
"<img src=\"https://drive.google.com/uc?id=1gFzypzFD7ZyCgILrNjVcaQjSLtR0kaM_&export=download\" align=\"center\">" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"## Make our BB8 move in a circle\n", | ||
"\n", | ||
"```shell\n", | ||
"python move_bb8_circle.py\n", | ||
"```\n", | ||
"\n", | ||
"Take a look at your windows screen." | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 2", | ||
"language": "python", | ||
"name": "python2" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 2 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython2", | ||
"version": "2.7.16" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
Oops, something went wrong.