******************* Command Line Basics ******************* A lot of work on the programming team involves the terminal so here is a quick reference for getting comfortable with working in the terminal. Note that linux and macOS are both Unix operating systems. GREAT .. tabs:: .. group-tab:: Unix .. code-block:: bash cd # Change current directory to specified folder pwd # Print working directory ls # List files & folders in the working directory clear # Clear the terminal screen (shortcut: ctrl + l) rm # Remove a file rm -rf # Delete a folder mv # Move/rename a file cp # Copy a file cp -R # Copy a folder top # Show CPU usage .. group-tab:: Windows .. code-block:: bash cd # Change current directory to specified folder cd # Print working directory dir # List files & folders in the working directory cls # Clear the terminal screen (shortcut: ctrl + l) del # Remove a file deltree # Delete a folder move # Move/rename a file copy # Copy a file xcopy # Copy a folder mem # Show CPU usage .. note:: In order to go into the parent folder use :code:`cd ..` Other Useful Unix Commands ========================== - :code:`which` shows where an executable is installed on the path (ex: :code:`which python`) - :code:`shutdown` must be run on the Jetson to properly shut it down before removing power source. - :code:`ctrl` + :code:`c` will stop anything executing in the terminal (this is how you stop a node) - :code:`code .` will open the current directory in vscode if vscode was added to the path as :code:`code` - Use the pipe operator :code:`|` to send output to another command: - Ex: In order to find a file in a huge directory: :code:`ls | grep ` - :code:`chmod +x ` will give a file executable permissions (chmod stands for change mode) - :code:`>` will redirect the output from a previous command (e.g. :code:`ls > list.txt` writes the directories to the file) - :code:`>>` will append the output to the end of an existing file while :code:`>` overwrites - Ex: :code:`echo "source /opt/ros/foxy >> .bashrc` will append the sourcing command to your bashrc - `More on Redirecting Output, Input, & Errors `_