Skip to content
Christopher Strøm edited this page Nov 1, 2020 · 7 revisions

Useful Linux commands

Most of the things in linux are done thorugh the Terminal. Here is a list of the most used commands:

Command Description
ls Lists files and folders
cd Change the working directory to <folder>
cp <src> <dest> Copies <src> to <dest>
mv <src> <dest> Moves <src> to <dest>
sudo Executes the command as the root user
mkdir <directory> Creates a directory in your working directory named <directory>
rm -rf <directory> Remove <directory>
gedit or nano <file> Opens a text editor to edit <file>
sudo apt <program> Installs <program> in Ubuntu
chmd +x <file> Makes <file> executable

Sourcing

The terminal needs to know the location of the ros installation and the current workspace. This is done by adding the locations to the bashrc file, which is run everytime a terminal window is stared. This process is called sourcing.

The following command can be used to edit the bashrc file (use gedit, nano or vim as editor)

nano ~/.bashrc

Make sure the following lines at the bottom of the file (current workspace is usually vortex_ws or catkin_ws)

source /opt/ros/<ros distro>/setup.bash
source ~/<current workspace>/devel/setup.bash

Remember to reopen the terminal or to rerun bashrc after changing it eg

source ~/.bashrc