Ubuntu Basics

From robotics

The command Line

Ubuntu like all personal computers revolves around a command line interface. Anything you have ever done on a PC is executed from the command line. Every time you open, copy, or paste a file it is executed in the command line. The program used to access the command line in Ubuntu is terminal. The command line is where most actions will be performed while using and working with ROS. Here are to resources for tutorials http://www.ee.surrey.ac.uk/Teaching/Unix/ and http://ryanstutorials.net/linuxtutorial/

Basic Commands

Auto Complete

Tab is the auto complete button in the command line. If there are multiple options it will list them. It can complete paths and commands. Use it!

Root

The forward slash represents the division between folders or files. The very first / is the root directory. The / is equivilant to the C:/ drive in a windows machine.

/

Home

The tilde is a short hand for the home directory. The long hand equivalent would be /home/username

~

Usually you will see "~/" which is "/home/user/". This is where the terminal starts off.

ls

list files and directories in current folder.
ls

ls -a

list all files and directories
ls -a

mkdir

make a directory
mkdir ~/unixstuff

cd Directory

change to named directory
cd unixstuff

cd

change to home-directory
cd

cd ~

change to home-directory
cd ~

cd ..

change to parent directory
cd ..

pwd

display the path of the current directory
pwd

cp file1 file2

copy file1 and call it file2
cp ~/filetocopy ~/copiedfile

mv file1 file2

move or rename file1 to file2

rm file

remove a file
rm ~/file
you can also remove a folder and all its files
rm ~/folder -r

rmdir directory

remove a directory
rmdir ~/directory

grep 'keyword' file

search a file for keywords

grep myrobot ~/

man command

read the online manual page for a command

man grep

Compression

A tar.bz2 is the standard compressed file for Ubuntu.

To extract a tar.bz2 file to the current directory

tar jxvf <filename>.tar.bz2

To Compress a tar.bz2 to the current directory

tar jcvf <filename>.tar.bz2 dir1 dir2 file1 file2 etc

For more infomation visit Ubuntu Compression. The Ubuntu page includes .zip, .tar, .iso, and more.

Ubuntu Programs

Terminal

Terminal is a basic command line interface. Using the terminal The .bashrc file in the home directory is executed each time a terminal window is open. If you would like something to execute every time you open a terminal simply add it to the end of this file.

export ROS_MASTER_URI=http://192.168.1.1:11311  //The Robots IP address.
export ROS_HOSTNAME=192.168.1.2    // Workstation (The pc your looking at)

Gedit

Gedit is the Ubuntu default text editor with code coloring. It is similar to wordpad++ for windows.

NANO

Nano is an in terminal notepad for editing when you do not have graphics. It is minimalist and straight forward.

VIM

VIM is a command line text editing software that is installed by defualt on basically every operating system(on android and ios there is an app). It can be used as a command line interface and to execute programs in GUI's. It is worth knowing but is not required.

LibreOffice

LibreOffice Is an opensource version of office utilities.